- // Fetch icon?
- const avatarName = await fetchAvatarIfExists(actorAttributesToUpdate)
-
- try {
- await sequelizeTypescript.transaction(async t => {
- actorFieldsSave = actor.toJSON()
-
- if (actorAttributesToUpdate.type === 'Group') accountOrChannelInstance = actor.VideoChannel
- else accountOrChannelInstance = actor.Account
-
- accountOrChannelFieldsSave = accountOrChannelInstance.toJSON()
-
- await updateActorInstance(actor, actorAttributesToUpdate)
-
- if (avatarName !== undefined) {
- await updateActorAvatarInstance(actor, avatarName, t)
- }
-
- await actor.save({ transaction: t })
-
- accountOrChannelInstance.set('name', actorAttributesToUpdate.name || actorAttributesToUpdate.preferredUsername)
- accountOrChannelInstance.set('description', actorAttributesToUpdate.summary)
- accountOrChannelInstance.set('support', actorAttributesToUpdate.support)
- await accountOrChannelInstance.save({ transaction: t })
- })
+ const updater = new APActorUpdater(actorObject, actor)
+ return updater.update()
+}