Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user_groups: Show text when there are no groups in the list.

Sahil Batra3b5bbbc5eebf
diff --git a/web/src/user_group_edit.js b/web/src/user_group_edit.js
index 92d9e879230..a2d57fe71bc 100644
--- a/web/src/user_group_edit.js
+++ b/web/src/user_group_edit.js
@@ -557,6 +557,7 @@ function redraw_left_panel(tab_name) {
}
groups_list_data.sort(compare_by_name);
group_list_widget.replace_list_data(groups_list_data);
+ update_empty_left_panel_message();
}
export function redraw_user_group_list() {
@@ -593,6 +594,31 @@ export function add_or_remove_from_group(group) {
}
}
+export function update_empty_left_panel_message() {
+ // Check if we have any groups in panel to decide whether to
+ // display a notice.
+ let has_groups;
+ const is_your_groups_tab_active =
+ get_active_data().$tabs.first().attr("data-tab-key") === "your-groups";
+ if (is_your_groups_tab_active) {
+ has_groups = user_groups.get_user_groups_of_user(people.my_current_user_id()).length;
+ } else {
+ has_groups = user_groups.get_realm_user_groups().length;
+ }
+ if (has_groups) {
+ $(".no-groups-to-show").hide();
+ return;
+ }
+ if (is_your_groups_tab_active) {
+ $(".all_groups_tab_empty_text").hide();
+ $(".your_groups_tab_empty_text").show();
+ } else {
+ $(".your_groups_tab_empty_text").hide();
+ $(".all_groups_tab_empty_text").show();
+ }
+ $(".no-groups-to-show").show();
+}
+
export function setup_page(callback) {
function initialize_components() {
group_list_toggler = components.toggle({
diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.css
index 198835d5f54..945d5c459d9 100644
--- a/web/styles/subscriptions.css
+++ b/web/styles/subscriptions.css
@@ -353,6 +353,7 @@ h4.user_group_setting_subsection_title {
}
.left .no-streams-to-show,
+ .left .no-groups-to-show,
.right .nothing-selected {
display: block;
margin-top: calc(45vh - 75px);
diff --git a/web/templates/user_group_settings/user_group_settings_overlay.hbs b/web/templates/user_group_settings/user_group_settings_overlay.hbs
index 3d308c159ee..286d0cda112 100644
--- a/web/templates/user_group_settings/user_group_settings_overlay.hbs
+++ b/web/templates/user_group_settings/user_group_settings_overlay.hbs
@@ -24,6 +24,22 @@
<i class="fa fa-remove" aria-hidden="true"></i>
</button>
</div>
+ <div class="no-groups-to-show">
+ <div class="your_groups_tab_empty_text">
+ <span>
+ {{t 'You are not a member of any user groups.'}}
+ <a href="#groups/all">{{t 'View all user groups'}}</a>
+ </span>
+ </div>
+ <div class="all_groups_tab_empty_text">
+ <span>
+ {{t 'There are no user groups you can view in this organization.'}}
+ {{#if can_create_or_edit_user_groups}}
+ <a href="#groups/new">{{t 'Create a user group'}}</a>
+ {{/if}}
+ </span>
+ </div>
+ </div>
<div class="user-groups-list" data-simplebar>
</div>
</div>