Fix narrowing links in message popovers.

This should make it possible to either open these using middle-click
or copy the links for e.g. putting in a bug tracker ticket.

(imported from commit 0c531453cdd7197f932079c245700948b416a3d5)
This commit is contained in:
Tim Abbott 2013-11-25 10:25:34 -05:00
parent 7cb261a0ed
commit be2d546ffe
4 changed files with 25 additions and 7 deletions

View File

@ -455,6 +455,10 @@ exports.pm_with_uri = function (reply_to) {
return "#narrow/pm-with/" + hashchange.encodeHashComponent(reply_to);
};
exports.by_sender_uri = function (reply_to) {
return "#narrow/sender/" + hashchange.encodeHashComponent(reply_to);
};
exports.by_stream_uri = function (stream) {
return "#narrow/stream/" + hashchange.encodeHashComponent(stream);
};
@ -464,6 +468,14 @@ exports.by_stream_subject_uri = function (stream, subject) {
"/subject/" + hashchange.encodeHashComponent(subject);
};
exports.by_message_uri = function (message_id) {
return "#narrow/id/" + hashchange.encodeHashComponent(message_id);
};
exports.by_near_uri = function (message_id) {
return "#narrow/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) {

View File

@ -27,6 +27,8 @@ function show_message_info_popover(element, id) {
var args = {
message: message,
can_edit_message: can_edit,
pm_with_uri: narrow.pm_with_uri(message.sender_email),
sent_by_uri: narrow.by_sender_uri(message.sender_email),
narrowed: narrow.active()
};
@ -73,6 +75,10 @@ exports.toggle_actions_popover = function (element, id) {
can_mute_topic: can_mute_topic,
can_unmute_topic: can_unmute_topic,
single_message_narrowing: feature_flags.single_message_narrowing,
pm_with_uri: narrow.pm_with_uri(message.sender_email),
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),
narrowed: narrow.active()
};

View File

@ -20,7 +20,7 @@
</li>
{{#unless message.is_private}}
<li>
<a href="#" class="respond_personal_button">
<a href="" class="respond_personal_button">
<i class="icon-vector-user"></i> Reply to <b>{{message.sender_full_name}}</b> only
</a>
</li>
@ -28,14 +28,14 @@
{{#if message.is_stream}}
<li>
<a href="#" class="popover_narrow_by_subject_button" data-msgid="{{message.id}}">
<a href="{{ stream_subject_uri }}" class="popover_narrow_by_subject_button" data-msgid="{{message.id}}">
<i class="icon-vector-bullhorn"></i>
Narrow to this topic on stream <b>{{message.stream}}</b>
</a>
</li>
{{else}}
<li>
<a href="#" class="popover_narrow_by_recipient_button" data-msgid="{{message.id}}">
<a href="{{ pm_with_uri }}" class="popover_narrow_by_recipient_button" data-msgid="{{message.id}}">
<i class="icon-vector-user"></i>
Narrow to this private message conversation
</a>
@ -44,7 +44,7 @@
{{#if narrowed}}
<li>
<a href="#" class="popover_narrow_by_time_travel_button" data-msgid="{{message.id}}">
<a href="{{ near_time_uri }}" class="popover_narrow_by_time_travel_button" data-msgid="{{message.id}}">
<i class="icon-vector-time"></i> Narrow to messages around this time
</a>
</li>
@ -52,7 +52,7 @@
{{#if single_message_narrowing}}
<li>
<a href="#" class="popover_narrow_by_id" data-msgid="{{message.id}}">
<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
</a>
</li>

View File

@ -18,12 +18,12 @@
</a>
</li>
<li>
<a href="#" class="narrow_to_private_messages">
<a href="{{ pm_with_uri }}" class="narrow_to_private_messages">
<i class="icon-vector-user"></i> Narrow to private messages with {{message.sender_full_name}}
</a>
</li>
<li>
<a href="#" class="narrow_to_messages_sent">
<a href="{{ sent_by_uri }}" class="narrow_to_messages_sent">
<i class="icon-vector-bullhorn"></i> Narrow to messages sent by {{message.sender_full_name}}
</a>
</li>