diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-19 11:01:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-19 11:01:34 +0200 |
commit | 0883b3245bf0deb9106c4041e9afbd3521b79280 (patch) | |
tree | fcb73005e0b31a3b763ee5d22d5fc39c2da89907 /server/controllers/feeds.ts | |
parent | 04ed10b21e8e1339514faae0bb690e4d97c23b0a (diff) | |
download | PeerTube-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.ts | 9 |
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' | |||
6 | import { ResultList } from '../../shared/models' | 6 | import { ResultList } from '../../shared/models' |
7 | import { AccountModel } from '../models/account/account' | 7 | import { AccountModel } from '../models/account/account' |
8 | import { cacheRoute } from '../middlewares/cache' | 8 | import { cacheRoute } from '../middlewares/cache' |
9 | import { VideoSortField } from '../../client/src/app/shared/video/sort-field.type' | ||
9 | 10 | ||
10 | const feedsRouter = express.Router() | 11 | const 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 | ) |