diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-12-21 15:37:26 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-12-21 15:37:26 +0900 |
| commit | 41623f85901437631707c308e0550b9be8e7b782 (patch) | |
| tree | 62acf1787a23430bd25b01d3d8b36923159c7b02 /src/api/endpoints/posts | |
| parent | #1026 (diff) | |
| download | sharkey-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.ts | 6 |
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, { |