Skip to content

Commit

Permalink
Fix error that invite link doesn't work inside chat (#2246)
Browse files Browse the repository at this point in the history
* chore: added a small update and Cypress try

* chore: added comment and Cypress retry

* chore: check if group-chat passes three times in a row

* chore: group-chat passes 4 times in a row

* chore: 5 times pass in a row means it fixes the heisenbug? maybe it's because assert inside then clause?

* fix: error in invitelink

* feat: update Cypress according to the updated invitelink format

* fix: cypress errors according to the changes of inviteLink format

* chore: added comment and Cypress retry

* chore: updated comment and Cypress retry

* fix: added cy.wait and Cypress try

* chore: added comment and Cypress retry

* fix: removing cy.wait

* chore: updated comment and check Cypress passed 2 times in a row

* chore: really passes 3 times in a row?

* chore: updated comment and Cypress retry

* chore: cypress retry

* chore: Cypress retry

* chore: Cypress retry

* chore: Cypress retry

* chore: Cypress retry

* fix: heisenbug in group-proposal

* feat: changed query to hash for security problem

* fix: reverted the format of hash param

* fix: eslint error
  • Loading branch information
Silver-IT authored Jul 25, 2024
1 parent 6380d4d commit 938161d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 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
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
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 938161d

Please sign in to comment.