mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-15 00:55:48 +01:00
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
|
@ -6,6 +6,7 @@
|
|||
<div :class="$style.loading" v-if="fetching">
|
||||
<mk-ellipsis-icon/>
|
||||
</div>
|
||||
<p :class="$style.notAvailable" v-if="!fetching && notAvailable">検索機能を利用することができません。</p>
|
||||
<p :class="$style.empty" v-if="!fetching && empty">%fa:search%「{{ q }}」に関する投稿は見つかりませんでした。</p>
|
||||
<mk-notes ref="timeline" :class="$style.notes" :more="existMore ? more : null"/>
|
||||
</mk-ui>
|
||||
|
@ -24,7 +25,8 @@ export default Vue.extend({
|
|||
moreFetching: false,
|
||||
existMore: false,
|
||||
offset: 0,
|
||||
empty: false
|
||||
empty: false,
|
||||
notAvailable: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
@ -71,7 +73,11 @@ export default Vue.extend({
|
|||
res(notes);
|
||||
this.fetching = false;
|
||||
Progress.done();
|
||||
}, rej);
|
||||
}, (e: string) => {
|
||||
this.fetching = false;
|
||||
Progress.done();
|
||||
if (e === 'searching not available') this.notAvailable = true;
|
||||
});
|
||||
}));
|
||||
},
|
||||
more() {
|
||||
|
@ -130,4 +136,18 @@ export default Vue.extend({
|
|||
font-size 3em
|
||||
color #ccc
|
||||
|
||||
|
||||
.notAvailable
|
||||
display block
|
||||
margin 0 auto
|
||||
padding 32px
|
||||
max-width 400px
|
||||
text-align center
|
||||
color #999
|
||||
|
||||
> [data-fa]
|
||||
display block
|
||||
margin-bottom 16px
|
||||
font-size 3em
|
||||
color #ccc
|
||||
</style>
|
||||
|
|
|
@ -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…
Reference in a new issue