Show correct avatar for desktop notifications.

This updates desktop notifications to use avatar_url from the
server (in case users have uploaded their own avatar).  It
also removes the unneeded stamp parameter from the URL, and
it unifies URL handling with message_list.

(imported from commit 6bb43a25c01cc3d26f30fc167780a477d1c5d023)
This commit is contained in:
Steve Howell
2013-06-13 17:48:23 -04:00
parent 67ac671b74
commit 943a29dc34
4 changed files with 20 additions and 12 deletions

View File

@@ -607,8 +607,21 @@ function poll_for_gravatar_update(start_time, url) {
}
exports.get_gravatar_stamp = function () {
return gravatar_stamp;
exports.small_avatar_url = function (message) {
// Try to call this function in all places where we need size-30
// quality gravatar images, so that the browser can help
// us avoid unnecessary network trips. (For user-uploaded avatars,
// the s=30 parameter is essentially ignored, but it's harmless.)
//
if (message.avatar_url) {
var url = message.avatar_url + "&s=30";
if (message.sender_email === page_params.email) {
url += "&stamp=" + gravatar_stamp;
}
return url;
} else {
return "";
}
};
exports.wait_for_gravatar = function () {