summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSheogorath2017-09-22 12:40:43 +0200
committerSheogorath2017-09-22 12:40:43 +0200
commit500207545f072eeb59a8b27c143b2b517bf50452 (patch)
tree04231446329d97e33ad143df83177d195b0203e8 /lib
parentd1d6d5810b12645ddb02275ce0c2498b2189a8a0 (diff)
Fix broken profile images
Diffstat (limited to '')
-rw-r--r--lib/models/user.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/models/user.js b/lib/models/user.js
index 14c30bc3..e59b86cc 100644
--- a/lib/models/user.js
+++ b/lib/models/user.js
@@ -104,8 +104,12 @@ module.exports = function (sequelize, DataTypes) {
break
case 'gitlab':
photo = profile.avatarUrl
- if (bigger) photo = photo.replace(/(\?s=)\d*$/i, '$1400')
- else photo = photo.replace(/(\?s=)\d*$/i, '$196')
+ if (photo) {
+ if (bigger) photo = photo.replace(/(\?s=)\d*$/i, '$1400')
+ else photo = photo.replace(/(\?s=)\d*$/i, '$196')
+ } else {
+ photo = letterAvatars(profile.username)
+ }
break
case 'dropbox':
// no image api provided, use gravatar