From 6592f5761abf7d6d59c9bddb04ca21986a8779c5 Mon Sep 17 00:00:00 2001 From: shaialon Date: Fri, 26 Sep 2014 23:06:12 +0300 Subject: [PATCH] Change to user / userId --- client/views/comments/comment_item.html | 2 +- client/views/comments/comment_item.js | 8 ++------ client/views/common/gravatar.js | 10 +++++++++- client/views/users/user_profile.html | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/client/views/comments/comment_item.html b/client/views/comments/comment_item.html index 201e3601a..618bc5ca6 100644 --- a/client/views/comments/comment_item.html +++ b/client/views/comments/comment_item.html @@ -15,7 +15,7 @@ {{i18n "downvote"}} -
+
{{>gravatar userId=userId class=""}}
{{authorName}} diff --git a/client/views/comments/comment_item.js b/client/views/comments/comment_item.js index 42bc00f0d..ef257f3f9 100644 --- a/client/views/comments/comment_item.js +++ b/client/views/comments/comment_item.js @@ -79,10 +79,6 @@ Template[getTemplate('comment_item')].helpers({ authorName: function(){ return getAuthorName(this); }, - user_avatar: function(){ - if(author=Meteor.users.findOne(this.userId)) - return getAvatarUrl(author); - }, can_edit: function(){ if(this.userId && Meteor.userId()) return Meteor.user().isAdmin || (Meteor.userId() === this.userId); @@ -107,7 +103,7 @@ Template[getTemplate('comment_item')].helpers({ var user = Meteor.users.findOne(this.userId); if(user) return getProfileUrl(user); - } + } }); Template[getTemplate('comment_item')].rendered=function(){ @@ -122,7 +118,7 @@ Template[getTemplate('comment_item')].rendered=function(){ // // note: testing on the class works because Meteor apparently preserves newly assigned CSS classes // // across template renderings // // TODO: save scroll position - + // // get comment author name // var user=Meteor.users.findOne(comment.userId); // var author=getDisplayName(user); diff --git a/client/views/common/gravatar.js b/client/views/common/gravatar.js index 99a6f95bc..24fd44cba 100644 --- a/client/views/common/gravatar.js +++ b/client/views/common/gravatar.js @@ -1,6 +1,14 @@ Template[getTemplate('gravatar')].helpers({ gravatarUrl: function () { - return getAvatarUrl(this.email); + if (this.user){ + return getAvatarUrl(this.user); + } + else if (this.userId) { + var user=Meteor.users.findOne(this.userId); + if (user){ + return getAvatarUrl(user); + } + } }, cssClass: function(){ if (this.class){ diff --git a/client/views/users/user_profile.html b/client/views/users/user_profile.html index c91eec2ea..c645c3e18 100644 --- a/client/views/users/user_profile.html +++ b/client/views/users/user_profile.html @@ -3,7 +3,7 @@