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: fixed the app's behavior in read-only channels. #421

Merged

Conversation

Spiral-Memory
Copy link
Collaborator

@Spiral-Memory Spiral-Memory commented Jan 23, 2024

Brief Title

Fixed the issue where, in read-only channels, users with posting permissions can now send messages as usual. However, those users without permission to post can still read messages but are restricted from sending messages to the group. They will be notified that the group is read-only, ensuring appropriate behavior.

Acceptance Criteria fulfillment

  • Fetched the permissions for posting in read-only from the permission API, as mentioned in the Rocket Chat REST API docs, using the endpoint: /api/v1/permissions.listAll.
  • Retrieved the user's permissions using already defined function getChannelRoles() for the channel and determined the permissions of the logged-in user.
  • Compared the user's role with those who are permitted for posting in read-only.
  • Once verified, set a state in the userStore indicating whether the user is allowed to send messages in a read-only group.
  • Utilized that state to render whether the room is read-only and disabled the message box accordingly.
  • Logout the user with appropriate message when channel is private and user is not permitted.

Fixes #420

Video/Screenshots

2024-01-23.18-45-21.mp4

Note: This PR changes the backend code and requires a rebuild.

@Spiral-Memory Spiral-Memory force-pushed the fix/read-only-channel-issue branch 2 times, most recently from 6c95b92 to e22cd7a Compare February 5, 2024 19:44
@Spiral-Memory Spiral-Memory marked this pull request as draft February 5, 2024 20:17
@Spiral-Memory Spiral-Memory force-pushed the fix/read-only-channel-issue branch from e22cd7a to 1ff8962 Compare February 7, 2024 19:38
@Spiral-Memory Spiral-Memory marked this pull request as ready for review February 7, 2024 19:39
@Spiral-Memory Spiral-Memory force-pushed the fix/read-only-channel-issue branch from 1ff8962 to 35d95e0 Compare February 7, 2024 19:48
@Spiral-Memory
Copy link
Collaborator Author

Hey @abhinavkrin , I have made the required changes, and the PR is now ready for review. I am also attaching a video demonstrating the behavior of all possible permutations of non-private-non-read-only channels, non-private but read-only channels, private but not read-only channels, and both private and read-only channels. In all cases, the behavior is now appropriate, addressing all the issues I mentioned earlier. This PR deals with disabling writing to read-only channels if not permitted and showing the same info. Additionally, logout any user if the channel is private and they are not permitted, with a valid toast message.

2024-02-08.01-03-42.mp4

Note: In the video, [email protected] is the authorized user and [email protected] is the unauthorized user. This is to demonstrate the functionality of the app.

@Spiral-Memory Spiral-Memory force-pushed the fix/read-only-channel-issue branch from 3e9feb1 to 0f67236 Compare February 9, 2024 15:35
@abhinavkrin
Copy link
Member

@Spiral-Memory Please resolve merge conflicts

@Spiral-Memory
Copy link
Collaborator Author

@Spiral-Memory Please resolve merge conflicts

Yes Sure @abhinavkrin

@Spiral-Memory Spiral-Memory force-pushed the fix/read-only-channel-issue branch from 0f67236 to 863b01e Compare February 16, 2024 17:36
@Spiral-Memory
Copy link
Collaborator Author

@abhinavkrin, I have resolved the conflicts, please check now.

@Spiral-Memory Spiral-Memory force-pushed the fix/read-only-channel-issue branch 3 times, most recently from 2c67bb1 to 2c73a17 Compare February 17, 2024 17:30
@Spiral-Memory Spiral-Memory force-pushed the fix/read-only-channel-issue branch from 2c73a17 to 571f128 Compare February 17, 2024 17:40
@abhinavkrin abhinavkrin merged commit 6fb23d7 into RocketChat:develop Feb 17, 2024
3 checks passed
Spiral-Memory added a commit to Spiral-Memory/EmbeddedChat that referenced this pull request Feb 22, 2024
* fixed read only channel issue

added error info when no permission

* formatted with prettier
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.

[BUG] Embedded chat malfunctions when channel is read only
2 participants