aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-21 10:34:18 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 09:41:54 +0200
commit99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd (patch)
treee442f6cdf0cb622cb78f64d0d9de23bfb6deb951 /server/middlewares
parent8a19bee1a1ee39f973bb37429e4f73c3f2873cdb (diff)
downloadPeerTube-99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd.tar.gz
PeerTube-99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd.tar.zst
PeerTube-99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd.zip
Add get subscription endpoint
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/user-subscriptions.ts8
-rw-r--r--server/middlewares/validators/videos.ts2
2 files changed, 5 insertions, 5 deletions
diff --git a/server/middlewares/validators/user-subscriptions.ts b/server/middlewares/validators/user-subscriptions.ts
index f331b6c34..d8c26c742 100644
--- a/server/middlewares/validators/user-subscriptions.ts
+++ b/server/middlewares/validators/user-subscriptions.ts
@@ -20,11 +20,11 @@ const userSubscriptionAddValidator = [
20 } 20 }
21] 21]
22 22
23const userSubscriptionRemoveValidator = [ 23const userSubscriptionGetValidator = [
24 param('uri').custom(isValidActorHandle).withMessage('Should have a valid URI to unfollow'), 24 param('uri').custom(isValidActorHandle).withMessage('Should have a valid URI to unfollow'),
25 25
26 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 26 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
27 logger.debug('Checking unfollow parameters', { parameters: req.params }) 27 logger.debug('Checking userSubscriptionGetValidator parameters', { parameters: req.params })
28 28
29 if (areValidationErrors(req, res)) return 29 if (areValidationErrors(req, res)) return
30 30
@@ -34,7 +34,7 @@ const userSubscriptionRemoveValidator = [
34 const user: UserModel = res.locals.oauth.token.User 34 const user: UserModel = res.locals.oauth.token.User
35 const subscription = await ActorFollowModel.loadByActorAndTargetNameAndHost(user.Account.Actor.id, name, host) 35 const subscription = await ActorFollowModel.loadByActorAndTargetNameAndHost(user.Account.Actor.id, name, host)
36 36
37 if (!subscription) { 37 if (!subscription || !subscription.ActorFollowing.VideoChannel) {
38 return res 38 return res
39 .status(404) 39 .status(404)
40 .json({ 40 .json({
@@ -52,7 +52,7 @@ const userSubscriptionRemoveValidator = [
52 52
53export { 53export {
54 userSubscriptionAddValidator, 54 userSubscriptionAddValidator,
55 userSubscriptionRemoveValidator 55 userSubscriptionGetValidator
56} 56}
57 57
58// --------------------------------------------------------------------------- 58// ---------------------------------------------------------------------------
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts
index 53c32abb8..a2c866152 100644
--- a/server/middlewares/validators/videos.ts
+++ b/server/middlewares/validators/videos.ts
@@ -137,7 +137,7 @@ const videosGetValidator = [
137 137
138 // Video private or blacklisted 138 // Video private or blacklisted
139 if (video.privacy === VideoPrivacy.PRIVATE || video.VideoBlacklist) { 139 if (video.privacy === VideoPrivacy.PRIVATE || video.VideoBlacklist) {
140 authenticate(req, res, () => { 140 return authenticate(req, res, () => {
141 const user: UserModel = res.locals.oauth.token.User 141 const user: UserModel = res.locals.oauth.token.User
142 142
143 // Only the owner or a user that have blacklist rights can see the video 143 // Only the owner or a user that have blacklist rights can see the video