-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Add Not subscribe
tab in channels settings.
#30021
base: main
Are you sure you want to change the base?
Conversation
Hello @zulip/server-streams members, this pull request was labeled with the "area: stream settings" label, so you may want to check it out! |
41fb128
to
d2764b1
Compare
Not subscribe tab
in channels settings
Not subscribe tab
in channels settingsNot subscribe
tab in **channels settings**.
Not subscribe
tab in **channels settings**.Not subscribe
tab in channels settings.
Thanks! The tooltip should refer to "channels", not "streams" now. |
d2764b1
to
50b9f81
Compare
@alya made the changes :) |
@sahil839 can you review this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posted few comments.
Also, the "Fixes .." line in commit message should be in the last commit which completes all the points mentioned in the issue. In the previous commit, you can write "Fixes part of ..".
web/src/stream_edit.js
Outdated
} | ||
case "not-subscribed": { | ||
browser_history.update("#channels/notsubscribed"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these extra lines before break
can be removed.
@@ -744,6 +757,11 @@ export function change_state(section, left_side_tab, right_side_tab) { | |||
return; | |||
} | |||
|
|||
if (section === "notsubscribed") { | |||
toggler.goto("not-subscribed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this not call empty_right_panel
?
web/src/stream_ui_updates.js
Outdated
|
||
export function is_subscribed_stream_tab_active() { | ||
// Returns true if "Subscribed" tab in stream settings is open | ||
// otherwise false. | ||
return show_subscribed; | ||
} | ||
|
||
export function is_not_subscribed_stream_tab_active() { | ||
// Returns true if "Subscribed" tab in stream settings is open |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is incorrect.
web/src/stream_settings_ui.js
Outdated
case "all-streams": { | ||
stream_ui_updates.set_show_subscribed(false); | ||
stream_ui_updates.set_show_not_subscribed(false); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These empty lines can also be removed.
@@ -508,6 +513,7 @@ export function get_left_panel_params() { | |||
const params = { | |||
input, | |||
show_subscribed: stream_ui_updates.show_subscribed, | |||
show_not_subscribed: stream_ui_updates.show_not_subscribed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can just store the selected name in a single variable instead of using two boolean variables, but I am not sure.
Let us keep it as it is for now and wait for further feedback.
(is_subscribed_stream_tab_active() && sub.subscribed) || | ||
(is_not_subscribed_stream_tab_active() && !sub.subscribed) | ||
) { | ||
$row.removeClass("notdisplayed"); | ||
} else if (sub.invite_only || current_user.is_guest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This becomes confusing as we show the non-subscribed stream in the tab even when the stream is private, but then the stream is hidden ultimately as the client will receive the "remove" event. So, the behavior is fine but we can probably improve the code to avoid any future bugs.
Not sure what would be the best way to handle this, but just mentioning it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we have same behavior if private stream is unsubscribed it is shown in the all streams tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is shown for admins only and not non-admins.
Just to be clear, the behavior in the PR is correct, I am just not sure whether we should remove the stream here only or we should wait for "remove" event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I ask it on CZO ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can wait for a review by Tim first.
50b9f81
to
04ae6ed
Compare
@sahil839 made the changes according to your feedbacks kindly review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posted one comment. Also, please update the commit message to include "Fixes .." line.
<i class="fa fa-plus-circle" aria-hidden="true"></i> | ||
{{~t "Browse {can_subscribe_stream_count} more channels" ~}} | ||
{{~t "Browse {can_subscribe_stream_count} mores channels" ~}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a typo.
(is_subscribed_stream_tab_active() && sub.subscribed) || | ||
(is_not_subscribed_stream_tab_active() && !sub.subscribed) | ||
) { | ||
$row.removeClass("notdisplayed"); | ||
} else if (sub.invite_only || current_user.is_guest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is shown for admins only and not non-admins.
Just to be clear, the behavior in the PR is correct, I am just not sure whether we should remove the stream here only or we should wait for "remove" event.
This commit changes the variable and function name from "subscribed_only" to "show_subscribed" and "set_subscribed_only" to "set_show_subscribed" so that in the next commit, when the "not subscribed" tab is added, we can use a similar variable named "show_unsubscribed" and function named "set_show_unsubscribed".
This commit adds a new tab to the stream settings overlay called "Not subscribed" which lists all the streams the user is not subscribed to. This tab is disabled if the user is a guest. Introduced a new variable called "show_not_subscribed" to replicate a similar model to how the subscribed tab is working. Currently, there are only two tabs: "subscribed" and "all streams" so we can use an if-else condition. Refactored the 'update_stream_row_in_settings_tab' function inside stream_ui_updates.js to include the case of a 'Not-subscribed' tab, so that the tab is immediately updated in any add/remove subscription event. Fixed and added the node tests for these changes.
In the "not-subscribed" tab, when there are no channels to show, we display a text message saying "No channels to show. View all channels" along with a link that redirects the user to the "All channels" tab (All channels(#channels/all)). Updated the update_empty_left_panel_message function in stream_settings_ui.js to modify and determine which banner to display when no channels are available to show, modified that function to also display the banner of the "not-subscribed" tab using a new classname called 'not_subscribed_streams_tab_empty_text'.
This commit changes the redirect links for "Browse channels" and "Browse 1 more stream" to the Not subscribed(#streams/notsubscribed) tab.
Render tooltips for both the tabs if the user is guest user. Fixes zulip#21869.
04ae6ed
to
1679d67
Compare
@sahil839 made the changes. kindly review :) |
Looks good to me. @timabbott ready for your review. There are a couple of things - here and here, that I am not sure and need feeback. |
PR summary:
Not Subscribed tab
to the channels settings that will contain all the channels the user is not subscribed to.No Channels to show. View all channels.
when no channels is available to show.Browse channel
andBrowse 1 more channels
to theNot subscribed
tab.Not subscribed
tab if the user is a guest user.Fixes: #21869
Continuing the works of: #26049
not-subscribed.mp4
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: