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] Option to Join Read-Only Channels #27488

Merged
merged 14 commits into from Feb 14, 2023

Conversation

henit-chobisa
Copy link
Contributor

@henit-chobisa henit-chobisa commented Dec 8, 2022

The following PR is currently Ready for Review.

Special thanks to @milton-rucks, for guiding me throughout this PR.

Issue in brief:

There is no Join Option to join a read-only channel, there is only a static MessageBox indicating the read-only status of the room.

Steps to reproduce:

  • A simple user enters the channel in read-only mode.
  • He cannot join the channel because there is no button to do so.

Expected behavior:

A non-administrator user can by himself join channels in read-only mode.

Motivation:

Considering a scenario where a read-only room is meant for very crucial updates from significant administrators like CEOs and CFOs, an individual will find it necessary to be able to,

  • Get Instant Notifications from this Channel.
  • Able to Pin this channel to the Sidebar to have consistent monitoring of it.
  • Join the channel, notifying his presence to the administrators.

Technical Reasoning

  • Issue

    • There is no join button given for the ComposerReadOnly element which leads to the display of a simple MessageFooterCallout with content as "Room is read-only".
  • Solution

    • Adding a Join Button, but before that, we must have two things
      1. The current room, from which we will be able to take the room_id, for this I used useRoom() hook.
      2. If the user had already joined this room, I must have knowledge of the current subscriptions, which either be passed as props from the ComposerContainer element or can be fetched from the useUserIsSubscribed() hook, I used the second approach.
    • Now the joinRoom functionality need to be triggered with the above entities, can be done in three ways:
      • Using joinRoom endpoint.
      • Using chatMessage's, dataAPI provided by the composerContainer using the dataAPI's JoinRoom method.
      • Using the joinRoom, meteor call.
        Out of all three, I choose the third approach for this method.

Outcome and Preview

Screen.Recording.2022-12-14.at.6.05.05.PM.mov

Screenshot 2022-12-14 at 6 10 34 PM

Screenshot 2022-12-14 at 6 10 06 PM

Screenshot 2022-12-14 at 6 10 16 PM

Screenshot 2022-12-14 at 6 10 28 PM

Closes #27412

@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Merging #27488 (dbd2981) into develop (a0f4950) will increase coverage by 1.03%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #27488      +/-   ##
===========================================
+ Coverage    41.58%   42.62%   +1.03%     
===========================================
  Files          826      799      -27     
  Lines        16948    16445     -503     
  Branches      2074     1999      -75     
===========================================
- Hits          7048     7009      -39     
+ Misses        9620     9161     -459     
+ Partials       280      275       -5     
Flag Coverage Δ
e2e 42.62% <ø> (+1.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@henit-chobisa henit-chobisa reopened this Dec 10, 2022
@henit-chobisa henit-chobisa changed the title [FIX] Unable to join a public channel in read-only mode [FEAT] Option to Join Read-Only Channels Dec 14, 2022
@henit-chobisa henit-chobisa changed the title [FEAT] Option to Join Read-Only Channels [IMPROVE] Option to Join Read-Only Channels Dec 14, 2022
@henit-chobisa henit-chobisa marked this pull request as ready for review December 14, 2022 22:25
@henit-chobisa henit-chobisa requested a review from a team as a code owner December 14, 2022 22:25
.gitignore Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
murtaza98
murtaza98 previously approved these changes Dec 19, 2022
Copy link
Contributor

@murtaza98 murtaza98 left a comment

Choose a reason for hiding this comment

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

LGTM! Great work 👏

@henit-chobisa
Copy link
Contributor Author

LGTM! Great work 👏

Thank you so much, Murtaza
Really Really grateful to you for the review and amazing guidance! 🙏

@murtaza98 murtaza98 added this to the 6.0.0 milestone Dec 22, 2022
@ggazzo ggazzo changed the title [IMPROVE] Option to Join Read-Only Channels [FIX] Option to Join Read-Only Channels Feb 14, 2023
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: needs QA labels Feb 14, 2023
@murtaza98 murtaza98 dismissed debdutdeb’s stale review February 14, 2023 04:20

Dismissing review since its blocking merge. @Debdut feel free to re-request review if required

@kodiakhq kodiakhq bot merged commit 7c064aa into RocketChat:develop Feb 14, 2023
@sampaiodiego sampaiodiego mentioned this pull request Feb 17, 2023
@sampaiodiego sampaiodiego mentioned this pull request Mar 9, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to join a public channel in read-only mode
4 participants