Show error message if searching is not available
This commit is contained in:
parent
7e27e2757f
commit
e03ec67b5c
2 changed files with 28 additions and 6 deletions
|
@ -18,6 +18,8 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||
const [limit = 10, limitErr] = $.num.optional.range(1, 30).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
if (es == null) return rej('searching not available');
|
||||
|
||||
es.search({
|
||||
index: 'misskey',
|
||||
type: 'note',
|
||||
|
@ -53,10 +55,10 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||
$in: hits
|
||||
}
|
||||
}, {
|
||||
sort: {
|
||||
_id: -1
|
||||
}
|
||||
});
|
||||
sort: {
|
||||
_id: -1
|
||||
}
|
||||
});
|
||||
|
||||
res(await Promise.all(notes.map(note => pack(note, me))));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue