diff options
author | Chocobozzz <me@florianbigard.com> | 2019-01-15 14:52:33 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-01-15 14:59:40 +0100 |
commit | 1e7eb25f6cb6893db8f99ff40ef0509aa2a16614 (patch) | |
tree | 798937b32d894a3e1235e34398876ed875c1b72e /server/controllers | |
parent | 848f499def54db2dd36437ef0dfb74dd5041c23b (diff) | |
download | PeerTube-1e7eb25f6cb6893db8f99ff40ef0509aa2a16614.tar.gz PeerTube-1e7eb25f6cb6893db8f99ff40ef0509aa2a16614.tar.zst PeerTube-1e7eb25f6cb6893db8f99ff40ef0509aa2a16614.zip |
Correctly send Flag/Dislike/View activities
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 15 | ||||
-rw-r--r-- | server/controllers/api/videos/abuse.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 4 |
3 files changed, 9 insertions, 12 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index 1a4e28dc8..7e87f6f3b 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -3,22 +3,18 @@ import * as express from 'express' | |||
3 | import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' | 3 | import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' |
4 | import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' | 4 | import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' |
5 | import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers' | 5 | import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers' |
6 | import { buildAnnounceWithVideoAudience, buildDislikeActivity, buildLikeActivity } from '../../lib/activitypub/send' | 6 | import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' |
7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' | 7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' |
8 | import { buildCreateActivity } from '../../lib/activitypub/send/send-create' | 8 | import { buildCreateActivity } from '../../lib/activitypub/send/send-create' |
9 | import { | 9 | import { |
10 | asyncMiddleware, | 10 | asyncMiddleware, |
11 | videosShareValidator, | ||
12 | executeIfActivityPub, | 11 | executeIfActivityPub, |
13 | localAccountValidator, | 12 | localAccountValidator, |
14 | localVideoChannelValidator, | 13 | localVideoChannelValidator, |
15 | videosCustomGetValidator | 14 | videosCustomGetValidator, |
15 | videosShareValidator | ||
16 | } from '../../middlewares' | 16 | } from '../../middlewares' |
17 | import { | 17 | import { getAccountVideoRateValidator, videoCommentGetValidator, videosGetValidator } from '../../middlewares/validators' |
18 | getAccountVideoRateValidator, | ||
19 | videoCommentGetValidator, | ||
20 | videosGetValidator | ||
21 | } from '../../middlewares/validators' | ||
22 | import { AccountModel } from '../../models/account/account' | 18 | import { AccountModel } from '../../models/account/account' |
23 | import { ActorModel } from '../../models/activitypub/actor' | 19 | import { ActorModel } from '../../models/activitypub/actor' |
24 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' | 20 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' |
@@ -40,6 +36,7 @@ import { VideoCaptionModel } from '../../models/video/video-caption' | |||
40 | import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy' | 36 | import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy' |
41 | import { getServerActor } from '../../helpers/utils' | 37 | import { getServerActor } from '../../helpers/utils' |
42 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | 38 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' |
39 | import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike' | ||
43 | 40 | ||
44 | const activityPubClientRouter = express.Router() | 41 | const activityPubClientRouter = express.Router() |
45 | 42 | ||
@@ -156,7 +153,7 @@ function getAccountVideoRate (rateType: VideoRateType) { | |||
156 | const url = getRateUrl(rateType, byActor, accountVideoRate.Video) | 153 | const url = getRateUrl(rateType, byActor, accountVideoRate.Video) |
157 | const APObject = rateType === 'like' | 154 | const APObject = rateType === 'like' |
158 | ? buildLikeActivity(url, byActor, accountVideoRate.Video) | 155 | ? buildLikeActivity(url, byActor, accountVideoRate.Video) |
159 | : buildCreateActivity(url, byActor, buildDislikeActivity(url, byActor, accountVideoRate.Video)) | 156 | : buildDislikeActivity(url, byActor, accountVideoRate.Video) |
160 | 157 | ||
161 | return activityPubResponse(activityPubContextify(APObject), res) | 158 | return activityPubResponse(activityPubContextify(APObject), res) |
162 | } | 159 | } |
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts index fe0a95cd5..32f9c4793 100644 --- a/server/controllers/api/videos/abuse.ts +++ b/server/controllers/api/videos/abuse.ts | |||
@@ -3,7 +3,6 @@ import { UserRight, VideoAbuseCreate, VideoAbuseState } from '../../../../shared | |||
3 | import { logger } from '../../../helpers/logger' | 3 | import { logger } from '../../../helpers/logger' |
4 | import { getFormattedObjects } from '../../../helpers/utils' | 4 | import { getFormattedObjects } from '../../../helpers/utils' |
5 | import { sequelizeTypescript } from '../../../initializers' | 5 | import { sequelizeTypescript } from '../../../initializers' |
6 | import { sendVideoAbuse } from '../../../lib/activitypub/send' | ||
7 | import { | 6 | import { |
8 | asyncMiddleware, | 7 | asyncMiddleware, |
9 | asyncRetryTransactionMiddleware, | 8 | asyncRetryTransactionMiddleware, |
@@ -23,6 +22,7 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse' | |||
23 | import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger' | 22 | import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger' |
24 | import { UserModel } from '../../../models/account/user' | 23 | import { UserModel } from '../../../models/account/user' |
25 | import { Notifier } from '../../../lib/notifier' | 24 | import { Notifier } from '../../../lib/notifier' |
25 | import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag' | ||
26 | 26 | ||
27 | const auditLogger = auditLoggerFactory('abuse') | 27 | const auditLogger = auditLoggerFactory('abuse') |
28 | const abuseVideoRouter = express.Router() | 28 | const abuseVideoRouter = express.Router() |
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 2b2dfa7ca..8414ca42c 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -23,7 +23,6 @@ import { | |||
23 | fetchRemoteVideoDescription, | 23 | fetchRemoteVideoDescription, |
24 | getVideoActivityPubUrl | 24 | getVideoActivityPubUrl |
25 | } from '../../../lib/activitypub' | 25 | } from '../../../lib/activitypub' |
26 | import { sendCreateView } from '../../../lib/activitypub/send' | ||
27 | import { JobQueue } from '../../../lib/job-queue' | 26 | import { JobQueue } from '../../../lib/job-queue' |
28 | import { Redis } from '../../../lib/redis' | 27 | import { Redis } from '../../../lib/redis' |
29 | import { | 28 | import { |
@@ -59,6 +58,7 @@ import { resetSequelizeInstance } from '../../../helpers/database-utils' | |||
59 | import { move } from 'fs-extra' | 58 | import { move } from 'fs-extra' |
60 | import { watchingRouter } from './watching' | 59 | import { watchingRouter } from './watching' |
61 | import { Notifier } from '../../../lib/notifier' | 60 | import { Notifier } from '../../../lib/notifier' |
61 | import { sendView } from '../../../lib/activitypub/send/send-view' | ||
62 | 62 | ||
63 | const auditLogger = auditLoggerFactory('videos') | 63 | const auditLogger = auditLoggerFactory('videos') |
64 | const videosRouter = express.Router() | 64 | const videosRouter = express.Router() |
@@ -422,7 +422,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
422 | ]) | 422 | ]) |
423 | 423 | ||
424 | const serverActor = await getServerActor() | 424 | const serverActor = await getServerActor() |
425 | await sendCreateView(serverActor, videoInstance, undefined) | 425 | await sendView(serverActor, videoInstance, undefined) |
426 | 426 | ||
427 | return res.status(204).end() | 427 | return res.status(204).end() |
428 | } | 428 | } |