aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-04-19 14:11:40 +0200
committerRigel Kent <par@rigelk.eu>2020-05-01 16:41:02 +0200
commite0a929179a9dc76e035ca7fda2b61d5ff46afbc5 (patch)
tree1e6615c612ad6995dcb1c3619342dbbc7db35034 /server/controllers
parentaeb1bed9835b3b092832160245080d4023c14d91 (diff)
downloadPeerTube-e0a929179a9dc76e035ca7fda2b61d5ff46afbc5.tar.gz
PeerTube-e0a929179a9dc76e035ca7fda2b61d5ff46afbc5.tar.zst
PeerTube-e0a929179a9dc76e035ca7fda2b61d5ff46afbc5.zip
Add filter inputs for blacklisted videos and muted accounts/servers
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/server/server-blocklist.ts16
-rw-r--r--server/controllers/api/users/my-blocklist.ts16
-rw-r--r--server/controllers/api/videos/blacklist.ts8
3 files changed, 35 insertions, 5 deletions
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 {
82async function listBlockedAccounts (req: express.Request, res: express.Response) { 82async function listBlockedAccounts (req: express.Request, res: express.Response) {
83 const serverActor = await getServerActor() 83 const serverActor = await getServerActor()
84 84
85 const resultList = await AccountBlocklistModel.listForApi(serverActor.Account.id, req.query.start, req.query.count, req.query.sort) 85 const resultList = await AccountBlocklistModel.listForApi({
86 start: req.query.start,
87 count: req.query.count,
88 sort: req.query.sort,
89 search: req.query.search,
90 accountId: serverActor.Account.id
91 })
86 92
87 return res.json(getFormattedObjects(resultList.data, resultList.total)) 93 return res.json(getFormattedObjects(resultList.data, resultList.total))
88} 94}
@@ -107,7 +113,13 @@ async function unblockAccount (req: express.Request, res: express.Response) {
107async function listBlockedServers (req: express.Request, res: express.Response) { 113async function listBlockedServers (req: express.Request, res: express.Response) {
108 const serverActor = await getServerActor() 114 const serverActor = await getServerActor()
109 115
110 const resultList = await ServerBlocklistModel.listForApi(serverActor.Account.id, req.query.start, req.query.count, req.query.sort) 116 const resultList = await ServerBlocklistModel.listForApi({
117 start: req.query.start,
118 count: req.query.count,
119 sort: req.query.sort,
120 search: req.query.search,
121 accountId: serverActor.Account.id
122 })
111 123
112 return res.json(getFormattedObjects(resultList.data, resultList.total)) 124 return res.json(getFormattedObjects(resultList.data, resultList.total))
113} 125}
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 {
74async function listBlockedAccounts (req: express.Request, res: express.Response) { 74async function listBlockedAccounts (req: express.Request, res: express.Response) {
75 const user = res.locals.oauth.token.User 75 const user = res.locals.oauth.token.User
76 76
77 const resultList = await AccountBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort) 77 const resultList = await AccountBlocklistModel.listForApi({
78 start: req.query.start,
79 count: req.query.count,
80 sort: req.query.sort,
81 search: req.query.search,
82 accountId: user.Account.id
83 })
78 84
79 return res.json(getFormattedObjects(resultList.data, resultList.total)) 85 return res.json(getFormattedObjects(resultList.data, resultList.total))
80} 86}
@@ -99,7 +105,13 @@ async function unblockAccount (req: express.Request, res: express.Response) {
99async function listBlockedServers (req: express.Request, res: express.Response) { 105async function listBlockedServers (req: express.Request, res: express.Response) {
100 const user = res.locals.oauth.token.User 106 const user = res.locals.oauth.token.User
101 107
102 const resultList = await ServerBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort) 108 const resultList = await ServerBlocklistModel.listForApi({
109 start: req.query.start,
110 count: req.query.count,
111 sort: req.query.sort,
112 search: req.query.search,
113 accountId: user.Account.id
114 })
103 115
104 return res.json(getFormattedObjects(resultList.data, resultList.total)) 116 return res.json(getFormattedObjects(resultList.data, resultList.total))
105} 117}
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
102} 102}
103 103
104async function listBlacklist (req: express.Request, res: express.Response) { 104async function listBlacklist (req: express.Request, res: express.Response) {
105 const resultList = await VideoBlacklistModel.listForApi(req.query.start, req.query.count, req.query.sort, req.query.type) 105 const resultList = await VideoBlacklistModel.listForApi({
106 start: req.query.start,
107 count: req.query.count,
108 sort: req.query.sort,
109 search: req.query.search,
110 type: req.query.type
111 })
106 112
107 return res.json(getFormattedObjects(resultList.data, resultList.total)) 113 return res.json(getFormattedObjects(resultList.data, resultList.total))
108} 114}