Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember whether the welcome screen was seen #2375

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

corrideat
Copy link
Member

No description provided.

Copy link

cypress bot commented Oct 12, 2024

group-income    Run #3259

Run Properties:  status check passed Passed #3259  •  git commit 2a33df9d6f ℹ️: Merge 08bcfdf514550278005e11732118d5ca5f2b1139 into b64ecda81d1b1c9574b1b4490945...
Project group-income
Run status status check passed Passed #3259
Run duration 09m 29s
Commit git commit 2a33df9d6f ℹ️: Merge 08bcfdf514550278005e11732118d5ca5f2b1139 into b64ecda81d1b1c9574b1b4490945...
Committer Ricardo Iván Vieitez Parra
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 10
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 111

@@ -52,6 +54,14 @@ export default ({
toDashboard () {
if (this.isButtonClicked) return
this.isButtonClicked = true
const groupContractID = this.currentGroupId
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether this should be here, or if instead it should be done on the /dashboard page on onMounted. Maybe it doesn't matter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pros of doing it here: it's only done once (for users). Pros of doing it in the /dashboard page: we don't need to change the commands.js in the tests. Cons of doing it in the /dashboard page: need to do this check every time.

@corrideat corrideat marked this pull request as draft October 12, 2024 20:36
@corrideat corrideat self-assigned this Oct 12, 2024
@corrideat corrideat marked this pull request as ready for review October 12, 2024 22:33
Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @corrideat! Review ready!

@@ -283,8 +283,7 @@ sbp('chelonia/defineContract', {
throw new Error(`Cannot leave group ${groupContractID} because the reference hash does not match the latest`)
}

state.groups[groupContractID].hasLeft = true
delete state.groups[groupContractID].inviteSecret
state.groups[groupContractID] = { hash: reference, hasLeft: true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be other attributes on groups that you're overwriting here that shouldn't be overwritten.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There aren't. This is when leaving a group, so we should keep the attributes there at a minimum.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that there aren't at the moment, but in the future if more attributes are added then developers must remember to update this code to make sure nothing breaks. Whereas the way it worked before didn't need as much attention.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but in the future if more attributes are added then developers must remember to update this code to make sure nothing breaks

Nothing should break because these are chatroom that we're not part of. Note that attributes are already overwritten when joining a chatroom. The only reason we keep these values around at all (before we deleted the whole thing) is for accounting purposes, so that re-joining works correctly.

then developers must remember to update

I think this is a good thing. You shouldn't need attributes from chatroom you're not a part of. The only exception I can think of is for a future feature that allows you to 'block' a chatroom (to prevent re-joining), in which case it makes sense to be explicit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, making things as they were before still means that developers need to pay attention to this. If a foo attribute were to be added, which is not used after having left, it needs to have a corresponding delete here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok that last comment makes sense... can you add a comment here explaining that?

]),
...mapState([
'currentGroupId'
'currentGroupId',
''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This '' seems like a bug

Comment on lines +357 to +364
const state = sbp('state/vuex/state')
return sbp('gi.actions/identity/setGroupAttributes', {
contractID: state.loggedIn.identityContractID,
data: {
groupContractID: state.currentGroupId,
attributes: { seenWelcomeScreen: true }
}
}).then(() => router.push({ path: '/dashboard' }))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way this can be DRY'd? (Repeated above)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure. It could maybe be a Cypress command.

Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants