refactor: Move by_sender_uri to hash_util.

This commit is contained in:
Steve Howell 2018-08-04 15:19:03 +00:00 committed by Tim Abbott
parent a866f3ec17
commit ffca07ffdd
4 changed files with 9 additions and 9 deletions

View File

@ -67,7 +67,7 @@ run_test('uris', () => {
uri = hash_util.huddle_with_uri("22,23");
assert.equal(uri, '#narrow/pm-with/22,23-group');
uri = narrow.by_sender_uri(ray.email);
uri = hash_util.by_sender_uri(ray.email);
assert.equal(uri, '#narrow/sender/22-ray');
var emails = global.hash_util.decode_operand('pm-with', '22,23-group');

View File

@ -86,6 +86,12 @@ exports.operators_to_hash = function (operators) {
return hash;
};
exports.by_sender_uri = function (reply_to) {
return exports.operators_to_hash([
{operator: 'sender', operand: reply_to},
]);
};
exports.pm_with_uri = function (reply_to) {
return exports.operators_to_hash([
{operator: 'pm-with', operand: reply_to},

View File

@ -767,12 +767,6 @@ exports.hide_empty_narrow_message = function () {
$(".empty_feed_notice").hide();
};
exports.by_sender_uri = function (reply_to) {
return hash_util.operators_to_hash([
{operator: 'sender', operand: reply_to},
]);
};
exports.by_conversation_and_time_uri = function (message, is_absolute_url) {
var absolute_url = "";
if (is_absolute_url) {

View File

@ -145,7 +145,7 @@ function show_user_info_popover(element, user, message) {
presence_status: presence.get_status(user.user_id),
user_last_seen_time_status: user_last_seen_time_status(user.user_id),
pm_with_uri: hash_util.pm_with_uri(user.email),
sent_by_uri: narrow.by_sender_uri(user.email),
sent_by_uri: hash_util.by_sender_uri(user.email),
narrowed: narrow_state.active(),
private_message_class: "respond_personal_button",
is_me: people.is_current_user(user.email),
@ -702,7 +702,7 @@ exports.register_click_handlers = function () {
presence_status: presence.get_status(user_id),
user_last_seen_time_status: user_last_seen_time_status(user_id),
pm_with_uri: hash_util.pm_with_uri(user_email),
sent_by_uri: narrow.by_sender_uri(user_email),
sent_by_uri: hash_util.by_sender_uri(user_email),
private_message_class: "compose_private_message",
is_active: people.is_active_user_for_popover(user_id),
is_bot: user.is_bot,