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

Fix: Automatically propagate user permission updates #3881

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

rumzledz
Copy link
Contributor

@rumzledz rumzledz commented Dec 9, 2024

Description

Note

Please note that there is an existing issue where the Permissions table on the Completed Action form is not correctly showing the permissions that were removed from the user after a Reputation or Multi-Sig motion has successfully been supported/approved and finalised. This is kind of a complex issue and it will not be addressed on this PR.

There is also an existing issue with reputation motions where the Finalise button has the possibility of getting stuck in a Pending state: #3859. You may or may not come across it but just know that this PR has nothing to do with it.

This PR makes use of subscriptions to automatically refresh member permissions information whenever it's updated.

Out of scope yet relevant and manageable fixes: You should also now be able to see the permissions that are marked for removal on the Completed Action component. BUT please note that this fix is only limited to actions done via Permissions as well as with motions that have not been successfully supported/approved and finalised. Please bear this in mind during testing 🙏

Lastly, I did a wee refactor for setting the user data in our AppContextProvider.

add-remove-permissions

Testing

Note

Make sure that Fry doesn't not have any permissions to begin with

Important

  • Please do not reload the page in between steps
  • Uninstall the Reputation and Multi-Sig extensions
  1. Open an incognito window
  2. Connect Fry's wallet
  3. Bring up the Simple Payment form
  4. Verify that you see this error banner:
image
  1. In the non-incognito window, connect Leela's wallet
  2. Bring up the Manage Permissions form
  3. Give Fry Payer permissions in General
  4. Click the incognito window and verify that the error banner has disappeared
  5. Click the Decision Method field and verify that you see Permissions in the options list
  6. Click the non-incognito window
  7. Remove Fry's permissions from General
  8. Click the incognito window
  9. Verify that you see the error banner again:
image

New stuff

  • Added a new util removeObjectFields which allows you to remove a set of fields from a given object. It's strictly typed so you should be able to see auto-completed fields as you're selecting them:
image

Resolves #3635

@rumzledz rumzledz self-assigned this Dec 9, 2024
@rumzledz rumzledz marked this pull request as ready for review December 9, 2024 19:31
@rumzledz rumzledz requested a review from a team as a code owner December 9, 2024 19:31
@rumzledz rumzledz force-pushed the fix/3635-propagate-permission-update branch 2 times, most recently from ec5c492 to 9943e11 Compare December 9, 2024 19:44
@rumzledz rumzledz marked this pull request as draft December 10, 2024 05:41
@rumzledz rumzledz force-pushed the fix/3635-propagate-permission-update branch from 9943e11 to 03a62a6 Compare December 10, 2024 13:15
@rumzledz rumzledz marked this pull request as ready for review December 10, 2024 13:21
@rumzledz rumzledz changed the title Fix: Automatically propagate user permissions info Fix: Automatically propagate user permission updates Dec 10, 2024
@rumzledz rumzledz force-pushed the fix/3635-propagate-permission-update branch from 03a62a6 to 6696601 Compare December 10, 2024 13:34
rdig
rdig previously approved these changes Dec 11, 2024
Copy link
Member

@rdig rdig left a comment

Choose a reason for hiding this comment

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

Error banner correctly changes state based on the updated permissions.

Note that I've not refreshed either page in between any of the actions

Screenshot from 2024-12-11 15-57-47
Screenshot from 2024-12-11 15-58-20
Screenshot from 2024-12-11 15-58-26
Screenshot from 2024-12-11 15-59-37
Screenshot from 2024-12-11 15-59-40

Copy link
Contributor

@mmioana mmioana left a comment

Choose a reason for hiding this comment

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

Really nice work on this one @rumzledz 💯

Please note no page has been refreshed while following the testing steps 🫡

Started off only with leela having permissions
Screenshot 2024-12-11 at 21 46 34

Tried creating a Simple payment as fry - the error banner is shown
Screenshot 2024-12-11 at 21 47 42

Gave fry Payer permissions in General
Screenshot 2024-12-11 at 21 48 29

The error banner was no longer shown on fry's Simple payment
Screenshot 2024-12-11 at 21 48 36

The Permissions decision method was available
Screenshot 2024-12-11 at 21 48 47

Removed fry's permissions 😢
Screenshot 2024-12-11 at 21 49 22

And back to the error banner for fry
Screenshot 2024-12-11 at 21 49 29

Awesome 🎉

The only reason I'm rejecting this @rumzledz is due to the fact something got wrongly generated for the graphql types, causing the expenditureId and expenditureFunding to be removed from the ColonyMultiSig, so please try running codegen again 🙌

Copy link
Contributor

Choose a reason for hiding this comment

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

@rumzledz please try running codegen again, as we shouldn't be removing the expenditureFunding and expenditureId for the ColonyMultiSig model

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies for this @mmioana , I'm not sure what happened. I just ran it and it generated these for me 😓 But I shall generate it again 👌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All right pushed! 🚀 @mmioana

iamsamgibbs
iamsamgibbs previously approved these changes Dec 12, 2024
Copy link
Contributor

@iamsamgibbs iamsamgibbs left a comment

Choose a reason for hiding this comment

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

Nice job, this works very nicely!

Before:

Screenshot 2024-12-12 at 10 08 22

Screen.Recording.2024-12-12.at.10.09.19.mov

@rumzledz rumzledz dismissed stale reviews from iamsamgibbs and rdig via 910932e December 12, 2024 10:16
Copy link
Member

@rdig rdig left a comment

Choose a reason for hiding this comment

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

Re-approving. Good to go still

Copy link
Contributor

@mmioana mmioana left a comment

Choose a reason for hiding this comment

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

Still working as expected @rumzledz

Screenshot 2024-12-13 at 10 16 00
Screenshot 2024-12-13 at 10 17 06
Screenshot 2024-12-13 at 10 17 16
Screenshot 2024-12-13 at 10 17 26
Screenshot 2024-12-13 at 10 17 54
Screenshot 2024-12-13 at 10 18 05

Good to go! 🚢

@rumzledz rumzledz merged commit e31760e into master Dec 13, 2024
2 checks passed
@rumzledz rumzledz deleted the fix/3635-propagate-permission-update branch December 13, 2024 21:21
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.

[Permissions - QA] Deleted Permissions not reflected in UI until hard refresh
4 participants