refactor: Move huddle_with_uri to hash_util.

This commit is contained in:
Steve Howell
2018-08-04 14:52:37 +00:00
committed by Tim Abbott
parent fc62e554ce
commit a866f3ec17
4 changed files with 10 additions and 10 deletions

View File

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

View File

@@ -276,7 +276,7 @@ exports.update_huddles = function () {
return { return {
user_ids_string: huddle, user_ids_string: huddle,
name: exports.full_huddle_name(huddle), name: exports.full_huddle_name(huddle),
href: narrow.huddle_with_uri(huddle), href: hash_util.huddle_with_uri(huddle),
fraction_present: exports.huddle_fraction_present(huddle), fraction_present: exports.huddle_fraction_present(huddle),
short_name: exports.short_huddle_name(huddle), short_name: exports.short_huddle_name(huddle),
}; };

View File

@@ -92,6 +92,14 @@ exports.pm_with_uri = function (reply_to) {
]); ]);
}; };
exports.huddle_with_uri = function (user_ids_string) {
// This method is convenient for callers
// that have already converted emails to a comma-delimited
// list of user_ids. We should be careful to keep this
// consistent with hash_util.decode_operand.
return "#narrow/pm-with/" + user_ids_string + '-group';
};
return exports; return exports;
}()); }());

View File

@@ -767,14 +767,6 @@ exports.hide_empty_narrow_message = function () {
$(".empty_feed_notice").hide(); $(".empty_feed_notice").hide();
}; };
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
// list of user_ids. We should be careful to keep this
// consistent with hash_util.decode_operand.
return "#narrow/pm-with/" + user_ids_string + '-group';
};
exports.by_sender_uri = function (reply_to) { exports.by_sender_uri = function (reply_to) {
return hash_util.operators_to_hash([ return hash_util.operators_to_hash([
{operator: 'sender', operand: reply_to}, {operator: 'sender', operand: reply_to},