summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-10-21 04:26:16 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-10-21 04:26:16 +0200
commit9154b06fc39f5cd046e1ed17a822e67a593b46c7 (patch)
tree4739a0338350339633cc12d9e3add47c2e2c6701 /models
parent7a5f030cc807c6a0a5addd8da59dc853dd4bd426 (diff)
downloadwekan-9154b06fc39f5cd046e1ed17a822e67a593b46c7.tar.gz
wekan-9154b06fc39f5cd046e1ed17a822e67a593b46c7.tar.bz2
wekan-9154b06fc39f5cd046e1ed17a822e67a593b46c7.zip
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.
Diffstat (limited to 'models')
-rw-r--r--models/users.js13
1 files changed, 13 insertions, 0 deletions
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)