aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r--server/controllers/api/users/index.ts30
-rw-r--r--server/controllers/api/users/me.ts20
-rw-r--r--server/controllers/api/users/my-blocklist.ts17
-rw-r--r--server/controllers/api/users/my-history.ts4
-rw-r--r--server/controllers/api/users/my-notifications.ts11
-rw-r--r--server/controllers/api/users/my-subscriptions.ts15
-rw-r--r--server/controllers/api/users/my-video-playlists.ts3
7 files changed, 48 insertions, 52 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index f7edbddf3..2117bdfeb 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -221,8 +221,8 @@ async function registerUser (req: express.Request, res: express.Response) {
221 return res.type('json').status(204).end() 221 return res.type('json').status(204).end()
222} 222}
223 223
224async function unblockUser (req: express.Request, res: express.Response, next: express.NextFunction) { 224async function unblockUser (req: express.Request, res: express.Response) {
225 const user: UserModel = res.locals.user 225 const user = res.locals.user
226 226
227 await changeUserBlock(res, user, false) 227 await changeUserBlock(res, user, false)
228 228
@@ -230,7 +230,7 @@ async function unblockUser (req: express.Request, res: express.Response, next: e
230} 230}
231 231
232async function blockUser (req: express.Request, res: express.Response) { 232async function blockUser (req: express.Request, res: express.Response) {
233 const user: UserModel = res.locals.user 233 const user = res.locals.user
234 const reason = req.body.reason 234 const reason = req.body.reason
235 235
236 await changeUserBlock(res, user, true, reason) 236 await changeUserBlock(res, user, true, reason)
@@ -239,7 +239,7 @@ async function blockUser (req: express.Request, res: express.Response) {
239} 239}
240 240
241function getUser (req: express.Request, res: express.Response) { 241function getUser (req: express.Request, res: express.Response) {
242 return res.json((res.locals.user as UserModel).toFormattedJSON()) 242 return res.json(res.locals.user.toFormattedJSON())
243} 243}
244 244
245async function autocompleteUsers (req: express.Request, res: express.Response) { 245async function autocompleteUsers (req: express.Request, res: express.Response) {
@@ -255,7 +255,7 @@ async function listUsers (req: express.Request, res: express.Response) {
255} 255}
256 256
257async function removeUser (req: express.Request, res: express.Response) { 257async function removeUser (req: express.Request, res: express.Response) {
258 const user: UserModel = res.locals.user 258 const user = res.locals.user
259 259
260 await user.destroy() 260 await user.destroy()
261 261
@@ -266,7 +266,7 @@ async function removeUser (req: express.Request, res: express.Response) {
266 266
267async function updateUser (req: express.Request, res: express.Response) { 267async function updateUser (req: express.Request, res: express.Response) {
268 const body: UserUpdate = req.body 268 const body: UserUpdate = req.body
269 const userToUpdate = res.locals.user as UserModel 269 const userToUpdate = res.locals.user
270 const oldUserAuditView = new UserAuditView(userToUpdate.toFormattedJSON()) 270 const oldUserAuditView = new UserAuditView(userToUpdate.toFormattedJSON())
271 const roleChanged = body.role !== undefined && body.role !== userToUpdate.role 271 const roleChanged = body.role !== undefined && body.role !== userToUpdate.role
272 272
@@ -289,8 +289,8 @@ async function updateUser (req: express.Request, res: express.Response) {
289 return res.sendStatus(204) 289 return res.sendStatus(204)
290} 290}
291 291
292async function askResetUserPassword (req: express.Request, res: express.Response, next: express.NextFunction) { 292async function askResetUserPassword (req: express.Request, res: express.Response) {
293 const user = res.locals.user as UserModel 293 const user = res.locals.user
294 294
295 const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id) 295 const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id)
296 const url = CONFIG.WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString 296 const url = CONFIG.WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString
@@ -299,8 +299,8 @@ async function askResetUserPassword (req: express.Request, res: express.Response
299 return res.status(204).end() 299 return res.status(204).end()
300} 300}
301 301
302async function resetUserPassword (req: express.Request, res: express.Response, next: express.NextFunction) { 302async function resetUserPassword (req: express.Request, res: express.Response) {
303 const user = res.locals.user as UserModel 303 const user = res.locals.user
304 user.password = req.body.password 304 user.password = req.body.password
305 305
306 await user.save() 306 await user.save()
@@ -315,16 +315,16 @@ async function sendVerifyUserEmail (user: UserModel) {
315 return 315 return
316} 316}
317 317
318async function askSendVerifyUserEmail (req: express.Request, res: express.Response, next: express.NextFunction) { 318async function askSendVerifyUserEmail (req: express.Request, res: express.Response) {
319 const user = res.locals.user as UserModel 319 const user = res.locals.user
320 320
321 await sendVerifyUserEmail(user) 321 await sendVerifyUserEmail(user)
322 322
323 return res.status(204).end() 323 return res.status(204).end()
324} 324}
325 325
326async function verifyUserEmail (req: express.Request, res: express.Response, next: express.NextFunction) { 326async function verifyUserEmail (req: express.Request, res: express.Response) {
327 const user = res.locals.user as UserModel 327 const user = res.locals.user
328 user.emailVerified = true 328 user.emailVerified = true
329 329
330 await user.save() 330 await user.save()
@@ -332,7 +332,7 @@ async function verifyUserEmail (req: express.Request, res: express.Response, nex
332 return res.status(204).end() 332 return res.status(204).end()
333} 333}
334 334
335function success (req: express.Request, res: express.Response, next: express.NextFunction) { 335function success (req: express.Request, res: express.Response) {
336 res.end() 336 res.end()
337} 337}
338 338
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index d5e154869..3533499be 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -93,8 +93,8 @@ export {
93 93
94// --------------------------------------------------------------------------- 94// ---------------------------------------------------------------------------
95 95
96async function getUserVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 96async function getUserVideos (req: express.Request, res: express.Response) {
97 const user = res.locals.oauth.token.User as UserModel 97 const user = res.locals.oauth.token.User
98 const resultList = await VideoModel.listUserVideosForApi( 98 const resultList = await VideoModel.listUserVideosForApi(
99 user.Account.id, 99 user.Account.id,
100 req.query.start as number, 100 req.query.start as number,
@@ -111,8 +111,8 @@ async function getUserVideos (req: express.Request, res: express.Response, next:
111 return res.json(getFormattedObjects(resultList.data, resultList.total, { additionalAttributes })) 111 return res.json(getFormattedObjects(resultList.data, resultList.total, { additionalAttributes }))
112} 112}
113 113
114async function getUserVideoImports (req: express.Request, res: express.Response, next: express.NextFunction) { 114async function getUserVideoImports (req: express.Request, res: express.Response) {
115 const user = res.locals.oauth.token.User as UserModel 115 const user = res.locals.oauth.token.User
116 const resultList = await VideoImportModel.listUserVideoImportsForApi( 116 const resultList = await VideoImportModel.listUserVideoImportsForApi(
117 user.id, 117 user.id,
118 req.query.start as number, 118 req.query.start as number,
@@ -123,14 +123,14 @@ async function getUserVideoImports (req: express.Request, res: express.Response,
123 return res.json(getFormattedObjects(resultList.data, resultList.total)) 123 return res.json(getFormattedObjects(resultList.data, resultList.total))
124} 124}
125 125
126async function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) { 126async function getUserInformation (req: express.Request, res: express.Response) {
127 // We did not load channels in res.locals.user 127 // We did not load channels in res.locals.user
128 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username) 128 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
129 129
130 return res.json(user.toFormattedJSON()) 130 return res.json(user.toFormattedJSON())
131} 131}
132 132
133async function getUserVideoQuotaUsed (req: express.Request, res: express.Response, next: express.NextFunction) { 133async function getUserVideoQuotaUsed (req: express.Request, res: express.Response) {
134 // We did not load channels in res.locals.user 134 // We did not load channels in res.locals.user
135 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username) 135 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
136 const videoQuotaUsed = await UserModel.getOriginalVideoFileTotalFromUser(user) 136 const videoQuotaUsed = await UserModel.getOriginalVideoFileTotalFromUser(user)
@@ -143,7 +143,7 @@ async function getUserVideoQuotaUsed (req: express.Request, res: express.Respons
143 return res.json(data) 143 return res.json(data)
144} 144}
145 145
146async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) { 146async function getUserVideoRating (req: express.Request, res: express.Response) {
147 const videoId = res.locals.video.id 147 const videoId = res.locals.video.id
148 const accountId = +res.locals.oauth.token.User.Account.id 148 const accountId = +res.locals.oauth.token.User.Account.id
149 149
@@ -158,7 +158,7 @@ async function getUserVideoRating (req: express.Request, res: express.Response,
158} 158}
159 159
160async function deleteMe (req: express.Request, res: express.Response) { 160async function deleteMe (req: express.Request, res: express.Response) {
161 const user: UserModel = res.locals.oauth.token.User 161 const user = res.locals.oauth.token.User
162 162
163 await user.destroy() 163 await user.destroy()
164 164
@@ -170,7 +170,7 @@ async function deleteMe (req: express.Request, res: express.Response) {
170async function updateMe (req: express.Request, res: express.Response) { 170async function updateMe (req: express.Request, res: express.Response) {
171 const body: UserUpdateMe = req.body 171 const body: UserUpdateMe = req.body
172 172
173 const user: UserModel = res.locals.oauth.token.user 173 const user = res.locals.oauth.token.user
174 const oldUserAuditView = new UserAuditView(user.toFormattedJSON()) 174 const oldUserAuditView = new UserAuditView(user.toFormattedJSON())
175 175
176 if (body.password !== undefined) user.password = body.password 176 if (body.password !== undefined) user.password = body.password
@@ -199,7 +199,7 @@ async function updateMe (req: express.Request, res: express.Response) {
199 199
200async function updateMyAvatar (req: express.Request, res: express.Response) { 200async function updateMyAvatar (req: express.Request, res: express.Response) {
201 const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ] 201 const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]
202 const user: UserModel = res.locals.oauth.token.user 202 const user = res.locals.oauth.token.user
203 const oldUserAuditView = new UserAuditView(user.toFormattedJSON()) 203 const oldUserAuditView = new UserAuditView(user.toFormattedJSON())
204 204
205 const userAccount = await AccountModel.load(user.Account.id) 205 const userAccount = await AccountModel.load(user.Account.id)
diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts
index 9575eab46..481e75139 100644
--- a/server/controllers/api/users/my-blocklist.ts
+++ b/server/controllers/api/users/my-blocklist.ts
@@ -17,7 +17,6 @@ import {
17 serversBlocklistSortValidator, 17 serversBlocklistSortValidator,
18 unblockServerByAccountValidator 18 unblockServerByAccountValidator
19} from '../../../middlewares/validators' 19} from '../../../middlewares/validators'
20import { UserModel } from '../../../models/account/user'
21import { AccountModel } from '../../../models/account/account' 20import { AccountModel } from '../../../models/account/account'
22import { AccountBlocklistModel } from '../../../models/account/account-blocklist' 21import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
23import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist' 22import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
@@ -75,7 +74,7 @@ export {
75// --------------------------------------------------------------------------- 74// ---------------------------------------------------------------------------
76 75
77async function listBlockedAccounts (req: express.Request, res: express.Response) { 76async function listBlockedAccounts (req: express.Request, res: express.Response) {
78 const user: UserModel = res.locals.oauth.token.User 77 const user = res.locals.oauth.token.User
79 78
80 const resultList = await AccountBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort) 79 const resultList = await AccountBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort)
81 80
@@ -83,8 +82,8 @@ async function listBlockedAccounts (req: express.Request, res: express.Response)
83} 82}
84 83
85async function blockAccount (req: express.Request, res: express.Response) { 84async function blockAccount (req: express.Request, res: express.Response) {
86 const user: UserModel = res.locals.oauth.token.User 85 const user = res.locals.oauth.token.User
87 const accountToBlock: AccountModel = res.locals.account 86 const accountToBlock = res.locals.account
88 87
89 await addAccountInBlocklist(user.Account.id, accountToBlock.id) 88 await addAccountInBlocklist(user.Account.id, accountToBlock.id)
90 89
@@ -92,7 +91,7 @@ async function blockAccount (req: express.Request, res: express.Response) {
92} 91}
93 92
94async function unblockAccount (req: express.Request, res: express.Response) { 93async function unblockAccount (req: express.Request, res: express.Response) {
95 const accountBlock: AccountBlocklistModel = res.locals.accountBlock 94 const accountBlock = res.locals.accountBlock
96 95
97 await removeAccountFromBlocklist(accountBlock) 96 await removeAccountFromBlocklist(accountBlock)
98 97
@@ -100,7 +99,7 @@ async function unblockAccount (req: express.Request, res: express.Response) {
100} 99}
101 100
102async function listBlockedServers (req: express.Request, res: express.Response) { 101async function listBlockedServers (req: express.Request, res: express.Response) {
103 const user: UserModel = res.locals.oauth.token.User 102 const user = res.locals.oauth.token.User
104 103
105 const resultList = await ServerBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort) 104 const resultList = await ServerBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort)
106 105
@@ -108,8 +107,8 @@ async function listBlockedServers (req: express.Request, res: express.Response)
108} 107}
109 108
110async function blockServer (req: express.Request, res: express.Response) { 109async function blockServer (req: express.Request, res: express.Response) {
111 const user: UserModel = res.locals.oauth.token.User 110 const user = res.locals.oauth.token.User
112 const serverToBlock: ServerModel = res.locals.server 111 const serverToBlock = res.locals.server
113 112
114 await addServerInBlocklist(user.Account.id, serverToBlock.id) 113 await addServerInBlocklist(user.Account.id, serverToBlock.id)
115 114
@@ -117,7 +116,7 @@ async function blockServer (req: express.Request, res: express.Response) {
117} 116}
118 117
119async function unblockServer (req: express.Request, res: express.Response) { 118async function unblockServer (req: express.Request, res: express.Response) {
120 const serverBlock: ServerBlocklistModel = res.locals.serverBlock 119 const serverBlock = res.locals.serverBlock
121 120
122 await removeServerFromBlocklist(serverBlock) 121 await removeServerFromBlocklist(serverBlock)
123 122
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts
index 6cd782c47..b30d3aec2 100644
--- a/server/controllers/api/users/my-history.ts
+++ b/server/controllers/api/users/my-history.ts
@@ -36,7 +36,7 @@ export {
36// --------------------------------------------------------------------------- 36// ---------------------------------------------------------------------------
37 37
38async function listMyVideosHistory (req: express.Request, res: express.Response) { 38async function listMyVideosHistory (req: express.Request, res: express.Response) {
39 const user: UserModel = res.locals.oauth.token.User 39 const user = res.locals.oauth.token.User
40 40
41 const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count) 41 const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count)
42 42
@@ -44,7 +44,7 @@ async function listMyVideosHistory (req: express.Request, res: express.Response)
44} 44}
45 45
46async function removeUserHistory (req: express.Request, res: express.Response) { 46async function removeUserHistory (req: express.Request, res: express.Response) {
47 const user: UserModel = res.locals.oauth.token.User 47 const user = res.locals.oauth.token.User
48 const beforeDate = req.body.beforeDate || null 48 const beforeDate = req.body.beforeDate || null
49 49
50 await sequelizeTypescript.transaction(t => { 50 await sequelizeTypescript.transaction(t => {
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts
index 76cf97587..bbafda5a6 100644
--- a/server/controllers/api/users/my-notifications.ts
+++ b/server/controllers/api/users/my-notifications.ts
@@ -9,7 +9,6 @@ import {
9 setDefaultSort, 9 setDefaultSort,
10 userNotificationsSortValidator 10 userNotificationsSortValidator
11} from '../../../middlewares' 11} from '../../../middlewares'
12import { UserModel } from '../../../models/account/user'
13import { getFormattedObjects } from '../../../helpers/utils' 12import { getFormattedObjects } from '../../../helpers/utils'
14import { UserNotificationModel } from '../../../models/account/user-notification' 13import { UserNotificationModel } from '../../../models/account/user-notification'
15import { meRouter } from './me' 14import { meRouter } from './me'
@@ -57,8 +56,8 @@ export {
57// --------------------------------------------------------------------------- 56// ---------------------------------------------------------------------------
58 57
59async function updateNotificationSettings (req: express.Request, res: express.Response) { 58async function updateNotificationSettings (req: express.Request, res: express.Response) {
60 const user: UserModel = res.locals.oauth.token.User 59 const user = res.locals.oauth.token.User
61 const body = req.body 60 const body = req.body as UserNotificationSetting
62 61
63 const query = { 62 const query = {
64 where: { 63 where: {
@@ -84,7 +83,7 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
84} 83}
85 84
86async function listUserNotifications (req: express.Request, res: express.Response) { 85async function listUserNotifications (req: express.Request, res: express.Response) {
87 const user: UserModel = res.locals.oauth.token.User 86 const user = res.locals.oauth.token.User
88 87
89 const resultList = await UserNotificationModel.listForApi(user.id, req.query.start, req.query.count, req.query.sort, req.query.unread) 88 const resultList = await UserNotificationModel.listForApi(user.id, req.query.start, req.query.count, req.query.sort, req.query.unread)
90 89
@@ -92,7 +91,7 @@ async function listUserNotifications (req: express.Request, res: express.Respons
92} 91}
93 92
94async function markAsReadUserNotifications (req: express.Request, res: express.Response) { 93async function markAsReadUserNotifications (req: express.Request, res: express.Response) {
95 const user: UserModel = res.locals.oauth.token.User 94 const user = res.locals.oauth.token.User
96 95
97 await UserNotificationModel.markAsRead(user.id, req.body.ids) 96 await UserNotificationModel.markAsRead(user.id, req.body.ids)
98 97
@@ -100,7 +99,7 @@ async function markAsReadUserNotifications (req: express.Request, res: express.R
100} 99}
101 100
102async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) { 101async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) {
103 const user: UserModel = res.locals.oauth.token.User 102 const user = res.locals.oauth.token.User
104 103
105 await UserNotificationModel.markAllAsRead(user.id) 104 await UserNotificationModel.markAllAsRead(user.id)
106 105
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts
index accca6d52..a173adfd0 100644
--- a/server/controllers/api/users/my-subscriptions.ts
+++ b/server/controllers/api/users/my-subscriptions.ts
@@ -14,7 +14,6 @@ import {
14 userSubscriptionGetValidator 14 userSubscriptionGetValidator
15} from '../../../middlewares' 15} from '../../../middlewares'
16import { areSubscriptionsExistValidator, userSubscriptionsSortValidator, videosSortValidator } from '../../../middlewares/validators' 16import { areSubscriptionsExistValidator, userSubscriptionsSortValidator, videosSortValidator } from '../../../middlewares/validators'
17import { UserModel } from '../../../models/account/user'
18import { VideoModel } from '../../../models/video/video' 17import { VideoModel } from '../../../models/video/video'
19import { buildNSFWFilter } from '../../../helpers/express-utils' 18import { buildNSFWFilter } from '../../../helpers/express-utils'
20import { VideoFilter } from '../../../../shared/models/videos/video-query.type' 19import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
@@ -77,7 +76,7 @@ export {
77 76
78async function areSubscriptionsExist (req: express.Request, res: express.Response) { 77async function areSubscriptionsExist (req: express.Request, res: express.Response) {
79 const uris = req.query.uris as string[] 78 const uris = req.query.uris as string[]
80 const user = res.locals.oauth.token.User as UserModel 79 const user = res.locals.oauth.token.User
81 80
82 const handles = uris.map(u => { 81 const handles = uris.map(u => {
83 let [ name, host ] = u.split('@') 82 let [ name, host ] = u.split('@')
@@ -107,7 +106,7 @@ async function areSubscriptionsExist (req: express.Request, res: express.Respons
107} 106}
108 107
109async function addUserSubscription (req: express.Request, res: express.Response) { 108async function addUserSubscription (req: express.Request, res: express.Response) {
110 const user = res.locals.oauth.token.User as UserModel 109 const user = res.locals.oauth.token.User
111 const [ name, host ] = req.body.uri.split('@') 110 const [ name, host ] = req.body.uri.split('@')
112 111
113 const payload = { 112 const payload = {
@@ -123,13 +122,13 @@ async function addUserSubscription (req: express.Request, res: express.Response)
123} 122}
124 123
125function getUserSubscription (req: express.Request, res: express.Response) { 124function getUserSubscription (req: express.Request, res: express.Response) {
126 const subscription: ActorFollowModel = res.locals.subscription 125 const subscription = res.locals.subscription
127 126
128 return res.json(subscription.ActorFollowing.VideoChannel.toFormattedJSON()) 127 return res.json(subscription.ActorFollowing.VideoChannel.toFormattedJSON())
129} 128}
130 129
131async function deleteUserSubscription (req: express.Request, res: express.Response) { 130async function deleteUserSubscription (req: express.Request, res: express.Response) {
132 const subscription: ActorFollowModel = res.locals.subscription 131 const subscription = res.locals.subscription
133 132
134 await sequelizeTypescript.transaction(async t => { 133 await sequelizeTypescript.transaction(async t => {
135 return subscription.destroy({ transaction: t }) 134 return subscription.destroy({ transaction: t })
@@ -139,7 +138,7 @@ async function deleteUserSubscription (req: express.Request, res: express.Respon
139} 138}
140 139
141async function getUserSubscriptions (req: express.Request, res: express.Response) { 140async function getUserSubscriptions (req: express.Request, res: express.Response) {
142 const user = res.locals.oauth.token.User as UserModel 141 const user = res.locals.oauth.token.User
143 const actorId = user.Account.Actor.id 142 const actorId = user.Account.Actor.id
144 143
145 const resultList = await ActorFollowModel.listSubscriptionsForApi(actorId, req.query.start, req.query.count, req.query.sort) 144 const resultList = await ActorFollowModel.listSubscriptionsForApi(actorId, req.query.start, req.query.count, req.query.sort)
@@ -147,8 +146,8 @@ async function getUserSubscriptions (req: express.Request, res: express.Response
147 return res.json(getFormattedObjects(resultList.data, resultList.total)) 146 return res.json(getFormattedObjects(resultList.data, resultList.total))
148} 147}
149 148
150async function getUserSubscriptionVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 149async function getUserSubscriptionVideos (req: express.Request, res: express.Response) {
151 const user = res.locals.oauth.token.User as UserModel 150 const user = res.locals.oauth.token.User
152 const resultList = await VideoModel.listForApi({ 151 const resultList = await VideoModel.listForApi({
153 start: req.query.start, 152 start: req.query.start,
154 count: req.query.count, 153 count: req.query.count,
diff --git a/server/controllers/api/users/my-video-playlists.ts b/server/controllers/api/users/my-video-playlists.ts
index 42da02bff..15e92f4f3 100644
--- a/server/controllers/api/users/my-video-playlists.ts
+++ b/server/controllers/api/users/my-video-playlists.ts
@@ -1,6 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware, authenticate } from '../../../middlewares' 2import { asyncMiddleware, authenticate } from '../../../middlewares'
3import { UserModel } from '../../../models/account/user'
4import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists' 3import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'
5import { VideoPlaylistModel } from '../../../models/video/video-playlist' 4import { VideoPlaylistModel } from '../../../models/video/video-playlist'
6import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' 5import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
@@ -23,7 +22,7 @@ export {
23 22
24async function doVideosInPlaylistExist (req: express.Request, res: express.Response) { 23async function doVideosInPlaylistExist (req: express.Request, res: express.Response) {
25 const videoIds = req.query.videoIds.map(i => parseInt(i + '', 10)) 24 const videoIds = req.query.videoIds.map(i => parseInt(i + '', 10))
26 const user = res.locals.oauth.token.User as UserModel 25 const user = res.locals.oauth.token.User
27 26
28 const results = await VideoPlaylistModel.listPlaylistIdsOf(user.Account.id, videoIds) 27 const results = await VideoPlaylistModel.listPlaylistIdsOf(user.Account.id, videoIds)
29 28