Merge branch 'feature/correctly-send-activities' into develop
authorChocobozzz <me@florianbigard.com>
Mon, 11 Feb 2019 10:00:09 +0000 (11:00 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 11 Feb 2019 10:00:09 +0000 (11:00 +0100)
1  2 
server/controllers/activitypub/client.ts
server/controllers/api/videos/index.ts
server/lib/activitypub/send/send-create.ts
server/lib/activitypub/send/send-undo.ts

index 32a83aa5f6b614bd05dfcb9d69cf2723cb0f892e,7e87f6f3baad1f95707e746292c474dd3bd0dc72..31c0a5fbd8c04dc54b744a230ba170eaf2d3ba8f
@@@ -37,9 -33,10 +33,10 @@@ import 
    getVideoSharesActivityPubUrl
  } from '../../lib/activitypub'
  import { VideoCaptionModel } from '../../models/video/video-caption'
 -import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy'
 +import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy'
  import { getServerActor } from '../../helpers/utils'
  import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
+ import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike'
  
  const activityPubClientRouter = express.Router()
  
index 605aaba066f27f285758ae15bb3983fdd0105c49,73e667ad4252438d8832c61008c37ad823fbfdd9..ef20e404c4b59b802fad869ea5b8a149fd7af456
@@@ -25,23 -23,12 +23,9 @@@ async function sendCreateVideo (video: 
    return broadcastToFollowers(createActivity, byActor, [ byActor ], t)
  }
  
- async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel) {
-   if (!video.VideoChannel.Account.Actor.serverId) return // Local
-   const url = getVideoAbuseActivityPubUrl(videoAbuse)
-   logger.info('Creating job to send video abuse %s.', url)
-   // Custom audience, we only send the abuse to the origin instance
-   const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] }
-   const createActivity = buildCreateActivity(url, byActor, videoAbuse.toActivityPubObject(), audience)
-   return unicastTo(createActivity, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl)
- }
 -async function sendCreateCacheFile (byActor: ActorModel, fileRedundancy: VideoRedundancyModel) {
 +async function sendCreateCacheFile (byActor: ActorModel, video: VideoModel, fileRedundancy: VideoRedundancyModel) {
    logger.info('Creating job to send file cache of %s.', fileRedundancy.url)
  
 -  const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(fileRedundancy.VideoFile.Video.id)
 -  const redundancyObject = fileRedundancy.toActivityPubObject()
 -
    return sendVideoRelatedCreateActivity({
      byActor,
      video,