From 0ba5dc3900b5bc8d86c63e04ab17e2e5652a00d2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 23 May 2018 15:25:15 +0900 Subject: Only show local posts in the timeline of top page --- src/server/api/endpoints/notes.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/server/api/endpoints/notes.ts') diff --git a/src/server/api/endpoints/notes.ts b/src/server/api/endpoints/notes.ts index 4ce7613d70..2a276a9582 100644 --- a/src/server/api/endpoints/notes.ts +++ b/src/server/api/endpoints/notes.ts @@ -8,6 +8,10 @@ import Note, { pack } from '../../../models/note'; * Get all notes */ module.exports = (params) => new Promise(async (res, rej) => { + // Get 'local' parameter + const [local, localErr] = $.bool.optional().get(params.local); + if (localErr) return rej('invalid local param'); + // Get 'reply' parameter const [reply, replyErr] = $.bool.optional().get(params.reply); if (replyErr) return rej('invalid reply param'); @@ -61,6 +65,10 @@ module.exports = (params) => new Promise(async (res, rej) => { }; } + if (local) { + query._user.host = null; + } + if (reply != undefined) { query.replyId = reply ? { $exists: true, $ne: null } : null; } -- cgit v1.2.3-freya From 6d9d6a677989c2ff163101351bb251e9818418cf Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 23 May 2018 15:46:20 +0900 Subject: oops --- src/server/api/endpoints/notes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/api/endpoints/notes.ts') diff --git a/src/server/api/endpoints/notes.ts b/src/server/api/endpoints/notes.ts index 2a276a9582..6e226d108a 100644 --- a/src/server/api/endpoints/notes.ts +++ b/src/server/api/endpoints/notes.ts @@ -66,7 +66,7 @@ module.exports = (params) => new Promise(async (res, rej) => { } if (local) { - query._user.host = null; + query._user = { host: null }; } if (reply != undefined) { -- cgit v1.2.3-freya From eb23be979c3578aecfa3afa05edc0a2e304cb2c4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 23 May 2018 15:47:51 +0900 Subject: oops --- src/server/api/endpoints/notes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/api/endpoints/notes.ts') diff --git a/src/server/api/endpoints/notes.ts b/src/server/api/endpoints/notes.ts index 6e226d108a..21946d1bd3 100644 --- a/src/server/api/endpoints/notes.ts +++ b/src/server/api/endpoints/notes.ts @@ -66,7 +66,7 @@ module.exports = (params) => new Promise(async (res, rej) => { } if (local) { - query._user = { host: null }; + query['_user.host'] = null; } if (reply != undefined) { -- cgit v1.2.3-freya