Fix: only local channels.
This commit is contained in:
parent
a25c4822fa
commit
cb6decfa84
@ -54,7 +54,11 @@ interface ChannelInfos {
|
||||
ownerAccountId: number
|
||||
}
|
||||
|
||||
async function getChannelInfosById (options: RegisterServerOptions, channelId: number): Promise<ChannelInfos | null> {
|
||||
async function getChannelInfosById (
|
||||
options: RegisterServerOptions,
|
||||
channelId: number,
|
||||
restrictToLocalChannels: boolean = false
|
||||
): Promise<ChannelInfos | null> {
|
||||
if (!channelId) {
|
||||
throw new Error('Missing channelId')
|
||||
}
|
||||
@ -69,7 +73,11 @@ async function getChannelInfosById (options: RegisterServerOptions, channelId: n
|
||||
' "videoChannel"."accountId" as "ownerAccountId"' +
|
||||
' FROM "videoChannel"' +
|
||||
' RIGHT JOIN "actor" ON "actor"."id" = "videoChannel"."actorId"' +
|
||||
' WHERE "videoChannel"."id" = ' + channelId.toString()
|
||||
' WHERE "videoChannel"."id" = ' + channelId.toString() +
|
||||
(restrictToLocalChannels
|
||||
? ' AND "serverId" is null '
|
||||
: ''
|
||||
)
|
||||
)
|
||||
if (!Array.isArray(results)) {
|
||||
throw new Error('getChannelInfosById: query result is not an array.')
|
||||
|
@ -19,7 +19,7 @@ async function initModerationApiRouter (options: RegisterServerOptions): Promise
|
||||
return
|
||||
}
|
||||
|
||||
const channelInfos = await getChannelInfosById(options, parseInt(channelId))
|
||||
const channelInfos = await getChannelInfosById(options, parseInt(channelId), true)
|
||||
if (!channelInfos) {
|
||||
logger.warn(`Channel ${channelId} not found`)
|
||||
res.sendStatus(404)
|
||||
|
Loading…
x
Reference in New Issue
Block a user