mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 05:58:25 +00:00
Add "Mentioning messages" to the upper left sidebar.
Treat "mentioned" messages like "starred" messages for narrowing. Lots of ugly copy/paste here. There might be opportunity for some cleanup in places. (imported from commit e7629890d42643c0000e1cc85422b2a0690f2cc4)
This commit is contained in:
@@ -80,6 +80,9 @@
|
||||
<div id="empty_star_narrow_message" class="empty_feed_notice">
|
||||
<h4>You haven't starred anything yet!</h4>
|
||||
</div>
|
||||
<div id="empty_narrow_all_mentioned" class="empty_feed_notice">
|
||||
<h4>You haven't been mentioned yet.</h4>
|
||||
</div>
|
||||
<div id="empty_search_narrow_message" class="empty_feed_notice">
|
||||
<h4>Nobody has talked about that yet!</h4>
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<li data-name="all" class="hidden-filter"><i class="icon-vector-list"></i> <a href="#narrow/in/all">All messages <span class="count">(<span class="value"></span>)</span></a></li>
|
||||
<li data-name="private-message"><i class="icon-vector-user"></i> <a href="#narrow/is/private-message">Private messages <span class="count">(<span class="value"></span>)</span></a></li>
|
||||
<li data-name="starred"><i class="icon-vector-star"></i> <a href="#narrow/is/starred">Starred messages</a></li>
|
||||
<li data-name="mentioned"><i class="icon-vector-tag"></i> <a href="#narrow/is/mentioned">Mentioning messages</a></li>
|
||||
</ul>
|
||||
<ul id="stream_filters" class="filters scrolling_list"></ul>
|
||||
</div>
|
||||
|
||||
@@ -95,6 +95,10 @@ Filter.prototype = {
|
||||
if (!message.starred) {
|
||||
return false;
|
||||
}
|
||||
} else if (operand === 'mentioned') {
|
||||
if (!message.mentioned) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -224,6 +228,8 @@ exports.describe = function (operators) {
|
||||
return 'Narrow to all private messages';
|
||||
} else if (operand === 'starred') {
|
||||
return 'Narrow to starred messages';
|
||||
} else if (operand === 'mentioned') {
|
||||
return 'Narrow to mentioned messages';
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -564,6 +570,8 @@ function pick_empty_narrow_banner() {
|
||||
if (first_operand === "starred") {
|
||||
// You have no starred messages.
|
||||
return $("#empty_star_narrow_message");
|
||||
} else if (first_operand === "mentioned") {
|
||||
return $("#empty_narrow_all_mentioned");
|
||||
} else if (first_operand === "private-message") {
|
||||
// You have no private messages.
|
||||
return $("#empty_narrow_all_private_message");
|
||||
|
||||
@@ -260,7 +260,7 @@ $(function () {
|
||||
}
|
||||
var op_is = event.filter.operands('is');
|
||||
if (op_is.length !== 0) {
|
||||
if (['private-message', 'starred'].indexOf(op_is[0]) !== -1) {
|
||||
if (['private-message', 'starred', 'mentioned'].indexOf(op_is[0]) !== -1) {
|
||||
$("#global_filters li[data-name='" + op_is[0] + "']").addClass('active-filter');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ function make_tab_data() {
|
||||
|
||||
} else if (operator === 'is' && operand === 'starred') {
|
||||
tabs.push(make_tab("Starred", hashed));
|
||||
} else if (operator === 'is' && operand === 'mentioned') {
|
||||
tabs.push(make_tab("Mentions", hashed));
|
||||
} else if (operator === 'sender') {
|
||||
var sender = people_dict[operand].full_name;
|
||||
tabs.push(make_tab("Sent by " + sender, hashed));
|
||||
|
||||
@@ -515,6 +515,7 @@ function add_message_metadata(message, dummy) {
|
||||
message.historical = (message.flags !== undefined &&
|
||||
message.flags.indexOf('historical') !== -1);
|
||||
message.starred = message.flags.indexOf("starred") !== -1;
|
||||
message.mentioned = message.flags.indexOf("mentioned") !== -1;
|
||||
message.collapsed = message.flags.indexOf("collapsed") !== -1;
|
||||
|
||||
switch (message.type) {
|
||||
|
||||
@@ -471,3 +471,4 @@ ul.icons li [class*=" icon-vector-"] {
|
||||
.icon-vector-pencil:before { content: "\f040"; }
|
||||
.icon-vector-eraser:before { content: "\f12d"; }
|
||||
.icon-vector-envelope:before { content: "\f003"; }
|
||||
.icon-vector-tag:before { content: "\f02b"; }
|
||||
|
||||
@@ -667,6 +667,8 @@ class NarrowBuilder(object):
|
||||
self.pQ(recipient__type=Recipient.HUDDLE))
|
||||
elif operand == 'starred':
|
||||
return Q(flags=UserMessage.flags.starred)
|
||||
elif operand == 'mentioned':
|
||||
return Q(flags=UserMessage.flags.mentioned)
|
||||
raise BadNarrowOperator("unknown 'is' operand " + operand)
|
||||
|
||||
def by_stream(self, operand):
|
||||
|
||||
Reference in New Issue
Block a user