- await updateActorImageInstance(actor, ActorImageType.AVATAR, avatarInfo, t)
- await updateActorImageInstance(actor, ActorImageType.BANNER, bannerInfo, t)
-
- await actor.save({ transaction: t })
-
- accountOrChannelInstance.name = actorAttributesToUpdate.name || actorAttributesToUpdate.preferredUsername
- accountOrChannelInstance.description = actorAttributesToUpdate.summary
-
- if (accountOrChannelInstance instanceof VideoChannelModel) accountOrChannelInstance.support = actorAttributesToUpdate.support
-
- await accountOrChannelInstance.save({ transaction: t })
- })
-
- logger.info('Remote account %s updated', actorAttributesToUpdate.url)
- } catch (err) {
- if (actor !== undefined && actorFieldsSave !== undefined) {
- resetSequelizeInstance(actor, actorFieldsSave)
- }
-
- if (accountOrChannelInstance !== undefined && accountOrChannelFieldsSave !== undefined) {
- resetSequelizeInstance(accountOrChannelInstance, accountOrChannelFieldsSave)
- }
-
- // This is just a debug because we will retry the insert
- logger.debug('Cannot update the remote account.', { err })
- throw err
- }
+ const updater = new APActorUpdater(actorObject, actor)
+ return updater.update()