Fix thread replies API response

pull/3759/head
Chocobozzz 2021-02-19 10:52:31 +01:00
parent 285981f4dd
commit 2a021e6cb6
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 17 additions and 13 deletions

View File

@ -166,8 +166,6 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo
} }
} }
logger.info('coucou', { resultList })
if (resultList.data.length === 0) { if (resultList.data.length === 0) {
return res.sendStatus(HttpStatusCode.NOT_FOUND_404) return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
} }

View File

@ -483,20 +483,26 @@ export class VideoCommentModel extends Model {
order: [ [ 'createdAt', 'ASC' ], [ 'updatedAt', 'ASC' ] ] as Order, order: [ [ 'createdAt', 'ASC' ], [ 'updatedAt', 'ASC' ] ] as Order,
where: { where: {
videoId, videoId,
[Op.or]: [ [Op.and]: [
{ id: threadId },
{ originCommentId: threadId }
],
[Op.or]: [
{ {
accountId: { [Op.or]: [
[Op.notIn]: Sequelize.literal( { id: threadId },
'(' + buildBlockedAccountSQL(blockerAccountIds) + ')' { originCommentId: threadId }
) ]
}
}, },
{ {
accountId: null [Op.or]: [
{
accountId: {
[Op.notIn]: Sequelize.literal(
'(' + buildBlockedAccountSQL(blockerAccountIds) + ')'
)
}
},
{
accountId: null
}
]
} }
] ]
} }