refactor: Move pm_with_uri to hash_util.

This commit is contained in:
Steve Howell
2018-08-04 14:46:17 +00:00
committed by Tim Abbott
parent 9accc2a3b6
commit fc62e554ce
7 changed files with 10 additions and 13 deletions

View File

@@ -61,7 +61,7 @@ run_test('uris', () => {
people.add(ray);
people.add(alice);
var uri = narrow.pm_with_uri(ray.email);
var uri = hash_util.pm_with_uri(ray.email);
assert.equal(uri, '#narrow/pm-with/22-ray');
uri = narrow.huddle_with_uri("22,23");

View File

@@ -15,8 +15,6 @@ set_global('popovers', {
});
zrequire('hash_util');
zrequire('hashchange');
zrequire('narrow');
zrequire('Handlebars', 'handlebars');
zrequire('templates');
zrequire('people');

View File

@@ -101,7 +101,7 @@ exports.info_for = function (user_id) {
var person = people.get_person_from_user_id(user_id);
return {
href: narrow.pm_with_uri(person.email),
href: hash_util.pm_with_uri(person.email),
name: person.full_name,
user_id: user_id,
num_unread: get_num_unread(user_id),

View File

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

View File

@@ -767,12 +767,6 @@ exports.hide_empty_narrow_message = function () {
$(".empty_feed_notice").hide();
};
exports.pm_with_uri = function (reply_to) {
return hash_util.operators_to_hash([
{operator: 'pm-with', operand: reply_to},
]);
};
exports.huddle_with_uri = function (user_ids_string) {
// This method is convenient is convenient for callers
// that have already converted emails to a comma-delimited

View File

@@ -111,7 +111,7 @@ exports._build_private_messages_list = function (active_conversation, max_privat
unread: num_unread,
is_zero: num_unread === 0,
zoom_out_hide: !always_visible,
url: narrow.pm_with_uri(reply_to),
url: hash_util.pm_with_uri(reply_to),
};
display_messages.push(display_message);
});

View File

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