summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/notes.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-05-23 15:25:15 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-05-23 15:25:15 +0900
commit0ba5dc3900b5bc8d86c63e04ab17e2e5652a00d2 (patch)
tree3587ae670164b0db71f7604ef0f65aac3dac7137 /src/server/api/endpoints/notes.ts
parentMerge pull request #1638 from syuilo/l10n_master (diff)
downloadsharkey-0ba5dc3900b5bc8d86c63e04ab17e2e5652a00d2.tar.gz
sharkey-0ba5dc3900b5bc8d86c63e04ab17e2e5652a00d2.tar.bz2
sharkey-0ba5dc3900b5bc8d86c63e04ab17e2e5652a00d2.zip
Only show local posts in the timeline of top page
Diffstat (limited to 'src/server/api/endpoints/notes.ts')
-rw-r--r--src/server/api/endpoints/notes.ts8
1 files changed, 8 insertions, 0 deletions
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;
}