]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Don't save other attributes when set as refreshed
authorChocobozzz <me@florianbigard.com>
Mon, 12 Apr 2021 11:44:58 +0000 (13:44 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 12 Apr 2021 11:44:58 +0000 (13:44 +0200)
server/lib/activitypub/process/process-delete.ts
server/models/video/video.ts

index 070ee0f1def6e0fa39b607a2912d5cb833707792..88a96831800dde85e9bf21d6d805e2aa6a9a730d 100644 (file)
@@ -7,7 +7,15 @@ import { VideoModel } from '../../../models/video/video'
 import { VideoCommentModel } from '../../../models/video/video-comment'
 import { VideoPlaylistModel } from '../../../models/video/video-playlist'
 import { APProcessorOptions } from '../../../types/activitypub-processor.model'
-import { MAccountActor, MActor, MActorSignature, MChannelActor, MCommentOwnerVideo } from '../../../types/models'
+import {
+  MAccountActor,
+  MActor,
+  MActorFull,
+  MActorSignature,
+  MChannelAccountActor,
+  MChannelActor,
+  MCommentOwnerVideo
+} from '../../../types/models'
 import { markCommentAsDeleted } from '../../video-comment'
 import { forwardVideoRelatedActivity } from '../send/utils'
 
@@ -30,7 +38,8 @@ async function processDeleteActivity (options: APProcessorOptions<ActivityDelete
     } else if (byActorFull.type === 'Group') {
       if (!byActorFull.VideoChannel) throw new Error('Actor ' + byActorFull.url + ' is a group but we cannot find it in database.')
 
-      const channelToDelete = Object.assign({}, byActorFull.VideoChannel, { Actor: byActorFull })
+      const channelToDelete = byActorFull.VideoChannel as MChannelAccountActor & { Actor: MActorFull }
+      channelToDelete.Actor = byActorFull
       return retryTransactionWrapper(processDeleteVideoChannel, channelToDelete)
     }
   }
index e9afb2c1875932a0ad7f617ca7fe180806a4599c..422bf6deb94c7bef8f0a770424136072dad96558 100644 (file)
@@ -2027,9 +2027,11 @@ export class VideoModel extends Model {
   }
 
   setAsRefreshed () {
-    this.changed('updatedAt', true)
+    const options = {
+      where: { id: this.id }
+    }
 
-    return this.save()
+    return VideoModel.update({ updatedAt: new Date() }, options)
   }
 
   requiresAuth () {