mirror of https://github.com/Chocobozzz/PeerTube
Remove inferred type
parent
ddb83e49ec
commit
4e74e8032b
|
@ -277,18 +277,18 @@ export class UserModerationDropdownComponent implements OnChanges {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Ban'),
|
label: this.i18n('Ban'),
|
||||||
handler: ({ user }: { user: User }) => this.openBanUserModal(user),
|
handler: ({ user }) => this.openBanUserModal(user),
|
||||||
isDisplayed: ({ user }: { user: User }) => !user.blocked
|
isDisplayed: ({ user }) => !user.blocked
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Unban'),
|
label: this.i18n('Unban'),
|
||||||
handler: ({ user }: { user: User }) => this.unbanUser(user),
|
handler: ({ user }) => this.unbanUser(user),
|
||||||
isDisplayed: ({ user }: { user: User }) => user.blocked
|
isDisplayed: ({ user }) => user.blocked
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Set Email as Verified'),
|
label: this.i18n('Set Email as Verified'),
|
||||||
handler: ({ user }: { user: User }) => this.setEmailAsVerified(user),
|
handler: ({ user }) => this.setEmailAsVerified(user),
|
||||||
isDisplayed: ({ user }: { user: User }) => this.requiresEmailVerification && !user.blocked && user.emailVerified === false
|
isDisplayed: ({ user }) => this.requiresEmailVerification && !user.blocked && user.emailVerified === false
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -299,23 +299,23 @@ export class UserModerationDropdownComponent implements OnChanges {
|
||||||
this.userActions.push([
|
this.userActions.push([
|
||||||
{
|
{
|
||||||
label: this.i18n('Mute this account'),
|
label: this.i18n('Mute this account'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => account.mutedByUser === false,
|
isDisplayed: ({ account }) => account.mutedByUser === false,
|
||||||
handler: ({ account }: { account: Account }) => this.blockAccountByUser(account)
|
handler: ({ account }) => this.blockAccountByUser(account)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Unmute this account'),
|
label: this.i18n('Unmute this account'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => account.mutedByUser === true,
|
isDisplayed: ({ account }) => account.mutedByUser === true,
|
||||||
handler: ({ account }: { account: Account }) => this.unblockAccountByUser(account)
|
handler: ({ account }) => this.unblockAccountByUser(account)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Mute the instance'),
|
label: this.i18n('Mute the instance'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === false,
|
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false,
|
||||||
handler: ({ account }: { account: Account }) => this.blockServerByUser(account.host)
|
handler: ({ account }) => this.blockServerByUser(account.host)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Unmute the instance'),
|
label: this.i18n('Unmute the instance'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === true,
|
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true,
|
||||||
handler: ({ account }: { account: Account }) => this.unblockServerByUser(account.host)
|
handler: ({ account }) => this.unblockServerByUser(account.host)
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -326,13 +326,13 @@ export class UserModerationDropdownComponent implements OnChanges {
|
||||||
instanceActions = instanceActions.concat([
|
instanceActions = instanceActions.concat([
|
||||||
{
|
{
|
||||||
label: this.i18n('Mute this account by your instance'),
|
label: this.i18n('Mute this account by your instance'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => account.mutedByInstance === false,
|
isDisplayed: ({ account }) => account.mutedByInstance === false,
|
||||||
handler: ({ account }: { account: Account }) => this.blockAccountByInstance(account)
|
handler: ({ account }) => this.blockAccountByInstance(account)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Unmute this account by your instance'),
|
label: this.i18n('Unmute this account by your instance'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => account.mutedByInstance === true,
|
isDisplayed: ({ account }) => account.mutedByInstance === true,
|
||||||
handler: ({ account }: { account: Account }) => this.unblockAccountByInstance(account)
|
handler: ({ account }) => this.unblockAccountByInstance(account)
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -342,13 +342,13 @@ export class UserModerationDropdownComponent implements OnChanges {
|
||||||
instanceActions = instanceActions.concat([
|
instanceActions = instanceActions.concat([
|
||||||
{
|
{
|
||||||
label: this.i18n('Mute the instance by your instance'),
|
label: this.i18n('Mute the instance by your instance'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === false,
|
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false,
|
||||||
handler: ({ account }: { account: Account }) => this.blockServerByInstance(account.host)
|
handler: ({ account }) => this.blockServerByInstance(account.host)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18n('Unmute the instance by your instance'),
|
label: this.i18n('Unmute the instance by your instance'),
|
||||||
isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === true,
|
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true,
|
||||||
handler: ({ account }: { account: Account }) => this.unblockServerByInstance(account.host)
|
handler: ({ account }) => this.unblockServerByInstance(account.host)
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,10 +74,10 @@ async function listVideoAccountChannels (req: express.Request, res: express.Resp
|
||||||
|
|
||||||
async function listAccountVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
|
async function listAccountVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
const account: AccountModel = res.locals.account
|
const account: AccountModel = res.locals.account
|
||||||
const actorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
||||||
|
|
||||||
const resultList = await VideoModel.listForApi({
|
const resultList = await VideoModel.listForApi({
|
||||||
actorId,
|
followerActorId,
|
||||||
start: req.query.start,
|
start: req.query.start,
|
||||||
count: req.query.count,
|
count: req.query.count,
|
||||||
sort: req.query.sort,
|
sort: req.query.sort,
|
||||||
|
|
|
@ -238,7 +238,7 @@ async function getUserSubscriptionVideos (req: express.Request, res: express.Res
|
||||||
nsfw: buildNSFWFilter(res, req.query.nsfw),
|
nsfw: buildNSFWFilter(res, req.query.nsfw),
|
||||||
filter: req.query.filter as VideoFilter,
|
filter: req.query.filter as VideoFilter,
|
||||||
withFiles: false,
|
withFiles: false,
|
||||||
actorId: user.Account.Actor.id,
|
followerActorId: user.Account.Actor.id,
|
||||||
user
|
user
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -202,10 +202,10 @@ async function getVideoChannel (req: express.Request, res: express.Response, nex
|
||||||
|
|
||||||
async function listVideoChannelVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
|
async function listVideoChannelVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
const videoChannelInstance: VideoChannelModel = res.locals.videoChannel
|
const videoChannelInstance: VideoChannelModel = res.locals.videoChannel
|
||||||
const actorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
||||||
|
|
||||||
const resultList = await VideoModel.listForApi({
|
const resultList = await VideoModel.listForApi({
|
||||||
actorId,
|
followerActorId,
|
||||||
start: req.query.start,
|
start: req.query.start,
|
||||||
count: req.query.count,
|
count: req.query.count,
|
||||||
sort: req.query.sort,
|
sort: req.query.sort,
|
||||||
|
|
|
@ -140,7 +140,7 @@ type ForAPIOptions = {
|
||||||
|
|
||||||
type AvailableForListIDsOptions = {
|
type AvailableForListIDsOptions = {
|
||||||
serverAccountId: number
|
serverAccountId: number
|
||||||
actorId: number
|
followerActorId: number
|
||||||
includeLocalVideos: boolean
|
includeLocalVideos: boolean
|
||||||
filter?: VideoFilter
|
filter?: VideoFilter
|
||||||
categoryOneOf?: number[]
|
categoryOneOf?: number[]
|
||||||
|
@ -315,7 +315,7 @@ type AvailableForListIDsOptions = {
|
||||||
query.include.push(videoChannelInclude)
|
query.include.push(videoChannelInclude)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.actorId) {
|
if (options.followerActorId) {
|
||||||
let localVideosReq = ''
|
let localVideosReq = ''
|
||||||
if (options.includeLocalVideos === true) {
|
if (options.includeLocalVideos === true) {
|
||||||
localVideosReq = ' UNION ALL ' +
|
localVideosReq = ' UNION ALL ' +
|
||||||
|
@ -327,7 +327,7 @@ type AvailableForListIDsOptions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force actorId to be a number to avoid SQL injections
|
// Force actorId to be a number to avoid SQL injections
|
||||||
const actorIdNumber = parseInt(options.actorId.toString(), 10)
|
const actorIdNumber = parseInt(options.followerActorId.toString(), 10)
|
||||||
query.where[ 'id' ][ Sequelize.Op.and ].push({
|
query.where[ 'id' ][ Sequelize.Op.and ].push({
|
||||||
[ Sequelize.Op.in ]: Sequelize.literal(
|
[ Sequelize.Op.in ]: Sequelize.literal(
|
||||||
'(' +
|
'(' +
|
||||||
|
@ -985,7 +985,7 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
filter?: VideoFilter,
|
filter?: VideoFilter,
|
||||||
accountId?: number,
|
accountId?: number,
|
||||||
videoChannelId?: number,
|
videoChannelId?: number,
|
||||||
actorId?: number
|
followerActorId?: number
|
||||||
trendingDays?: number,
|
trendingDays?: number,
|
||||||
user?: UserModel
|
user?: UserModel
|
||||||
}, countVideos = true) {
|
}, countVideos = true) {
|
||||||
|
@ -1008,11 +1008,11 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
|
|
||||||
const serverActor = await getServerActor()
|
const serverActor = await getServerActor()
|
||||||
|
|
||||||
// actorId === null has a meaning, so just check undefined
|
// followerActorId === null has a meaning, so just check undefined
|
||||||
const actorId = options.actorId !== undefined ? options.actorId : serverActor.id
|
const followerActorId = options.followerActorId !== undefined ? options.followerActorId : serverActor.id
|
||||||
|
|
||||||
const queryOptions = {
|
const queryOptions = {
|
||||||
actorId,
|
followerActorId,
|
||||||
serverAccountId: serverActor.Account.id,
|
serverAccountId: serverActor.Account.id,
|
||||||
nsfw: options.nsfw,
|
nsfw: options.nsfw,
|
||||||
categoryOneOf: options.categoryOneOf,
|
categoryOneOf: options.categoryOneOf,
|
||||||
|
@ -1118,7 +1118,7 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
|
|
||||||
const serverActor = await getServerActor()
|
const serverActor = await getServerActor()
|
||||||
const queryOptions = {
|
const queryOptions = {
|
||||||
actorId: serverActor.id,
|
followerActorId: serverActor.id,
|
||||||
serverAccountId: serverActor.Account.id,
|
serverAccountId: serverActor.Account.id,
|
||||||
includeLocalVideos: options.includeLocalVideos,
|
includeLocalVideos: options.includeLocalVideos,
|
||||||
nsfw: options.nsfw,
|
nsfw: options.nsfw,
|
||||||
|
@ -1273,11 +1273,11 @@ export class VideoModel extends Model<VideoModel> {
|
||||||
// threshold corresponds to how many video the field should have to be returned
|
// threshold corresponds to how many video the field should have to be returned
|
||||||
static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) {
|
static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) {
|
||||||
const serverActor = await getServerActor()
|
const serverActor = await getServerActor()
|
||||||
const actorId = serverActor.id
|
const followerActorId = serverActor.id
|
||||||
|
|
||||||
const scopeOptions: AvailableForListIDsOptions = {
|
const scopeOptions: AvailableForListIDsOptions = {
|
||||||
serverAccountId: serverActor.Account.id,
|
serverAccountId: serverActor.Account.id,
|
||||||
actorId,
|
followerActorId,
|
||||||
includeLocalVideos: true
|
includeLocalVideos: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue