Skip to content
This repository
Browse code

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

…nt-notification-update
  • Loading branch information...
commit e17d5f5f1309443054bb331aadc04940e83becf4 1 parent ef58b5c
Simon Wex simonwex authored

Showing 2 changed files with 24 additions and 0 deletions. Show diff stats Hide diff stats

  1. +23 0 app/http/views/social/worker.js.ejs
  2. +1 0  app/models/user.js
23 app/http/views/social/worker.js.ejs
@@ -27,6 +27,10 @@ var notificationCount = {
27 27 bugzilla: 0
28 28 }
29 29
  30 +var user = <%- JSON.stringify(user) %>;
  31 +user.portrait = "http://www.gravatar.com/avatar/" + user.gravatarHash + "s=32";
  32 +
  33 +
30 34 function log(message, angry){
31 35 if (typeof(message.join) == 'function'){
32 36 message = message.join("\n");
@@ -93,10 +97,29 @@ function initWebSocket(){
93 97 }
94 98
95 99 function setAmbientNotificationCount(){
  100 +
  101 + dump(JSON.stringify({
  102 + topic: 'social.ambient-notification-update',
  103 + data: {
  104 + name: 'bugzilla',
  105 + userName: user.email,
  106 + displayName: user.realName,
  107 + portrait: user.portrait,
  108 + profileURL: baseUrl + '/profile',
  109 + background: "url(" + SPRITES + ") transparent no-repeat 0px 7px",
  110 + counter: notificationCount.bugzilla,
  111 + contentPanel: baseUrl + '/social/bugs'
  112 + }
  113 + }));
  114 +
96 115 apiPort.postMessage({
97 116 topic: 'social.ambient-notification-update',
98 117 data: {
99 118 name: 'bugzilla',
  119 + userName: user.email,
  120 + displayName: user.realName,
  121 + portrait: user.portrait,
  122 + profileURL: baseUrl + '/profile',
100 123 background: "url(" + SPRITES + ") transparent no-repeat 0px 7px",
101 124 counter: notificationCount.bugzilla,
102 125 contentPanel: baseUrl + '/social/bugs'
1  app/models/user.js
@@ -21,6 +21,7 @@ function User(attrs){
21 21 this.email = (attrs['email'] || '').trim();
22 22 this.realName = (attrs['realName'] || '').trim();
23 23 this.nick = (attrs['nick'] || '').trim();
  24 + this.gravatarHash = crypto.createHash('md5').update(this.email).digest("hex");
24 25 }
25 26
26 27 module.exports = User;

0 comments on commit e17d5f5

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