From 9154b06fc39f5cd046e1ed17a822e67a593b46c7 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Wed, 21 Oct 2015 04:26:16 +0200 Subject: Upgrade kenton:accounts-sandstorm package to 0.1.6 We now delegates more user attributes sync (avatar and permissions) to this package instead of doing it ourselves. --- models/users.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'models') diff --git a/models/users.js b/models/users.js index 4260dc56..1ea09a03 100644 --- a/models/users.js +++ b/models/users.js @@ -35,6 +35,19 @@ Users.helpers({ _.where(board.members, {userId: this._id})[0].isAdmin; }, + getAvatarUrl() { + // Although we put the avatar picture URL in the `profile` object, we need + // to support Sandstorm which put in the `picture` attribute by default. + // XXX Should we move both cases to `picture`? + if (this.picture) { + return this.picture; + } else if (this.profile && this.profile.avatarUrl) { + return this.profile.avatarUrl; + } else { + return null; + } + }, + getInitials() { const profile = this.profile || {}; if (profile.initials) -- cgit v1.2.3-1-g7c22