chore: Syncs changes that were erroneously made in enterprise repo (#1949)

This commit is contained in:
Tom Moor
2021-03-10 14:56:34 -08:00
committed by GitHub
parent d530edcc2f
commit dc967be4fc
9 changed files with 34 additions and 11 deletions

View File

@@ -95,6 +95,8 @@ const Document = sequelize.define(
},
getterMethods: {
url: function () {
if (!this.title) return `/doc/untitled-${this.urlId}`;
const slugifiedTitle = slugify(this.title);
return `/doc/${slugifiedTitle}-${this.urlId}`;
},

View File

@@ -60,11 +60,12 @@ const User = sequelize.define(
return original;
}
const initial = this.name ? this.name[0] : "?";
const hash = crypto
.createHash("md5")
.update(this.email || "")
.digest("hex");
return `${DEFAULT_AVATAR_HOST}/avatar/${hash}/${this.name[0]}.png`;
return `${DEFAULT_AVATAR_HOST}/avatar/${hash}/${initial}.png`;
},
},
}