浏览代码

Implement test

sbkwgh 8 年之前
父节点
当前提交
b1d6c75965
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      routes/thread.js

+ 7 - 0
routes/thread.js

@@ -39,6 +39,13 @@ router.get('/:thread_id', async (req, res) => {
 				`/api/v1/thread/${thread.id}?limit=${limit}&from=${firstPost.postNumber - limit}`
 		}
 
+		if(lastPost === undefined) {
+			resThread.meta.postsRemaining = 0
+		} else {
+			resThread.meta.postsRemaining =
+				thread.postsCount - lastPost.postNumber - 1
+		}
+
 		res.json(resThread)
 		
 	} catch (e) {