- const videoChannelSharePromise = VideoShareModel.create({
- actorId: video.VideoChannel.actorId,
- videoId: video.id,
- url: videoChannelShareUrl
- }, { transaction: t })
+ const videoChannelSharePromise = VideoShareModel.findOrCreate({
+ defaults: {
+ actorId: video.VideoChannel.actorId,
+ videoId: video.id,
+ url: videoChannelShareUrl
+ },
+ where: {
+ url: videoChannelShareUrl
+ },
+ transaction: t
+ }).then(([ videoChannelShare, created ]) => {
+ if (created) return sendVideoAnnounce(serverActor, videoChannelShare, video, t)