From ffca07ffdd6eb514b30edcce8b082b68ef6753a2 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sat, 4 Aug 2018 15:19:03 +0000 Subject: [PATCH] refactor: Move by_sender_uri to hash_util. --- frontend_tests/node_tests/narrow.js | 2 +- static/js/hash_util.js | 6 ++++++ static/js/narrow.js | 6 ------ static/js/popovers.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js index 7611187be3..f3345f0e57 100644 --- a/frontend_tests/node_tests/narrow.js +++ b/frontend_tests/node_tests/narrow.js @@ -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'); diff --git a/static/js/hash_util.js b/static/js/hash_util.js index d3941ac790..0156c76649 100644 --- a/static/js/hash_util.js +++ b/static/js/hash_util.js @@ -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}, diff --git a/static/js/narrow.js b/static/js/narrow.js index d23476215d..61097a63c9 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -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) { diff --git a/static/js/popovers.js b/static/js/popovers.js index bcbaf83d92..607522cf44 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -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,