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/lib/activitypub/actor.ts | 26 +++++++++++------------- server/lib/activitypub/process/process-delete.ts | 8 ++++---- server/lib/activitypub/process/process-update.ts | 4 ++-- 3 files changed, 18 insertions(+), 20 deletions(-) (limited to 'server/lib') diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 25cd40905..e0cb986bd 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -33,7 +33,7 @@ function setAsyncActorKeys (actor: ActorModel) { return actor.save() }) .catch(err => { - logger.error('Cannot set public/private keys of actor %d.', actor.uuid, { err }) + logger.error('Cannot set public/private keys of actor %d.', actor.url, { err }) return actor }) } @@ -128,18 +128,17 @@ async function updateActorInstance (actorInstance: ActorModel, attributes: Activ const followersCount = await fetchActorTotalItems(attributes.followers) const followingCount = await fetchActorTotalItems(attributes.following) - actorInstance.set('type', attributes.type) - actorInstance.set('uuid', attributes.uuid) - actorInstance.set('preferredUsername', attributes.preferredUsername) - actorInstance.set('url', attributes.id) - actorInstance.set('publicKey', attributes.publicKey.publicKeyPem) - actorInstance.set('followersCount', followersCount) - actorInstance.set('followingCount', followingCount) - actorInstance.set('inboxUrl', attributes.inbox) - actorInstance.set('outboxUrl', attributes.outbox) - actorInstance.set('sharedInboxUrl', attributes.endpoints.sharedInbox) - actorInstance.set('followersUrl', attributes.followers) - actorInstance.set('followingUrl', attributes.following) + actorInstance.type = attributes.type + actorInstance.preferredUsername = attributes.preferredUsername + actorInstance.url = attributes.id + actorInstance.publicKey = attributes.publicKey.publicKeyPem + actorInstance.followersCount = followersCount + actorInstance.followingCount = followingCount + actorInstance.inboxUrl = attributes.inbox + actorInstance.outboxUrl = attributes.outbox + actorInstance.sharedInboxUrl = attributes.endpoints.sharedInbox + actorInstance.followersUrl = attributes.followers + actorInstance.followingUrl = attributes.following } async function updateActorAvatarInstance (actorInstance: ActorModel, avatarName: string, t: Transaction) { @@ -388,7 +387,6 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode?: numbe const actor = new ActorModel({ type: actorJSON.type, - uuid: actorJSON.uuid, preferredUsername: actorJSON.preferredUsername, url: actorJSON.id, publicKey: actorJSON.publicKey.publicKeyPem, diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts index 76f07fd8a..6f10a50bd 100644 --- a/server/lib/activitypub/process/process-delete.ts +++ b/server/lib/activitypub/process/process-delete.ts @@ -95,23 +95,23 @@ async function processDeleteVideoPlaylist (actor: ActorModel, playlistToDelete: } async function processDeleteAccount (accountToRemove: AccountModel) { - logger.debug('Removing remote account "%s".', accountToRemove.Actor.uuid) + logger.debug('Removing remote account "%s".', accountToRemove.Actor.url) await sequelizeTypescript.transaction(async t => { await accountToRemove.destroy({ transaction: t }) }) - logger.info('Remote account with uuid %s removed.', accountToRemove.Actor.uuid) + logger.info('Remote account %s removed.', accountToRemove.Actor.url) } async function processDeleteVideoChannel (videoChannelToRemove: VideoChannelModel) { - logger.debug('Removing remote video channel "%s".', videoChannelToRemove.Actor.uuid) + logger.debug('Removing remote video channel "%s".', videoChannelToRemove.Actor.url) await sequelizeTypescript.transaction(async t => { await videoChannelToRemove.destroy({ transaction: t }) }) - logger.info('Remote video channel with uuid %s removed.', videoChannelToRemove.Actor.uuid) + logger.info('Remote video channel %s removed.', videoChannelToRemove.Actor.url) } function processDeleteVideoComment (byActor: ActorModel, videoComment: VideoCommentModel, activity: ActivityDelete) { diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 54a9234bb..71a16dacc 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts @@ -95,7 +95,7 @@ async function processUpdateCacheFile (byActor: ActorModel, activity: ActivityUp async function processUpdateActor (actor: ActorModel, activity: ActivityUpdate) { const actorAttributesToUpdate = activity.object as ActivityPubActor - logger.debug('Updating remote account "%s".', actorAttributesToUpdate.uuid) + logger.debug('Updating remote account "%s".', actorAttributesToUpdate.url) let accountOrChannelInstance: AccountModel | VideoChannelModel let actorFieldsSave: object let accountOrChannelFieldsSave: object @@ -128,7 +128,7 @@ async function processUpdateActor (actor: ActorModel, activity: ActivityUpdate) await accountOrChannelInstance.save({ transaction: t }) }) - logger.info('Remote account with uuid %s updated', actorAttributesToUpdate.uuid) + logger.info('Remote account %s updated', actorAttributesToUpdate.url) } catch (err) { if (actor !== undefined && actorFieldsSave !== undefined) { resetSequelizeInstance(actor, actorFieldsSave) -- cgit v1.2.3