mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	refactor: Move pm_with_uri to hash_util.
This commit is contained in:
		@@ -61,7 +61,7 @@ run_test('uris', () => {
 | 
				
			|||||||
    people.add(ray);
 | 
					    people.add(ray);
 | 
				
			||||||
    people.add(alice);
 | 
					    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');
 | 
					    assert.equal(uri, '#narrow/pm-with/22-ray');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uri = narrow.huddle_with_uri("22,23");
 | 
					    uri = narrow.huddle_with_uri("22,23");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,8 +15,6 @@ set_global('popovers', {
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
zrequire('hash_util');
 | 
					zrequire('hash_util');
 | 
				
			||||||
zrequire('hashchange');
 | 
					 | 
				
			||||||
zrequire('narrow');
 | 
					 | 
				
			||||||
zrequire('Handlebars', 'handlebars');
 | 
					zrequire('Handlebars', 'handlebars');
 | 
				
			||||||
zrequire('templates');
 | 
					zrequire('templates');
 | 
				
			||||||
zrequire('people');
 | 
					zrequire('people');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,7 +101,7 @@ exports.info_for = function (user_id) {
 | 
				
			|||||||
    var person = people.get_person_from_user_id(user_id);
 | 
					    var person = people.get_person_from_user_id(user_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        href: narrow.pm_with_uri(person.email),
 | 
					        href: hash_util.pm_with_uri(person.email),
 | 
				
			||||||
        name: person.full_name,
 | 
					        name: person.full_name,
 | 
				
			||||||
        user_id: user_id,
 | 
					        user_id: user_id,
 | 
				
			||||||
        num_unread: get_num_unread(user_id),
 | 
					        num_unread: get_num_unread(user_id),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,6 +86,11 @@ exports.operators_to_hash = function (operators) {
 | 
				
			|||||||
    return hash;
 | 
					    return hash;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exports.pm_with_uri = function (reply_to) {
 | 
				
			||||||
 | 
					    return exports.operators_to_hash([
 | 
				
			||||||
 | 
					        {operator: 'pm-with', operand: reply_to},
 | 
				
			||||||
 | 
					    ]);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
return exports;
 | 
					return exports;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -767,12 +767,6 @@ exports.hide_empty_narrow_message = function () {
 | 
				
			|||||||
    $(".empty_feed_notice").hide();
 | 
					    $(".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) {
 | 
					exports.huddle_with_uri = function (user_ids_string) {
 | 
				
			||||||
    // This method is convenient is convenient for callers
 | 
					    // This method is convenient is convenient for callers
 | 
				
			||||||
    // that have already converted emails to a comma-delimited
 | 
					    // that have already converted emails to a comma-delimited
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -111,7 +111,7 @@ exports._build_private_messages_list = function (active_conversation, max_privat
 | 
				
			|||||||
            unread: num_unread,
 | 
					            unread: num_unread,
 | 
				
			||||||
            is_zero: num_unread === 0,
 | 
					            is_zero: num_unread === 0,
 | 
				
			||||||
            zoom_out_hide: !always_visible,
 | 
					            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);
 | 
					        display_messages.push(display_message);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -144,7 +144,7 @@ function show_user_info_popover(element, user, message) {
 | 
				
			|||||||
            user_time: people.get_user_time(user.user_id),
 | 
					            user_time: people.get_user_time(user.user_id),
 | 
				
			||||||
            presence_status: presence.get_status(user.user_id),
 | 
					            presence_status: presence.get_status(user.user_id),
 | 
				
			||||||
            user_last_seen_time_status: user_last_seen_time_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),
 | 
					            sent_by_uri: narrow.by_sender_uri(user.email),
 | 
				
			||||||
            narrowed: narrow_state.active(),
 | 
					            narrowed: narrow_state.active(),
 | 
				
			||||||
            private_message_class: "respond_personal_button",
 | 
					            private_message_class: "respond_personal_button",
 | 
				
			||||||
@@ -701,7 +701,7 @@ exports.register_click_handlers = function () {
 | 
				
			|||||||
            user_time: people.get_user_time(user_id),
 | 
					            user_time: people.get_user_time(user_id),
 | 
				
			||||||
            presence_status: presence.get_status(user_id),
 | 
					            presence_status: presence.get_status(user_id),
 | 
				
			||||||
            user_last_seen_time_status: user_last_seen_time_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),
 | 
					            sent_by_uri: narrow.by_sender_uri(user_email),
 | 
				
			||||||
            private_message_class: "compose_private_message",
 | 
					            private_message_class: "compose_private_message",
 | 
				
			||||||
            is_active: people.is_active_user_for_popover(user_id),
 | 
					            is_active: people.is_active_user_for_popover(user_id),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user