diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-05 14:36:05 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-05 14:36:05 +0100 |
commit | 4e74e8032be8293ffe3cb3c30528d4ef7c11a798 (patch) | |
tree | 71e75e137720f2cebc33dbc67076778b77e3db5e | |
parent | ddb83e49ece4e76df1af98aeea30c1d8d133f48c (diff) | |
download | PeerTube-4e74e8032be8293ffe3cb3c30528d4ef7c11a798.tar.gz PeerTube-4e74e8032be8293ffe3cb3c30528d4ef7c11a798.tar.zst PeerTube-4e74e8032be8293ffe3cb3c30528d4ef7c11a798.zip |
Remove inferred type
-rw-r--r-- | client/src/app/shared/moderation/user-moderation-dropdown.component.ts | 44 | ||||
-rw-r--r-- | server/controllers/api/accounts.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/users/me.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/video-channel.ts | 4 | ||||
-rw-r--r-- | server/models/video/video.ts | 20 |
5 files changed, 37 insertions, 37 deletions
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts index d391246e0..e3c9db923 100644 --- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts | |||
@@ -277,18 +277,18 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
277 | }, | 277 | }, |
278 | { | 278 | { |
279 | label: this.i18n('Ban'), | 279 | label: this.i18n('Ban'), |
280 | handler: ({ user }: { user: User }) => this.openBanUserModal(user), | 280 | handler: ({ user }) => this.openBanUserModal(user), |
281 | isDisplayed: ({ user }: { user: User }) => !user.blocked | 281 | isDisplayed: ({ user }) => !user.blocked |
282 | }, | 282 | }, |
283 | { | 283 | { |
284 | label: this.i18n('Unban'), | 284 | label: this.i18n('Unban'), |
285 | handler: ({ user }: { user: User }) => this.unbanUser(user), | 285 | handler: ({ user }) => this.unbanUser(user), |
286 | isDisplayed: ({ user }: { user: User }) => user.blocked | 286 | isDisplayed: ({ user }) => user.blocked |
287 | }, | 287 | }, |
288 | { | 288 | { |
289 | label: this.i18n('Set Email as Verified'), | 289 | label: this.i18n('Set Email as Verified'), |
290 | handler: ({ user }: { user: User }) => this.setEmailAsVerified(user), | 290 | handler: ({ user }) => this.setEmailAsVerified(user), |
291 | isDisplayed: ({ user }: { user: User }) => this.requiresEmailVerification && !user.blocked && user.emailVerified === false | 291 | isDisplayed: ({ user }) => this.requiresEmailVerification && !user.blocked && user.emailVerified === false |
292 | } | 292 | } |
293 | ]) | 293 | ]) |
294 | } | 294 | } |
@@ -299,23 +299,23 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
299 | this.userActions.push([ | 299 | this.userActions.push([ |
300 | { | 300 | { |
301 | label: this.i18n('Mute this account'), | 301 | label: this.i18n('Mute this account'), |
302 | isDisplayed: ({ account }: { account: Account }) => account.mutedByUser === false, | 302 | isDisplayed: ({ account }) => account.mutedByUser === false, |
303 | handler: ({ account }: { account: Account }) => this.blockAccountByUser(account) | 303 | handler: ({ account }) => this.blockAccountByUser(account) |
304 | }, | 304 | }, |
305 | { | 305 | { |
306 | label: this.i18n('Unmute this account'), | 306 | label: this.i18n('Unmute this account'), |
307 | isDisplayed: ({ account }: { account: Account }) => account.mutedByUser === true, | 307 | isDisplayed: ({ account }) => account.mutedByUser === true, |
308 | handler: ({ account }: { account: Account }) => this.unblockAccountByUser(account) | 308 | handler: ({ account }) => this.unblockAccountByUser(account) |
309 | }, | 309 | }, |
310 | { | 310 | { |
311 | label: this.i18n('Mute the instance'), | 311 | label: this.i18n('Mute the instance'), |
312 | isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === false, | 312 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false, |
313 | handler: ({ account }: { account: Account }) => this.blockServerByUser(account.host) | 313 | handler: ({ account }) => this.blockServerByUser(account.host) |
314 | }, | 314 | }, |
315 | { | 315 | { |
316 | label: this.i18n('Unmute the instance'), | 316 | label: this.i18n('Unmute the instance'), |
317 | isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === true, | 317 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true, |
318 | handler: ({ account }: { account: Account }) => this.unblockServerByUser(account.host) | 318 | handler: ({ account }) => this.unblockServerByUser(account.host) |
319 | } | 319 | } |
320 | ]) | 320 | ]) |
321 | 321 | ||
@@ -326,13 +326,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
326 | instanceActions = instanceActions.concat([ | 326 | instanceActions = instanceActions.concat([ |
327 | { | 327 | { |
328 | label: this.i18n('Mute this account by your instance'), | 328 | label: this.i18n('Mute this account by your instance'), |
329 | isDisplayed: ({ account }: { account: Account }) => account.mutedByInstance === false, | 329 | isDisplayed: ({ account }) => account.mutedByInstance === false, |
330 | handler: ({ account }: { account: Account }) => this.blockAccountByInstance(account) | 330 | handler: ({ account }) => this.blockAccountByInstance(account) |
331 | }, | 331 | }, |
332 | { | 332 | { |
333 | label: this.i18n('Unmute this account by your instance'), | 333 | label: this.i18n('Unmute this account by your instance'), |
334 | isDisplayed: ({ account }: { account: Account }) => account.mutedByInstance === true, | 334 | isDisplayed: ({ account }) => account.mutedByInstance === true, |
335 | handler: ({ account }: { account: Account }) => this.unblockAccountByInstance(account) | 335 | handler: ({ account }) => this.unblockAccountByInstance(account) |
336 | } | 336 | } |
337 | ]) | 337 | ]) |
338 | } | 338 | } |
@@ -342,13 +342,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
342 | instanceActions = instanceActions.concat([ | 342 | instanceActions = instanceActions.concat([ |
343 | { | 343 | { |
344 | label: this.i18n('Mute the instance by your instance'), | 344 | label: this.i18n('Mute the instance by your instance'), |
345 | isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === false, | 345 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false, |
346 | handler: ({ account }: { account: Account }) => this.blockServerByInstance(account.host) | 346 | handler: ({ account }) => this.blockServerByInstance(account.host) |
347 | }, | 347 | }, |
348 | { | 348 | { |
349 | label: this.i18n('Unmute the instance by your instance'), | 349 | label: this.i18n('Unmute the instance by your instance'), |
350 | isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === true, | 350 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true, |
351 | handler: ({ account }: { account: Account }) => this.unblockServerByInstance(account.host) | 351 | handler: ({ account }) => this.unblockServerByInstance(account.host) |
352 | } | 352 | } |
353 | ]) | 353 | ]) |
354 | } | 354 | } |
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index 86ef2aed1..a69a83acf 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts | |||
@@ -74,10 +74,10 @@ async function listVideoAccountChannels (req: express.Request, res: express.Resp | |||
74 | 74 | ||
75 | async function listAccountVideos (req: express.Request, res: express.Response, next: express.NextFunction) { | 75 | async function listAccountVideos (req: express.Request, res: express.Response, next: express.NextFunction) { |
76 | const account: AccountModel = res.locals.account | 76 | const account: AccountModel = res.locals.account |
77 | const actorId = isUserAbleToSearchRemoteURI(res) ? null : undefined | 77 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined |
78 | 78 | ||
79 | const resultList = await VideoModel.listForApi({ | 79 | const resultList = await VideoModel.listForApi({ |
80 | actorId, | 80 | followerActorId, |
81 | start: req.query.start, | 81 | start: req.query.start, |
82 | count: req.query.count, | 82 | count: req.query.count, |
83 | sort: req.query.sort, | 83 | sort: req.query.sort, |
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index 47f2c9ec7..d2456346b 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts | |||
@@ -238,7 +238,7 @@ async function getUserSubscriptionVideos (req: express.Request, res: express.Res | |||
238 | nsfw: buildNSFWFilter(res, req.query.nsfw), | 238 | nsfw: buildNSFWFilter(res, req.query.nsfw), |
239 | filter: req.query.filter as VideoFilter, | 239 | filter: req.query.filter as VideoFilter, |
240 | withFiles: false, | 240 | withFiles: false, |
241 | actorId: user.Account.Actor.id, | 241 | followerActorId: user.Account.Actor.id, |
242 | user | 242 | user |
243 | }) | 243 | }) |
244 | 244 | ||
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 63240dfa1..fd143a139 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -202,10 +202,10 @@ async function getVideoChannel (req: express.Request, res: express.Response, nex | |||
202 | 202 | ||
203 | async function listVideoChannelVideos (req: express.Request, res: express.Response, next: express.NextFunction) { | 203 | async function listVideoChannelVideos (req: express.Request, res: express.Response, next: express.NextFunction) { |
204 | const videoChannelInstance: VideoChannelModel = res.locals.videoChannel | 204 | const videoChannelInstance: VideoChannelModel = res.locals.videoChannel |
205 | const actorId = isUserAbleToSearchRemoteURI(res) ? null : undefined | 205 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined |
206 | 206 | ||
207 | const resultList = await VideoModel.listForApi({ | 207 | const resultList = await VideoModel.listForApi({ |
208 | actorId, | 208 | followerActorId, |
209 | start: req.query.start, | 209 | start: req.query.start, |
210 | count: req.query.count, | 210 | count: req.query.count, |
211 | sort: req.query.sort, | 211 | sort: req.query.sort, |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index e8cb5aa88..adef37937 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -140,7 +140,7 @@ type ForAPIOptions = { | |||
140 | 140 | ||
141 | type AvailableForListIDsOptions = { | 141 | type AvailableForListIDsOptions = { |
142 | serverAccountId: number | 142 | serverAccountId: number |
143 | actorId: number | 143 | followerActorId: number |
144 | includeLocalVideos: boolean | 144 | includeLocalVideos: boolean |
145 | filter?: VideoFilter | 145 | filter?: VideoFilter |
146 | categoryOneOf?: number[] | 146 | categoryOneOf?: number[] |
@@ -315,7 +315,7 @@ type AvailableForListIDsOptions = { | |||
315 | query.include.push(videoChannelInclude) | 315 | query.include.push(videoChannelInclude) |
316 | } | 316 | } |
317 | 317 | ||
318 | if (options.actorId) { | 318 | if (options.followerActorId) { |
319 | let localVideosReq = '' | 319 | let localVideosReq = '' |
320 | if (options.includeLocalVideos === true) { | 320 | if (options.includeLocalVideos === true) { |
321 | localVideosReq = ' UNION ALL ' + | 321 | localVideosReq = ' UNION ALL ' + |
@@ -327,7 +327,7 @@ type AvailableForListIDsOptions = { | |||
327 | } | 327 | } |
328 | 328 | ||
329 | // Force actorId to be a number to avoid SQL injections | 329 | // Force actorId to be a number to avoid SQL injections |
330 | const actorIdNumber = parseInt(options.actorId.toString(), 10) | 330 | const actorIdNumber = parseInt(options.followerActorId.toString(), 10) |
331 | query.where[ 'id' ][ Sequelize.Op.and ].push({ | 331 | query.where[ 'id' ][ Sequelize.Op.and ].push({ |
332 | [ Sequelize.Op.in ]: Sequelize.literal( | 332 | [ Sequelize.Op.in ]: Sequelize.literal( |
333 | '(' + | 333 | '(' + |
@@ -985,7 +985,7 @@ export class VideoModel extends Model<VideoModel> { | |||
985 | filter?: VideoFilter, | 985 | filter?: VideoFilter, |
986 | accountId?: number, | 986 | accountId?: number, |
987 | videoChannelId?: number, | 987 | videoChannelId?: number, |
988 | actorId?: number | 988 | followerActorId?: number |
989 | trendingDays?: number, | 989 | trendingDays?: number, |
990 | user?: UserModel | 990 | user?: UserModel |
991 | }, countVideos = true) { | 991 | }, countVideos = true) { |
@@ -1008,11 +1008,11 @@ export class VideoModel extends Model<VideoModel> { | |||
1008 | 1008 | ||
1009 | const serverActor = await getServerActor() | 1009 | const serverActor = await getServerActor() |
1010 | 1010 | ||
1011 | // actorId === null has a meaning, so just check undefined | 1011 | // followerActorId === null has a meaning, so just check undefined |
1012 | const actorId = options.actorId !== undefined ? options.actorId : serverActor.id | 1012 | const followerActorId = options.followerActorId !== undefined ? options.followerActorId : serverActor.id |
1013 | 1013 | ||
1014 | const queryOptions = { | 1014 | const queryOptions = { |
1015 | actorId, | 1015 | followerActorId, |
1016 | serverAccountId: serverActor.Account.id, | 1016 | serverAccountId: serverActor.Account.id, |
1017 | nsfw: options.nsfw, | 1017 | nsfw: options.nsfw, |
1018 | categoryOneOf: options.categoryOneOf, | 1018 | categoryOneOf: options.categoryOneOf, |
@@ -1118,7 +1118,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1118 | 1118 | ||
1119 | const serverActor = await getServerActor() | 1119 | const serverActor = await getServerActor() |
1120 | const queryOptions = { | 1120 | const queryOptions = { |
1121 | actorId: serverActor.id, | 1121 | followerActorId: serverActor.id, |
1122 | serverAccountId: serverActor.Account.id, | 1122 | serverAccountId: serverActor.Account.id, |
1123 | includeLocalVideos: options.includeLocalVideos, | 1123 | includeLocalVideos: options.includeLocalVideos, |
1124 | nsfw: options.nsfw, | 1124 | nsfw: options.nsfw, |
@@ -1273,11 +1273,11 @@ export class VideoModel extends Model<VideoModel> { | |||
1273 | // threshold corresponds to how many video the field should have to be returned | 1273 | // threshold corresponds to how many video the field should have to be returned |
1274 | static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) { | 1274 | static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) { |
1275 | const serverActor = await getServerActor() | 1275 | const serverActor = await getServerActor() |
1276 | const actorId = serverActor.id | 1276 | const followerActorId = serverActor.id |
1277 | 1277 | ||
1278 | const scopeOptions: AvailableForListIDsOptions = { | 1278 | const scopeOptions: AvailableForListIDsOptions = { |
1279 | serverAccountId: serverActor.Account.id, | 1279 | serverAccountId: serverActor.Account.id, |
1280 | actorId, | 1280 | followerActorId, |
1281 | includeLocalVideos: true | 1281 | includeLocalVideos: true |
1282 | } | 1282 | } |
1283 | 1283 | ||