From 57cfff78858b2360d9e038e2a504b761cb51da47 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 May 2019 14:02:26 +0200 Subject: Remove unused actor uuid field --- server/models/account/account.ts | 19 +------------------ server/models/activitypub/actor.ts | 14 -------------- server/models/video/video-channel.ts | 21 +-------------------- 3 files changed, 2 insertions(+), 52 deletions(-) (limited to 'server/models') diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 2b04acd86..09cada096 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -47,7 +47,7 @@ export enum ScopeNames { attributes: [ 'id', 'name' ], include: [ { - attributes: [ 'id', 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], + attributes: [ 'id', 'preferredUsername', 'url', 'serverId', 'avatarId' ], model: ActorModel.unscoped(), required: true, where: whereActor, @@ -180,22 +180,6 @@ export class AccountModel extends Model { return AccountModel.findByPk(id, { transaction }) } - static loadByUUID (uuid: string) { - const query = { - include: [ - { - model: ActorModel, - required: true, - where: { - uuid - } - } - ] - } - - return AccountModel.findOne(query) - } - static loadByNameWithHost (nameWithHost: string) { const [ accountName, host ] = nameWithHost.split('@') @@ -332,7 +316,6 @@ export class AccountModel extends Model { return { id: this.id, - uuid: actor.uuid, name: actor.name, displayName: this.getDisplayName(), url: actor.url, diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index 4a466441c..bd6a2c8fd 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts @@ -7,13 +7,11 @@ import { Column, CreatedAt, DataType, - Default, DefaultScope, ForeignKey, HasMany, HasOne, Is, - IsUUID, Model, Scopes, Table, @@ -119,10 +117,6 @@ export const unusedActorAttributesForAPI = [ { fields: [ 'avatarId' ] }, - { - fields: [ 'uuid' ], - unique: true - }, { fields: [ 'followersUrl' ] } @@ -134,12 +128,6 @@ export class ActorModel extends Model { @Column(DataType.ENUM(...values(ACTIVITY_PUB_ACTOR_TYPES))) type: ActivityPubActorType - @AllowNull(false) - @Default(DataType.UUIDV4) - @IsUUID(4) - @Column(DataType.UUID) - uuid: string - @AllowNull(false) @Is('ActorPreferredUsername', value => throwIfNotValid(value, isActorPreferredUsernameValid, 'actor preferred username')) @Column @@ -408,7 +396,6 @@ export class ActorModel extends Model { return { id: this.id, url: this.url, - uuid: this.uuid, name: this.preferredUsername, host: this.getHost(), hostRedundancyAllowed: this.getRedundancyAllowed(), @@ -454,7 +441,6 @@ export class ActorModel extends Model { endpoints: { sharedInbox: this.sharedInboxUrl }, - uuid: this.uuid, publicKey: { id: this.getPublicKeyUrl(), owner: this.url, diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index d73be18d6..b0b261c88 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -72,7 +72,7 @@ type AvailableForListOptions = { attributes: [ 'name', 'description', 'id', 'actorId' ], include: [ { - attributes: [ 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], + attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ], model: ActorModel.unscoped(), required: true, include: [ @@ -387,24 +387,6 @@ export class VideoChannelModel extends Model { .findByPk(id) } - static loadByUUIDAndPopulateAccount (uuid: string) { - const query = { - include: [ - { - model: ActorModel, - required: true, - where: { - uuid - } - } - ] - } - - return VideoChannelModel - .scope([ ScopeNames.WITH_ACCOUNT ]) - .findOne(query) - } - static loadByUrlAndPopulateAccount (url: string) { const query = { include: [ @@ -510,7 +492,6 @@ export class VideoChannelModel extends Model { return { id: this.id, - uuid: actor.uuid, name: actor.name, displayName: this.getDisplayName(), url: actor.url, -- cgit v1.2.3