mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
refactor: Move by_conversation_and_time_uri to hash_util.
This removes the 100% coverage on hash_util, but we are pretty careful about not messing with this code.
This commit is contained in:
@@ -106,6 +106,29 @@ exports.huddle_with_uri = function (user_ids_string) {
|
|||||||
return "#narrow/pm-with/" + user_ids_string + '-group';
|
return "#narrow/pm-with/" + user_ids_string + '-group';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.by_conversation_and_time_uri = function (message, is_absolute_url) {
|
||||||
|
var absolute_url = "";
|
||||||
|
if (is_absolute_url) {
|
||||||
|
absolute_url = window.location.protocol + "//" +
|
||||||
|
window.location.host + "/" + window.location.pathname.split('/')[1];
|
||||||
|
}
|
||||||
|
if (message.type === "stream") {
|
||||||
|
return absolute_url + "#narrow/stream/" +
|
||||||
|
exports.encode_stream_name(message.stream) +
|
||||||
|
"/subject/" + exports.encodeHashComponent(message.subject) +
|
||||||
|
"/near/" + exports.encodeHashComponent(message.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include your own email in this URI if it's not there already
|
||||||
|
var all_emails = message.reply_to;
|
||||||
|
if (all_emails.indexOf(people.my_current_email()) === -1) {
|
||||||
|
all_emails += "," + people.my_current_email();
|
||||||
|
}
|
||||||
|
return absolute_url + "#narrow/pm-with/" +
|
||||||
|
exports.encodeHashComponent(all_emails) +
|
||||||
|
"/near/" + exports.encodeHashComponent(message.id);
|
||||||
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -767,29 +767,6 @@ exports.hide_empty_narrow_message = function () {
|
|||||||
$(".empty_feed_notice").hide();
|
$(".empty_feed_notice").hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.by_conversation_and_time_uri = function (message, is_absolute_url) {
|
|
||||||
var absolute_url = "";
|
|
||||||
if (is_absolute_url) {
|
|
||||||
absolute_url = window.location.protocol + "//" +
|
|
||||||
window.location.host + "/" + window.location.pathname.split('/')[1];
|
|
||||||
}
|
|
||||||
if (message.type === "stream") {
|
|
||||||
return absolute_url + "#narrow/stream/" +
|
|
||||||
hash_util.encode_stream_name(message.stream) +
|
|
||||||
"/subject/" + hash_util.encodeHashComponent(message.subject) +
|
|
||||||
"/near/" + hash_util.encodeHashComponent(message.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include your own email in this URI if it's not there already
|
|
||||||
var all_emails = message.reply_to;
|
|
||||||
if (all_emails.indexOf(people.my_current_email()) === -1) {
|
|
||||||
all_emails += "," + people.my_current_email();
|
|
||||||
}
|
|
||||||
return absolute_url + "#narrow/pm-with/" +
|
|
||||||
hash_util.encodeHashComponent(all_emails) +
|
|
||||||
"/near/" + hash_util.encodeHashComponent(message.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ exports.toggle_actions_popover = function (element, id) {
|
|||||||
should_display_uncollapse: should_display_uncollapse,
|
should_display_uncollapse: should_display_uncollapse,
|
||||||
should_display_add_reaction_option: message.sent_by_me,
|
should_display_add_reaction_option: message.sent_by_me,
|
||||||
should_display_edit_history_option: should_display_edit_history_option,
|
should_display_edit_history_option: should_display_edit_history_option,
|
||||||
conversation_time_uri: narrow.by_conversation_and_time_uri(message, true),
|
conversation_time_uri: hash_util.by_conversation_and_time_uri(message, true),
|
||||||
narrowed: narrow_state.active(),
|
narrowed: narrow_state.active(),
|
||||||
should_display_delete_option: should_display_delete_option,
|
should_display_delete_option: should_display_delete_option,
|
||||||
should_display_reminder_option: feature_flags.reminders_in_message_action_menu,
|
should_display_reminder_option: feature_flags.reminders_in_message_action_menu,
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ exports.do_set_reminder_for_message = function (msgid, timestamp) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var link_to_msg = narrow.by_conversation_and_time_uri(message, true);
|
var link_to_msg = hash_util.by_conversation_and_time_uri(message, true);
|
||||||
var command = deferred_message_types.reminders.slash_command;
|
var command = deferred_message_types.reminders.slash_command;
|
||||||
var reminder_timestamp = timestamp;
|
var reminder_timestamp = timestamp;
|
||||||
var custom_msg = message.raw_content + '\n\n[Link to conversation](' + link_to_msg + ')';
|
var custom_msg = message.raw_content + '\n\n[Link to conversation](' + link_to_msg + ')';
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ enforce_fully_covered = {
|
|||||||
'static/js/fenced_code.js',
|
'static/js/fenced_code.js',
|
||||||
'static/js/fetch_status.js',
|
'static/js/fetch_status.js',
|
||||||
'static/js/filter.js',
|
'static/js/filter.js',
|
||||||
'static/js/hash_util.js',
|
|
||||||
'static/js/keydown_util.js',
|
'static/js/keydown_util.js',
|
||||||
'static/js/markdown.js',
|
'static/js/markdown.js',
|
||||||
'static/js/message_store.js',
|
'static/js/message_store.js',
|
||||||
|
|||||||
Reference in New Issue
Block a user