]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/feeds.ts
Add account view
[github/Chocobozzz/PeerTube.git] / server / controllers / feeds.ts
index 27ebecc404138a92e43fbbc8ebc9617fff5df43d..6a6af3e0910f9d50d4ebb17a29e97fb475098445 100644 (file)
@@ -30,28 +30,18 @@ async function generateFeed (req: express.Request, res: express.Response, next:
   let feed = initFeed()
   const start = 0
 
-  let resultList: ResultList<VideoModel>
   const account: AccountModel = res.locals.account
   const hideNSFW = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list'
 
-  if (account) {
-    resultList = await VideoModel.listAccountVideosForApi(
-      account.id,
-      start,
-      FEEDS.COUNT,
-      req.query.sort as VideoSortField,
-      hideNSFW
-    )
-  } else {
-    resultList = await VideoModel.listForApi(
-      start,
-      FEEDS.COUNT,
-      req.query.sort as VideoSortField,
-      hideNSFW,
-      req.query.filter,
-      true
-    )
-  }
+  const resultList = await VideoModel.listForApi(
+    start,
+    FEEDS.COUNT,
+    req.query.sort as VideoSortField,
+    hideNSFW,
+    req.query.filter,
+    true,
+    account ? account.id : null
+  )
 
   // Adding video items to the feed, one at a time
   resultList.data.forEach(video => {