From e0a929179a9dc76e035ca7fda2b61d5ff46afbc5 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sun, 19 Apr 2020 14:11:40 +0200 Subject: Add filter inputs for blacklisted videos and muted accounts/servers --- server/controllers/api/server/server-blocklist.ts | 16 ++++++++++++++-- server/controllers/api/users/my-blocklist.ts | 16 ++++++++++++++-- server/controllers/api/videos/blacklist.ts | 8 +++++++- 3 files changed, 35 insertions(+), 5 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/server/server-blocklist.ts b/server/controllers/api/server/server-blocklist.ts index d165db191..ffb7814fa 100644 --- a/server/controllers/api/server/server-blocklist.ts +++ b/server/controllers/api/server/server-blocklist.ts @@ -82,7 +82,13 @@ export { async function listBlockedAccounts (req: express.Request, res: express.Response) { const serverActor = await getServerActor() - const resultList = await AccountBlocklistModel.listForApi(serverActor.Account.id, req.query.start, req.query.count, req.query.sort) + const resultList = await AccountBlocklistModel.listForApi({ + start: req.query.start, + count: req.query.count, + sort: req.query.sort, + search: req.query.search, + accountId: serverActor.Account.id + }) return res.json(getFormattedObjects(resultList.data, resultList.total)) } @@ -107,7 +113,13 @@ async function unblockAccount (req: express.Request, res: express.Response) { async function listBlockedServers (req: express.Request, res: express.Response) { const serverActor = await getServerActor() - const resultList = await ServerBlocklistModel.listForApi(serverActor.Account.id, req.query.start, req.query.count, req.query.sort) + const resultList = await ServerBlocklistModel.listForApi({ + start: req.query.start, + count: req.query.count, + sort: req.query.sort, + search: req.query.search, + accountId: serverActor.Account.id + }) return res.json(getFormattedObjects(resultList.data, resultList.total)) } diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts index 713c16022..3a44376f2 100644 --- a/server/controllers/api/users/my-blocklist.ts +++ b/server/controllers/api/users/my-blocklist.ts @@ -74,7 +74,13 @@ export { async function listBlockedAccounts (req: express.Request, res: express.Response) { const user = res.locals.oauth.token.User - const resultList = await AccountBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort) + const resultList = await AccountBlocklistModel.listForApi({ + start: req.query.start, + count: req.query.count, + sort: req.query.sort, + search: req.query.search, + accountId: user.Account.id + }) return res.json(getFormattedObjects(resultList.data, resultList.total)) } @@ -99,7 +105,13 @@ async function unblockAccount (req: express.Request, res: express.Response) { async function listBlockedServers (req: express.Request, res: express.Response) { const user = res.locals.oauth.token.User - const resultList = await ServerBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort) + const resultList = await ServerBlocklistModel.listForApi({ + start: req.query.start, + count: req.query.count, + sort: req.query.sort, + search: req.query.search, + accountId: user.Account.id + }) return res.json(getFormattedObjects(resultList.data, resultList.total)) } diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index 2a667480d..c4aa79cd2 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts @@ -102,7 +102,13 @@ async function updateVideoBlacklistController (req: express.Request, res: expres } async function listBlacklist (req: express.Request, res: express.Response) { - const resultList = await VideoBlacklistModel.listForApi(req.query.start, req.query.count, req.query.sort, req.query.type) + const resultList = await VideoBlacklistModel.listForApi({ + start: req.query.start, + count: req.query.count, + sort: req.query.sort, + search: req.query.search, + type: req.query.type + }) return res.json(getFormattedObjects(resultList.data, resultList.total)) } -- cgit v1.2.3