Remove usage of tiley (#4406)
* First pass * Mooarrr * lint * snapshots
This commit is contained in:
@@ -24,7 +24,6 @@ import { CollectionPermission, TeamPreference } from "@shared/types";
|
||||
import { getBaseDomain, RESERVED_SUBDOMAINS } from "@shared/utils/domains";
|
||||
import env from "@server/env";
|
||||
import DeleteAttachmentTask from "@server/queues/tasks/DeleteAttachmentTask";
|
||||
import { generateAvatarUrl } from "@server/utils/avatars";
|
||||
import parseAttachmentIds from "@server/utils/parseAttachmentIds";
|
||||
import Attachment from "./Attachment";
|
||||
import AuthenticationProvider from "./AuthenticationProvider";
|
||||
@@ -94,8 +93,20 @@ class Team extends ParanoidModel {
|
||||
@AllowNull
|
||||
@IsUrl
|
||||
@Length({ max: 4096, msg: "avatarUrl must be 4096 characters or less" })
|
||||
@Column
|
||||
avatarUrl: string | null;
|
||||
@Column(DataType.STRING)
|
||||
get avatarUrl() {
|
||||
const original = this.getDataValue("avatarUrl");
|
||||
|
||||
if (original && !original.startsWith("https://tiley.herokuapp.com")) {
|
||||
return original;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
set avatarUrl(value: string | null) {
|
||||
this.setDataValue("avatarUrl", value);
|
||||
}
|
||||
|
||||
@Default(true)
|
||||
@Column
|
||||
@@ -163,16 +174,6 @@ class Team extends ParanoidModel {
|
||||
return url.href.replace(/\/$/, "");
|
||||
}
|
||||
|
||||
get logoUrl() {
|
||||
return (
|
||||
this.avatarUrl ||
|
||||
generateAvatarUrl({
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preferences that decide behavior for the team.
|
||||
*
|
||||
|
||||
@@ -180,17 +180,11 @@ class User extends ParanoidModel {
|
||||
get avatarUrl() {
|
||||
const original = this.getDataValue("avatarUrl");
|
||||
|
||||
if (original) {
|
||||
if (original && !original.startsWith("https://tiley.herokuapp.com")) {
|
||||
return original;
|
||||
}
|
||||
|
||||
const color = this.color.replace(/^#/, "");
|
||||
const initial = this.name ? this.name[0] : "?";
|
||||
const hash = crypto
|
||||
.createHash("md5")
|
||||
.update(this.email || "")
|
||||
.digest("hex");
|
||||
return `${env.DEFAULT_AVATAR_HOST}/avatar/${hash}/${initial}.png?c=${color}`;
|
||||
return null;
|
||||
}
|
||||
|
||||
set avatarUrl(value: string | null) {
|
||||
|
||||
Reference in New Issue
Block a user