aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/feeds.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-19 11:01:34 +0200
committerChocobozzz <me@florianbigard.com>2018-04-19 11:01:34 +0200
commit0883b3245bf0deb9106c4041e9afbd3521b79280 (patch)
treefcb73005e0b31a3b763ee5d22d5fc39c2da89907 /server/controllers/feeds.ts
parent04ed10b21e8e1339514faae0bb690e4d97c23b0a (diff)
downloadPeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.tar.gz
PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.tar.zst
PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.zip
Add ability to choose what policy we have for NSFW videos
There is a global instance setting and a per user setting
Diffstat (limited to 'server/controllers/feeds.ts')
-rw-r--r--server/controllers/feeds.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index 3e384c48a..27ebecc40 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -6,6 +6,7 @@ import * as Feed from 'pfeed'
6import { ResultList } from '../../shared/models' 6import { ResultList } from '../../shared/models'
7import { AccountModel } from '../models/account/account' 7import { AccountModel } from '../models/account/account'
8import { cacheRoute } from '../middlewares/cache' 8import { cacheRoute } from '../middlewares/cache'
9import { VideoSortField } from '../../client/src/app/shared/video/sort-field.type'
9 10
10const feedsRouter = express.Router() 11const feedsRouter = express.Router()
11 12
@@ -31,20 +32,22 @@ async function generateFeed (req: express.Request, res: express.Response, next:
31 32
32 let resultList: ResultList<VideoModel> 33 let resultList: ResultList<VideoModel>
33 const account: AccountModel = res.locals.account 34 const account: AccountModel = res.locals.account
35 const hideNSFW = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list'
34 36
35 if (account) { 37 if (account) {
36 resultList = await VideoModel.listAccountVideosForApi( 38 resultList = await VideoModel.listAccountVideosForApi(
37 account.id, 39 account.id,
38 start, 40 start,
39 FEEDS.COUNT, 41 FEEDS.COUNT,
40 req.query.sort, 42 req.query.sort as VideoSortField,
41 true 43 hideNSFW
42 ) 44 )
43 } else { 45 } else {
44 resultList = await VideoModel.listForApi( 46 resultList = await VideoModel.listForApi(
45 start, 47 start,
46 FEEDS.COUNT, 48 FEEDS.COUNT,
47 req.query.sort, 49 req.query.sort as VideoSortField,
50 hideNSFW,
48 req.query.filter, 51 req.query.filter,
49 true 52 true
50 ) 53 )