Skip to content

Commit e3b852b

Browse files
authored
Merge pull request #14143 from nextcloud/fix/search-messages-follow-up
fix: user contacts menu instead of conversation participants (there c…
2 parents 0171ecd + c24033f commit e3b852b

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

src/components/RightSidebar/SearchMessages/SearchMessagesTab.vue

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import AvatarWrapper from '../../AvatarWrapper/AvatarWrapper.vue'
2929
import SearchBox from '../../UIShared/SearchBox.vue'
3030
import TransitionWrapper from '../../UIShared/TransitionWrapper.vue'
3131
32+
import { useArrowNavigation } from '../../../composables/useArrowNavigation.js'
3233
import { useIsInCall } from '../../../composables/useIsInCall.js'
3334
import { useStore } from '../../../composables/useStore.js'
3435
import { ATTENDEE } from '../../../constants.ts'
@@ -50,7 +51,10 @@ const emit = defineEmits<{
5051
(event: 'close'): void
5152
}>()
5253
54+
const searchMessagesTab = ref<HTMLElement | null>(null)
5355
const searchBox = ref<InstanceType<typeof SearchBox> | null>(null)
56+
const { initializeNavigation, resetNavigation } = useArrowNavigation(searchMessagesTab, searchBox)
57+
5458
const isFocused = ref(false)
5559
const searchResults = ref<(CoreUnifiedSearchResultEntry &
5660
{
@@ -173,8 +177,9 @@ async function fetchSearchResults(isNew = true): Promise<void> {
173177
isFetchingResults.value = true
174178
175179
try {
176-
// cancel the previous search request
180+
// cancel the previous search request and reset the navigation
177181
cancelSearchFn()
182+
resetNavigation()
178183
179184
const { request, cancel } = CancelableRequest(searchMessages) as SearchMessageCancelableRequest
180185
cancelSearchFn = cancel
@@ -229,6 +234,7 @@ async function fetchSearchResults(isNew = true): Promise<void> {
229234
}
230235
})
231236
)
237+
nextTick(() => initializeNavigation())
232238
}
233239
} catch (exception) {
234240
if (CancelableRequest.isCancel(exception)) {
@@ -242,18 +248,19 @@ async function fetchSearchResults(isNew = true): Promise<void> {
242248
}
243249
244250
const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
251+
252+
watch([searchText, fromUser, sinceDate, untilDate], debounceFetchSearchResults)
245253
</script>
246254

247255
<template>
248-
<div class="search-messages-tab">
256+
<div ref="searchMessagesTab" class="search-messages-tab">
249257
<div class="search-form">
250258
<div class="search-form__main">
251259
<div class="search-form__search-box-wrapper">
252260
<SearchBox ref="searchBox"
253261
:value.sync="searchText"
254262
:placeholder-text="t('spreed', 'Search messages …')"
255-
:is-focused.sync="isFocused"
256-
@input="debounceFetchSearchResults" />
263+
:is-focused.sync="isFocused" />
257264
<NcButton :pressed.sync="searchDetailsOpened"
258265
:aria-label="t('spreed', 'Search options')"
259266
:title="t('spreed', 'Search options')"
@@ -271,8 +278,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
271278
:placeholder="t('spreed', 'From User')"
272279
user-select
273280
:loading="!participantsInitialised"
274-
:options="participants"
275-
@update:modelValue="debounceFetchSearchResults" />
281+
:options="participants" />
276282
<div class="search-form__search-detail__date-picker-wrapper">
277283
<NcDateTimePickerNative id="search-form__search-detail__date-picker--since"
278284
v-model="sinceDate"
@@ -282,8 +288,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
282288
:step="1"
283289
:max="new Date()"
284290
:aria-label="t('spreed', 'Since')"
285-
:label="t('spreed', 'Since')"
286-
@update:modelValue="debounceFetchSearchResults" />
291+
:label="t('spreed', 'Since')" />
287292
<NcDateTimePickerNative id="search-form__search-detail__date-picker--until"
288293
v-model="untilDate"
289294
class="search-form__search-detail__date-picker"
@@ -292,8 +297,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
292297
:max="new Date()"
293298
:aria-label="t('spreed', 'Until')"
294299
:label="t('spreed', 'Until')"
295-
:minute-step="1"
296-
@update:modelValue="debounceFetchSearchResults" />
300+
:minute-step="1" />
297301
</div>
298302
</div>
299303
</TransitionWrapper>

src/types/index.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -340,37 +340,37 @@ export type setUserSettingsResponse = ApiResponse<operations['settings-set-user-
340340

341341
// Unified Search
342342
export type MessageSearchResultAttributes = {
343-
conversation: string
344-
messageId: string
345-
actorType: string
346-
actorId: string
347-
timestamp: string
343+
conversation: string,
344+
messageId: string,
345+
actorType: string,
346+
actorId: string,
347+
timestamp: string,
348348
}
349349

350350
export type CoreUnifiedSearchResultEntry = {
351-
thumbnailUrl: string;
352-
title: string;
353-
subline: string;
354-
resourceUrl: string;
355-
icon: string;
356-
rounded: boolean;
357-
attributes: MessageSearchResultAttributes;
351+
thumbnailUrl: string,
352+
title: string,
353+
subline: string,
354+
resourceUrl: string,
355+
icon: string,
356+
rounded: boolean,
357+
attributes: MessageSearchResultAttributes,
358358
}
359359

360360
export type UserFilterObject = {
361-
id: string
362-
displayName: string
363-
isNoUser: boolean
364-
user: string
365-
disableMenu: boolean
366-
showUserStatus: boolean
361+
id: string,
362+
displayName: string,
363+
isNoUser: boolean,
364+
user: string,
365+
disableMenu: boolean,
366+
showUserStatus: boolean,
367367
}
368368

369369
export type CoreUnifiedSearchResult = {
370-
name: string;
371-
isPaginated: boolean;
372-
entries: CoreUnifiedSearchResultEntry[];
373-
cursor: number | string | null;
370+
name: string,
371+
isPaginated: boolean,
372+
entries: CoreUnifiedSearchResultEntry[],
373+
cursor: number | string | null,
374374
}
375375
export type UnifiedSearchResponse = ApiResponseUnwrapped<CoreUnifiedSearchResult>
376376

0 commit comments

Comments
 (0)