Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: user contacts menu instead of conversation participants (there c… #14143

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/components/RightSidebar/SearchMessages/SearchMessagesTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import AvatarWrapper from '../../AvatarWrapper/AvatarWrapper.vue'
import SearchBox from '../../UIShared/SearchBox.vue'
import TransitionWrapper from '../../UIShared/TransitionWrapper.vue'

import { useArrowNavigation } from '../../../composables/useArrowNavigation.js'
import { useIsInCall } from '../../../composables/useIsInCall.js'
import { useStore } from '../../../composables/useStore.js'
import { ATTENDEE } from '../../../constants.ts'
Expand All @@ -50,7 +51,10 @@ const emit = defineEmits<{
(event: 'close'): void
}>()

const searchMessagesTab = ref<HTMLElement | null>(null)
const searchBox = ref<InstanceType<typeof SearchBox> | null>(null)
const { initializeNavigation, resetNavigation } = useArrowNavigation(searchMessagesTab, searchBox)

const isFocused = ref(false)
const searchResults = ref<(CoreUnifiedSearchResultEntry &
{
Expand Down Expand Up @@ -173,8 +177,9 @@ async function fetchSearchResults(isNew = true): Promise<void> {
isFetchingResults.value = true

try {
// cancel the previous search request
// cancel the previous search request and reset the navigation
cancelSearchFn()
resetNavigation()

const { request, cancel } = CancelableRequest(searchMessages) as SearchMessageCancelableRequest
cancelSearchFn = cancel
Expand Down Expand Up @@ -229,6 +234,7 @@ async function fetchSearchResults(isNew = true): Promise<void> {
}
})
)
nextTick(() => initializeNavigation())
}
} catch (exception) {
if (CancelableRequest.isCancel(exception)) {
Expand All @@ -242,18 +248,19 @@ async function fetchSearchResults(isNew = true): Promise<void> {
}

const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)

watch([searchText, fromUser, sinceDate, untilDate], debounceFetchSearchResults)
</script>

<template>
<div class="search-messages-tab">
<div ref="searchMessagesTab" class="search-messages-tab">
<div class="search-form">
<div class="search-form__main">
<div class="search-form__search-box-wrapper">
<SearchBox ref="searchBox"
:value.sync="searchText"
:placeholder-text="t('spreed', 'Search messages …')"
:is-focused.sync="isFocused"
@input="debounceFetchSearchResults" />
:is-focused.sync="isFocused" />
<NcButton :pressed.sync="searchDetailsOpened"
:aria-label="t('spreed', 'Search options')"
:title="t('spreed', 'Search options')"
Expand All @@ -271,8 +278,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
:placeholder="t('spreed', 'From User')"
user-select
:loading="!participantsInitialised"
:options="participants"
@update:modelValue="debounceFetchSearchResults" />
:options="participants" />
<div class="search-form__search-detail__date-picker-wrapper">
<NcDateTimePickerNative id="search-form__search-detail__date-picker--since"
v-model="sinceDate"
Expand All @@ -282,8 +288,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
:step="1"
:max="new Date()"
:aria-label="t('spreed', 'Since')"
:label="t('spreed', 'Since')"
@update:modelValue="debounceFetchSearchResults" />
:label="t('spreed', 'Since')" />
<NcDateTimePickerNative id="search-form__search-detail__date-picker--until"
v-model="untilDate"
class="search-form__search-detail__date-picker"
Expand All @@ -292,8 +297,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
:max="new Date()"
:aria-label="t('spreed', 'Until')"
:label="t('spreed', 'Until')"
:minute-step="1"
@update:modelValue="debounceFetchSearchResults" />
:minute-step="1" />
</div>
</div>
</TransitionWrapper>
Expand Down
44 changes: 22 additions & 22 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,37 +340,37 @@ export type setUserSettingsResponse = ApiResponse<operations['settings-set-user-

// Unified Search
export type MessageSearchResultAttributes = {
conversation: string
messageId: string
actorType: string
actorId: string
timestamp: string
conversation: string,
messageId: string,
actorType: string,
actorId: string,
timestamp: string,
}

export type CoreUnifiedSearchResultEntry = {
thumbnailUrl: string;
title: string;
subline: string;
resourceUrl: string;
icon: string;
rounded: boolean;
attributes: MessageSearchResultAttributes;
thumbnailUrl: string,
title: string,
subline: string,
resourceUrl: string,
icon: string,
rounded: boolean,
attributes: MessageSearchResultAttributes,
}

export type UserFilterObject = {
id: string
displayName: string
isNoUser: boolean
user: string
disableMenu: boolean
showUserStatus: boolean
id: string,
displayName: string,
isNoUser: boolean,
user: string,
disableMenu: boolean,
showUserStatus: boolean,
}

export type CoreUnifiedSearchResult = {
name: string;
isPaginated: boolean;
entries: CoreUnifiedSearchResultEntry[];
cursor: number | string | null;
name: string,
isPaginated: boolean,
entries: CoreUnifiedSearchResultEntry[],
cursor: number | string | null,
}
export type UnifiedSearchResponse = ApiResponseUnwrapped<CoreUnifiedSearchResult>

Expand Down
Loading