@jasonwch/nodebb-plugin-meilisearch-r 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -147,9 +147,11 @@ $(document).ready(function () {
|
|
|
147
147
|
const translator = await app.require('translator');
|
|
148
148
|
|
|
149
149
|
if (!query) {
|
|
150
|
-
|
|
150
|
+
++searchSeq;
|
|
151
|
+
resultsContainer.hide().empty();
|
|
151
152
|
window.chatSearchState.isOpen = false;
|
|
152
153
|
window.chatSearchState.resultsHtml = '';
|
|
154
|
+
window.chatSearchState.lastScroll = 0;
|
|
153
155
|
return;
|
|
154
156
|
}
|
|
155
157
|
|
|
@@ -165,12 +167,14 @@ $(document).ready(function () {
|
|
|
165
167
|
if (seq !== searchSeq) return;
|
|
166
168
|
if (err) {
|
|
167
169
|
const errorLabel = await translator.translateKey('meilisearch:chatSearch.client.error');
|
|
170
|
+
if (seq !== searchSeq) return;
|
|
168
171
|
const errorHtml = '<div class="alert alert-danger" style="margin:5px;">' + errorLabel + '</div>';
|
|
169
172
|
resultsContainer.html(errorHtml);
|
|
170
173
|
return;
|
|
171
174
|
}
|
|
172
175
|
if (!messages || messages.length === 0) {
|
|
173
176
|
const noResultsLabel = await translator.translateKey('meilisearch:chatSearch.client.no-results');
|
|
177
|
+
if (seq !== searchSeq) return;
|
|
174
178
|
const noResHtml = '<div class="text-center" style="padding:10px; color: var(--bs-secondary-color);">' + noResultsLabel + '</div>';
|
|
175
179
|
resultsContainer.html(noResHtml);
|
|
176
180
|
window.chatSearchState.resultsHtml = noResHtml;
|
|
@@ -211,6 +215,7 @@ $(document).ready(function () {
|
|
|
211
215
|
});
|
|
212
216
|
|
|
213
217
|
const html = await app.parseAndTranslate('client/partials/chats/search-result', { messages: preparedMessages });
|
|
218
|
+
if (seq !== searchSeq) return;
|
|
214
219
|
resultsContainer.html(html);
|
|
215
220
|
|
|
216
221
|
if ($.fn.timeago) {
|
|
@@ -231,7 +236,7 @@ $(document).ready(function () {
|
|
|
231
236
|
}
|
|
232
237
|
if (!currentRoomId) return;
|
|
233
238
|
$('.search-result').removeClass('active');
|
|
234
|
-
const activeItem = $('.search-result[data-roomid="' + currentRoomId + '"]');
|
|
239
|
+
const activeItem = $('.search-result[data-search-roomid="' + currentRoomId + '"]');
|
|
235
240
|
activeItem.addClass('active');
|
|
236
241
|
}
|
|
237
242
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div class="d-flex flex-column">
|
|
2
2
|
{{{each messages}}}
|
|
3
|
-
<div component="chat/search/result" class="rounded-1 search-result" data-roomid="{messages.roomId}">
|
|
3
|
+
<div component="chat/search/result" class="rounded-1 search-result" data-search-roomid="{messages.roomId}">
|
|
4
4
|
<div class="d-flex gap-1 justify-content-between">
|
|
5
5
|
<a href="{messages.chatLink}" onclick="ajaxify.go('{messages.chatLink}'); return false;" class="chat-room-btn position-relative d-flex flex-grow-1 gap-2 justify-content-start align-items-start btn btn-ghost btn-sm ff-sans text-start" style="padding: 0.5rem;">
|
|
6
6
|
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
<div class="d-flex flex-grow-1 flex-column w-100" style="min-width:0;">
|
|
16
|
-
<div component="chat/room
|
|
16
|
+
<div component="chat/search/room-title" class="room-name fw-semibold text-xs text-break">
|
|
17
17
|
{messages.roomName}
|
|
18
18
|
</div>
|
|
19
|
-
<div component="chat/room
|
|
19
|
+
<div component="chat/search/room-teaser">
|
|
20
20
|
|
|
21
21
|
<div class="teaser-content text-sm line-clamp-3 text-break mb-0">
|
|
22
22
|
{{buildAvatar(messages.user, "14px", true, "align-middle")}}
|