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 permission detection for updating emojis #1125

Merged
merged 2 commits into from
Sep 1, 2023

Conversation

Alch-Emi
Copy link
Contributor

@Alch-Emi Alch-Emi commented Feb 18, 2023

Description

Fixes #1069

Issue: When the emoji pack state event has a different permission level than the base room event permission level, Cinny incorrectly determines the permission level required to send the event. This can lead to situations where the user should be able to edit the emojis but is told by cinny that they can not (as reported in the original issue) or to situations where Cinny's UI indicates that the user should be able to edit emojis, but encounters an error when they try to send the event, because they lack permissions.

Diagnosis: The RoomEmojis molecule incorrectly checks the user's power level against the default level for state events.

Resolution: Rather than independently getting the user's powerlevel then checking it against the state event level using hasSufficientPowerLevelFor(), use the built-in method maySendStateEvent() to check whether im.ponies.room_emote. This appears to be the intended method for determining whether the user may send a state event such as this one.

Design Decisions / Future Work: This solution hard-codes the im.ponies.room_emote event name despite the fact that it is only a temporary name for this state event. The eventual migration to a finalized event name is considered by this author to be a separate issue, however, and one which will require comprehensive changes to the way emojis are managed, and is therefore unfit for this small bugfix. Note that im.ponies.room_emotes is already hardcoded for the detection, use, updating, and creation of room image packs.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • [N/A] I have commented my code, particularly in hard-to-understand areas
  • [N/A] I have made corresponding changes to the documentation
  • My changes generate no new warnings

@github-actions
Copy link

github-actions bot commented Feb 18, 2023

Preview: https://1125--pr-cinny.netlify.app
⚠️ Exercise caution. Use test accounts. ⚠️

@ajbura ajbura self-requested a review April 8, 2023 02:37
@gaykitty
Copy link

gaykitty commented Sep 1, 2023

Can this get merged soon plz?

@github-actions
Copy link

github-actions bot commented Sep 1, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@Alch-Emi
Copy link
Contributor Author

Alch-Emi commented Sep 1, 2023

I have read the CLA Document and I hereby sign the CLA 🤢

ajbura added a commit to cinnyapp/cla that referenced this pull request Sep 1, 2023
Copy link
Member

@ajbura ajbura left a comment

Choose a reason for hiding this comment

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

Thanks.

@ajbura ajbura merged commit 47f6c44 into cinnyapp:dev Sep 1, 2023
2 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't edit emoji pack in room that I should be able to
3 participants