Skip to content
Browse files

Adding userName, displayName, portrait and profileUrl to social.ambie…

…nt-notification-update
  • Loading branch information...
1 parent ef58b5c commit e17d5f5f1309443054bb331aadc04940e83becf4 @simonwex simonwex committed Jun 26, 2012
Showing with 24 additions and 0 deletions.
  1. +23 −0 app/http/views/social/worker.js.ejs
  2. +1 −0 app/models/user.js
View
23 app/http/views/social/worker.js.ejs
@@ -27,6 +27,10 @@ var notificationCount = {
bugzilla: 0
}
+var user = <%- JSON.stringify(user) %>;
+user.portrait = "http://www.gravatar.com/avatar/" + user.gravatarHash + "s=32";
+
+
function log(message, angry){
if (typeof(message.join) == 'function'){
message = message.join("\n");
@@ -93,10 +97,29 @@ function initWebSocket(){
}
function setAmbientNotificationCount(){
+
+ dump(JSON.stringify({
+ topic: 'social.ambient-notification-update',
+ data: {
+ name: 'bugzilla',
+ userName: user.email,
+ displayName: user.realName,
+ portrait: user.portrait,
+ profileURL: baseUrl + '/profile',
+ background: "url(" + SPRITES + ") transparent no-repeat 0px 7px",
+ counter: notificationCount.bugzilla,
+ contentPanel: baseUrl + '/social/bugs'
+ }
+ }));
+
apiPort.postMessage({
topic: 'social.ambient-notification-update',
data: {
name: 'bugzilla',
+ userName: user.email,
+ displayName: user.realName,
+ portrait: user.portrait,
+ profileURL: baseUrl + '/profile',
background: "url(" + SPRITES + ") transparent no-repeat 0px 7px",
counter: notificationCount.bugzilla,
contentPanel: baseUrl + '/social/bugs'
View
1 app/models/user.js
@@ -21,6 +21,7 @@ function User(attrs){
this.email = (attrs['email'] || '').trim();
this.realName = (attrs['realName'] || '').trim();
this.nick = (attrs['nick'] || '').trim();
+ this.gravatarHash = crypto.createHash('md5').update(this.email).digest("hex");
}
module.exports = User;

0 comments on commit e17d5f5

Please sign in to comment.
Something went wrong with that request. Please try again.