|
|
@@ -189,7 +189,7 @@ module.exports = function(crowi) {
|
|
|
|
|
|
userSchema.methods.updateIsGravatarEnabled = async function(isGravatarEnabled) {
|
|
|
this.isGravatarEnabled = isGravatarEnabled;
|
|
|
- this.imageUrlCached = this.generateImageUrlCached();
|
|
|
+ this.updateImageUrlCached();
|
|
|
const userData = await this.save();
|
|
|
return userData;
|
|
|
};
|
|
|
@@ -225,7 +225,7 @@ module.exports = function(crowi) {
|
|
|
|
|
|
userSchema.methods.updateImage = async function(attachment) {
|
|
|
this.imageAttachment = attachment;
|
|
|
- this.imageUrlCached = this.generateImageUrlCached();
|
|
|
+ this.updateImageUrlCached();
|
|
|
return this.save();
|
|
|
};
|
|
|
|
|
|
@@ -241,10 +241,14 @@ module.exports = function(crowi) {
|
|
|
}
|
|
|
|
|
|
this.imageAttachment = undefined;
|
|
|
- this.imageUrlCached = this.generateImageUrlCached();
|
|
|
+ this.updateImageUrlCached();
|
|
|
return this.save();
|
|
|
};
|
|
|
|
|
|
+ userSchema.methods.updateImageUrlCached = function() {
|
|
|
+ this.imageUrlCached = this.generateImageUrlCached();
|
|
|
+ };
|
|
|
+
|
|
|
userSchema.methods.generateImageUrlCached = function() {
|
|
|
if (this.isGravatarEnabled) {
|
|
|
const email = this.email || '';
|