left sidebar: Add option to toggle 'Display starred count'.

This adds option in popover of starred messages, to toggle displaying
counts of starred messages.

This is a follow-up to #11645.
This commit is contained in:
ruchit2801 2019-03-18 16:46:07 +00:00 committed by Tim Abbott
parent f25012f025
commit d2e1f5edc2
2 changed files with 26 additions and 1 deletions

View File

@ -228,7 +228,8 @@ function build_starred_messages_popover(e) {
popovers.hide_all();
var content = templates.render(
'starred_messages_sidebar_actions'
'starred_messages_sidebar_actions',
{starred_message_counts: page_params.starred_message_counts}
);
$(elt).popover({
@ -327,6 +328,19 @@ exports.register_stream_handlers = function () {
e.stopPropagation();
});
// Toggle displaying starred message count
$('body').on('click', '#toggle_display_starred_msg_count', function (e) {
exports.hide_starred_messages_popover();
e.preventDefault();
e.stopPropagation();
var starred_msg_counts = page_params.starred_message_counts;
var data = {};
data.starred_message_counts = JSON.stringify(!starred_msg_counts);
channel.patch({
url: '/json/settings/display',
data: data,
});
});
// Mute/unmute
$('body').on('click', '.toggle_home', function (e) {
var sub = stream_popover_sub(e);

View File

@ -6,4 +6,15 @@
{{#tr this}}Unstar all messages{{/tr}}
</a>
</li>
<li>
<a id="toggle_display_starred_msg_count">
{{#if starred_message_counts}}
<i class="fa fa-eye-slash" aria-hidden="true"></i>
{{#tr this}}Hide starred message count{{/tr}}
{{else}}
<i class="fa fa-eye" aria-hidden="true"></i>
{{#tr this}}Show starred message count{{/tr}}
{{/if}}
</a>
</li>
</ul>