summaryrefslogtreecommitdiff
path: root/src/api/endpoints/posts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-12-21 15:37:26 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-12-21 15:37:26 +0900
commit41623f85901437631707c308e0550b9be8e7b782 (patch)
tree62acf1787a23430bd25b01d3d8b36923159c7b02 /src/api/endpoints/posts
parent#1026 (diff)
downloadsharkey-41623f85901437631707c308e0550b9be8e7b782.tar.gz
sharkey-41623f85901437631707c308e0550b9be8e7b782.tar.bz2
sharkey-41623f85901437631707c308e0550b9be8e7b782.zip
Fix bug
Diffstat (limited to 'src/api/endpoints/posts')
-rw-r--r--src/api/endpoints/posts/search.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts
index 16d54f729f..ac25652a0b 100644
--- a/src/api/endpoints/posts/search.ts
+++ b/src/api/endpoints/posts/search.ts
@@ -85,7 +85,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
// Search by MongoDB
async function byNative(res, rej, me, text, userId, following, reply, repost, media, poll, sinceDate, untilDate, offset, max) {
- const q: any = {
+ let q: any = {
$and: []
};
@@ -216,6 +216,10 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me
});
}
+ if (q.$and.length == 0) {
+ q = {};
+ }
+
// Search posts
const posts = await Post
.find(q, {