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.

left sidebar: Don't show unstar-all button when redundant.

Abhijeet Prasad Bodasb37e5cc01748
diff --git a/static/js/starred_messages.js b/static/js/starred_messages.js
index a18a33b5d20..2806bd174d0 100644
--- a/static/js/starred_messages.js
+++ b/static/js/starred_messages.js
@@ -1,3 +1,4 @@
+import * as stream_popover from "./stream_popover";
import * as top_left_corner from "./top_left_corner";
export const starred_ids = new Set();
@@ -45,4 +46,5 @@ export function rerender_ui() {
}
top_left_corner.update_starred_count(count);
+ stream_popover.hide_starred_messages_popover();
}
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index db858d37337..ab6314afbf5 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -19,6 +19,7 @@ import * as muting_ui from "./muting_ui";
import * as narrow from "./narrow";
import * as popovers from "./popovers";
import * as resize from "./resize";
+import * as starred_messages from "./starred_messages";
import * as stream_color from "./stream_color";
import * as stream_data from "./stream_data";
import * as subs from "./subs";
@@ -296,7 +297,9 @@ function build_starred_messages_popover(e) {
popovers.hide_all();
exports.show_streamlist_sidebar();
+ const show_unstar_all_button = starred_messages.get_count() > 0;
const content = render_starred_messages_sidebar_actions({
+ show_unstar_all_button,
starred_message_counts: page_params.starred_message_counts,
});
diff --git a/static/templates/starred_messages_sidebar_actions.hbs b/static/templates/starred_messages_sidebar_actions.hbs
index 3b95162a294..14ce5d6e5fc 100644
--- a/static/templates/starred_messages_sidebar_actions.hbs
+++ b/static/templates/starred_messages_sidebar_actions.hbs
@@ -1,12 +1,14 @@
{{! Contents of the "starred messages sidebar" popup }}
<ul class="nav nav-list">
{{! tabindex="0" Makes anchor tag focusable. Needed for keyboard support. }}
+ {{#if show_unstar_all_button}}
<li>
<a tabindex="0" id="unstar_all_messages">
<i class="fa fa-star-o" aria-hidden="true"></i>
{{#tr this}}Unstar all messages{{/tr}}
</a>
</li>
+ {{/if}}
<li>
<a tabindex="0" id="toggle_display_starred_msg_count">
{{#if starred_message_counts}}