Skip to content
Snippets Groups Projects
Commit 6c7e4ba4 authored by Aaron's avatar Aaron
Browse files

Merge branch 'user-avatar-in-desktop' of...

Merge branch 'user-avatar-in-desktop' of https://github.com/soonahn/Rocket.Chat into soonahn-user-avatar-in-desktop
parents 0720c37b 031dccd6
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,16 @@
Blaze.registerHelper 'avatarUrlFromUsername', getAvatarUrlFromUsername
@getAvatarAsPng = (username) ->
image = new Image
image.src = getAvatarUrlFromUsername(username)
canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = image.height;
context = canvas.getContext('2d');
context.drawImage(image, 0, 0);
return canvas.toDataURL('image/png');
@updateAvatarOfUsername = (username) ->
key = "avatar_random_#{username}"
Session.set key, Math.round(Math.random() * 1000)
......
......@@ -12,7 +12,7 @@
if not window.document.hasFocus?() and Meteor.user().status isnt 'busy'
if window.Notification && Notification.permission == "granted"
n = new Notification notification.title,
icon: '/images/logo/1024x1024-circle.png'
icon: getAvatarAsPng(notification.payload.sender.username)
body: _.stripTags(notification.text)
if notification.payload?.rid?
......
......@@ -69,10 +69,10 @@ Meteor.startup ->
</text>
</svg>
"""
res.write svg
res.end()
return
return
res.setHeader 'content-type', 'image/jpeg'
res.setHeader 'Content-Length', file.length
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment