Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into sebin/task/#2233-cu…
Browse files Browse the repository at this point in the history
…stom-ui-for-installing-pwa
  • Loading branch information
SebinSong committed Jul 25, 2024
2 parents f9fdd14 + cb73265 commit a8608cc
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frontend/controller/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const loginGuard = {

const inviteGuard = {
guard: (to, from) => {
// ex: http://localhost:8000/app/join#groupId=21XWnNRE7vggw4ngGqmQz5D4vAwPYqcREhEkGop2mYZTKVkx8H&secret=5157
// ex: http://localhost:8000/app/join#?groupId=21XWnNRE7vggw4ngGqmQz5D4vAwPYqcREhEkGop2mYZTKVkx8H&secret=5157
return !(to.hash.includes('groupId=') && to.hash.includes('secret='))
},
redirect: (to, from) => ({ path: '/' })
Expand Down
14 changes: 10 additions & 4 deletions frontend/views/containers/chatroom/ChatMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,21 @@ const ChatMixin: Object = {
},
methods: {
redirectChat (chatRoomID: string) {
const name = 'GroupChatConversation'
// Temporarily blocked the chatrooms which the user is not part of
// Need to open it later and display messages just like Slack
chatRoomID = chatRoomID || (this.isJoinedChatRoom(this.currentChatRoomId) ? this.currentChatRoomId : this.groupGeneralChatRoomId)

// NOTE: for better understanding created a variable `shouldUseAlternative` instead of using !chatRoomID.
// to skip passing `chatRoomID` parameter means an intention to redirect to another chatroom
// this happens when the wrong (or cannot accessable) chatRoomID is used while opening group-chat URL
const shouldUseAlternative = !chatRoomID
if (shouldUseAlternative) {
chatRoomID = this.isJoinedChatRoom(this.currentChatRoomId) ? this.currentChatRoomId : this.groupGeneralChatRoomId
}

this.$router.push({
name,
name: 'GroupChatConversation',
params: { chatRoomID },
query: { ...this.$route.query }
query: !shouldUseAlternative ? { ...this.$route.query } : {}
}).catch(logExceptNavigationDuplicated)
},
refreshTitle (title?: string): void {
Expand Down
6 changes: 5 additions & 1 deletion frontend/views/containers/chatroom/PinnedMessages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,11 @@ export default {
.c-pinned-message-content {
margin: 0.5rem 0;
word-break: break-word;
.c-text {
white-space: pre-line;
word-break: break-word;
}
.c-poll-inner {
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const RenderMessageWithMarkdown: any = {
for (const [key, value] of url.searchParams) {
query[key] = value
}
routerOptions.route = { path, query }
routerOptions.route = { path, query, hash: url.hash }
routerOptions.href = this.$router.resolve(routerOptions.route).href
routerOptions.isInAppRouter = true
}
Expand Down
12 changes: 8 additions & 4 deletions frontend/views/containers/group-settings/InvitationsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,14 @@ export default ({
}
},
showRevokeLinkMenu (inviteItem) {
return inviteItem.isAnyoneLink
? this.isUserGroupCreator &&
this.groupShouldPropose // 'Anyone' link must only be revokable when the group size is >= 3 (context: https://github.com/okTurtles/group-income/issues/1670)
: inviteItem.status.isActive
if (inviteItem.status.isActive) {
if (inviteItem.isAnyoneLink) {
// 'Anyone' link must only be revokable when the group size is >= 3 (context: https://github.com/okTurtles/group-income/issues/1670)
return this.isUserGroupCreator && this.groupShouldPropose
}
return true
}
return false
},
handleInviteClick (e) {
if (e.target.classList.contains('js-btnInvite')) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/views/pages/Join.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default ({
pageStatus: 'LOADING',
invitation: {},
groupInfo: {},
query: null
hash: null
}
}
},
Expand All @@ -102,7 +102,7 @@ export default ({
}
},
mounted () {
// For some reason in some Cypress tests it loses the route query when initialized is called
// For some reason in some Cypress tests it loses the route hash when initialized is called
this.ephemeral.hash = new URLSearchParams(this.$route.hash.slice(1))
if (syncFinished || !this.ourIdentityContractId) {
this.initialize()
Expand Down
5 changes: 5 additions & 0 deletions test/cypress/integration/group-proposals.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ describe('Proposals - Add members', () => {
cy.getByDT('openAllProposals').click()
cy.get('[data-test="modal"] > .c-container .c-title').should('contain', 'Archived proposals')
cy.getByDT('modal').within(() => {
// NOTE: this is to wait until all of the 4 proposals are loaded inside the modal
cy.get('.c-container > .c-header-info .has-text-1').should('contain', '4 proposals')
assertInvitationLinkFor(2, 'user4')
assertInvitationLinkFor(1, 'user6')
})
Expand Down Expand Up @@ -408,6 +410,9 @@ describe('Proposals - Add members', () => {
cy.getByDT('openAllProposals').click()
cy.get('[data-test="modal"] > .c-container .c-title').should('contain', 'Archived proposals')
cy.getByDT('modal').within(() => {
// NOTE: this is to wait until all of the 5 proposals are loaded inside the modal
cy.get('.c-container > .c-header-info .has-text-1').should('contain', '5 proposals')

getProposalItems().eq(2).within(() => {
cy.getByDT('title', 'p').should('contain', 'You proposed')
cy.getByDT('statusDescription')
Expand Down

0 comments on commit a8608cc

Please sign in to comment.