mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Move small_avatar_url() to people.js.
This commit is contained in:
		@@ -12,7 +12,7 @@ set_global('page_params', {
 | 
			
		||||
});
 | 
			
		||||
set_global('home_msg_list', null);
 | 
			
		||||
set_global('feature_flags', {twenty_four_hour_time: false});
 | 
			
		||||
set_global('ui', {small_avatar_url: function () { return ''; }});
 | 
			
		||||
set_global('people', {small_avatar_url: function () { return ''; }});
 | 
			
		||||
set_global('notifications', {speaking_at_me: function () {}});
 | 
			
		||||
set_global('unread', {message_unread: function () {}});
 | 
			
		||||
// timerender calls setInterval when imported
 | 
			
		||||
 
 | 
			
		||||
@@ -223,7 +223,7 @@ MessageListView.prototype = {
 | 
			
		||||
 | 
			
		||||
            self._add_msg_timestring(message_container);
 | 
			
		||||
 | 
			
		||||
            message_container.small_avatar_url = ui.small_avatar_url(message_container.msg);
 | 
			
		||||
            message_container.small_avatar_url = people.small_avatar_url(message_container.msg);
 | 
			
		||||
            if (message_container.msg.stream !== undefined) {
 | 
			
		||||
                message_container.background_color =
 | 
			
		||||
                    stream_data.get_color(message_container.msg.stream);
 | 
			
		||||
 
 | 
			
		||||
@@ -221,7 +221,7 @@ exports.window_has_focus = function () {
 | 
			
		||||
 | 
			
		||||
function in_browser_notify(message, title, content, raw_operators, opts) {
 | 
			
		||||
    var notification_html = $(templates.render('notification', {
 | 
			
		||||
        gravatar_url: ui.small_avatar_url(message),
 | 
			
		||||
        gravatar_url: people.small_avatar_url(message),
 | 
			
		||||
        title: title,
 | 
			
		||||
        content: content,
 | 
			
		||||
        message_id: message.id,
 | 
			
		||||
@@ -340,7 +340,7 @@ function process_notification(notification) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (window.bridge === undefined && notification.webkit_notify === true) {
 | 
			
		||||
        var icon_url = ui.small_avatar_url(message);
 | 
			
		||||
        var icon_url = people.small_avatar_url(message);
 | 
			
		||||
        notice_memory[key] = {
 | 
			
		||||
            obj: notifications_api.createNotification(
 | 
			
		||||
                    icon_url, title, content, message.id),
 | 
			
		||||
@@ -364,7 +364,7 @@ function process_notification(notification) {
 | 
			
		||||
            if (perm === 'granted') {
 | 
			
		||||
                notification_object = new Notification(title, {
 | 
			
		||||
                    body: content,
 | 
			
		||||
                    iconUrl: ui.small_avatar_url(message),
 | 
			
		||||
                    iconUrl: people.small_avatar_url(message),
 | 
			
		||||
                    tag: message.id,
 | 
			
		||||
                });
 | 
			
		||||
            } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -120,6 +120,24 @@ exports.slug_to_emails = function (slug) {
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.small_avatar_url = function (message) {
 | 
			
		||||
    // Try to call this function in all places where we need 25px
 | 
			
		||||
    // avatar images, so that the browser can help
 | 
			
		||||
    // us avoid unnecessary network trips.  (For user-uploaded avatars,
 | 
			
		||||
    // the s=25 parameter is essentially ignored, but it's harmless.)
 | 
			
		||||
    //
 | 
			
		||||
    // We actually request these at s=50, so that we look better
 | 
			
		||||
    // on retina displays.
 | 
			
		||||
    if (message.avatar_url) {
 | 
			
		||||
        var url = message.avatar_url + "&s=50";
 | 
			
		||||
        if (message.sent_by_me) {
 | 
			
		||||
            url += "&stamp=" + settings.avatar_stamp;
 | 
			
		||||
        }
 | 
			
		||||
        return url;
 | 
			
		||||
    }
 | 
			
		||||
    return "";
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.realm_get = function realm_get(email) {
 | 
			
		||||
    return realm_people_dict.get(email);
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -259,24 +259,6 @@ exports.show_failed_message_success = function (message_id) {
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.small_avatar_url = function (message) {
 | 
			
		||||
    // Try to call this function in all places where we need 25px
 | 
			
		||||
    // avatar images, so that the browser can help
 | 
			
		||||
    // us avoid unnecessary network trips.  (For user-uploaded avatars,
 | 
			
		||||
    // the s=25 parameter is essentially ignored, but it's harmless.)
 | 
			
		||||
    //
 | 
			
		||||
    // We actually request these at s=50, so that we look better
 | 
			
		||||
    // on retina displays.
 | 
			
		||||
    if (message.avatar_url) {
 | 
			
		||||
        var url = message.avatar_url + "&s=50";
 | 
			
		||||
        if (message.sent_by_me) {
 | 
			
		||||
            url += "&stamp=" + settings.avatar_stamp;
 | 
			
		||||
        }
 | 
			
		||||
        return url;
 | 
			
		||||
    }
 | 
			
		||||
    return "";
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.lightbox = function (data) {
 | 
			
		||||
    switch (data.type) {
 | 
			
		||||
        case "photo":
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user