mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Add 'narrow to this conversation and time' narrowing.
(imported from commit 3bc5ea09d333c2caa37557419d54d48bbbb5a639)
This commit is contained in:
@@ -330,6 +330,20 @@ exports.by_id = function (target_id, opts) {
|
||||
narrow.activate([["id", target_id]], opts);
|
||||
};
|
||||
|
||||
exports.by_conversation_and_time = function (target_id, opts) {
|
||||
var args = [["near", target_id]];
|
||||
var original = msg_metadata_cache[target_id];
|
||||
opts = _.defaults({}, opts, {then_select_id: target_id});
|
||||
|
||||
if (original.type !== 'stream') {
|
||||
args.push(["pm-with", original.reply_to]);
|
||||
} else {
|
||||
args.push(['stream', original.stream]);
|
||||
args.push(['topic', original.subject]);
|
||||
}
|
||||
narrow.activate(args, opts);
|
||||
};
|
||||
|
||||
exports.deactivate = function () {
|
||||
if (current_filter === undefined) {
|
||||
return;
|
||||
@@ -476,6 +490,17 @@ exports.by_near_uri = function (message_id) {
|
||||
return "#narrow/near/" + hashchange.encodeHashComponent(message_id);
|
||||
};
|
||||
|
||||
exports.by_conversation_and_time_uri = function (message) {
|
||||
if (message.type === "stream") {
|
||||
return "#narrow/stream/" + hashchange.encodeHashComponent(message.stream) +
|
||||
"/subject/" + hashchange.encodeHashComponent(message.subject) +
|
||||
"/near/" + hashchange.encodeHashComponent(message.id);
|
||||
} else {
|
||||
return "#narrow/pm-with/" + hashchange.encodeHashComponent(message.reply_to) +
|
||||
"/near/" + hashchange.encodeHashComponent(message.id);
|
||||
}
|
||||
};
|
||||
|
||||
// Are we narrowed to PMs: all PMs or PMs with particular people.
|
||||
exports.narrowed_to_pms = function () {
|
||||
if (current_filter === undefined) {
|
||||
|
||||
@@ -79,6 +79,7 @@ exports.toggle_actions_popover = function (element, id) {
|
||||
stream_subject_uri: narrow.by_stream_subject_uri(message.stream, message.subject),
|
||||
near_time_uri: narrow.by_near_uri(message.id),
|
||||
single_message_uri: narrow.by_message_uri(message.id),
|
||||
conversation_time_uri: narrow.by_conversation_and_time_uri(message),
|
||||
narrowed: narrow.active()
|
||||
};
|
||||
|
||||
@@ -481,6 +482,13 @@ exports.register_click_handlers = function () {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('body').on('click', '.popover_narrow_by_conversation_and_time', function (e) {
|
||||
var msgid = $(e.currentTarget).data('msgid');
|
||||
popovers.hide_actions_popover();
|
||||
narrow.by_conversation_and_time(msgid, {trigger: 'popover'});
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('body').on('click', '.popover_toggle_collapse', function (e) {
|
||||
var msgid = $(e.currentTarget).data('msgid');
|
||||
var row = current_msg_list.get_row(msgid);
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
{{/if}}
|
||||
|
||||
{{#if single_message_narrowing}}
|
||||
<li>
|
||||
<a href="{{ conversation_time_uri }}" class="popover_narrow_by_conversation_and_time" data-msgid="{{message.id}}">
|
||||
<i class="icon-vector-link"></i> Narrow to this conversation and time
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ single_message_uri }}" class="popover_narrow_by_id" data-msgid="{{message.id}}">
|
||||
<i class="icon-vector-link"></i> Narrow to just this message
|
||||
|
||||
Reference in New Issue
Block a user