RocketChat / EmbeddedChat

An easy to use full-stack component (ReactJS) embedding Rocket.Chat into your webapp
https://www.npmjs.com/package/@embeddedchat/react
107 stars 214 forks source link

[Fix] Pin icon should not be visible to non-admin users #520

Open thesynthax opened 3 months ago

thesynthax commented 3 months ago

Brief Title

Pin icon should not be visible to non-admin users like in main Rocket.Chat application. Check #519 and #517 for complete details

Acceptance Criteria fulfillment

Fixes #519

Video/Screenshots

ss_146

P.S: This PR is a continuation to from #518 as it requires the correct usage for UserStore.

Spiral-Memory commented 3 months ago

This is not a valid solution because it's not only the admin who can pin messages. The permissions to pin messages will have to be decided by the workspace administrator in Rocket.chat permission settings. Based on that, whoever has the permission to pin messages will be allowed. So first, you have to fetch the permission info, then check if the current person has permission to do so, and only after that can you make this decision. Not only that admins can create custom roles if they have premium, you might skip that for now but the one i mentioned is extremely important to consider. I am attaching a screenshot reference for you:

image

thesynthax commented 3 months ago

Thanks a lot for this insight @Spiral-Memory, I will try to create a commit which will fetch the necessary permissions and check through those. Thanks again!