-
Notifications
You must be signed in to change notification settings - Fork 528
feat(LeftSidebar): add global Talk messages search #16344
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,6 +266,7 @@ | |
| :conversations-list="conversationsList" | ||
| :search-results="searchResults" | ||
| :search-results-listed-conversations="searchResultsListedConversations" | ||
| :search-results-messages="searchResultsMessages" | ||
| @abort-search="abortSearch" | ||
| @create-new-conversation="createConversation" | ||
| @create-and-join-conversation="createAndJoinConversation" /> | ||
|
|
@@ -354,7 +355,10 @@ import { | |
| fetchNoteToSelfConversation, | ||
| searchListedConversations, | ||
| } from '../../services/conversationsService.ts' | ||
| import { autocompleteQuery } from '../../services/coreService.ts' | ||
| import { | ||
| autocompleteQuery, | ||
| searchMessagesEverywhere, | ||
| } from '../../services/coreService.ts' | ||
| import { EventBus } from '../../services/EventBus.ts' | ||
| import { talkBroadcastChannel } from '../../services/talkBroadcastChannel.js' | ||
| import { useActorStore } from '../../stores/actor.ts' | ||
|
|
@@ -477,11 +481,14 @@ export default { | |
| searchText: '', | ||
| searchResults: [], | ||
| searchResultsListedConversations: [], | ||
| searchResultsMessages: [], | ||
| contactsLoading: false, | ||
| listedConversationsLoading: false, | ||
| messagesLoading: false, | ||
| canStartConversations: getTalkConfig('local', 'conversations', 'can-create'), | ||
| cancelSearchPossibleConversations: () => {}, | ||
| cancelSearchListedConversations: () => {}, | ||
| cancelSearchMessages: () => {}, | ||
| debounceFetchSearchResults: () => {}, | ||
| debounceFetchConversations: () => {}, | ||
| debounceHandleScroll: () => {}, | ||
|
|
@@ -690,6 +697,9 @@ export default { | |
| this.cancelSearchListedConversations() | ||
| this.cancelSearchListedConversations = null | ||
|
|
||
| this.cancelSearchMessages() | ||
| this.cancelSearchMessages = null | ||
|
|
||
| if (this.refreshTimer) { | ||
| clearInterval(this.refreshTimer) | ||
| this.refreshTimer = null | ||
|
|
@@ -814,6 +824,44 @@ export default { | |
| } | ||
| }, | ||
|
|
||
| async fetchMessagesEverywhere() { | ||
| try { | ||
| this.messagesLoading = true | ||
|
|
||
| this.cancelSearchMessages('canceled') | ||
| const { request, cancel } = CancelableRequest(searchMessagesEverywhere) | ||
| this.cancelSearchMessages = cancel | ||
|
|
||
| const response = await request({ | ||
| term: this.searchText, | ||
| limit: 5, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is misleading as it lacks Show more messages button when there can be more results to show
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a "see more" in the screenshot, so how would we see older results? |
||
| }) | ||
| const data = response?.data?.ocs?.data | ||
| if (data && data.entries.length > 0) { | ||
| this.searchResultsMessages = data.entries.map((entry) => { | ||
| const threadId = (entry.attributes.threadId !== entry.attributes.messageId) ? entry.attributes.threadId : undefined | ||
|
|
||
| return { | ||
| ...entry, | ||
| to: { | ||
| name: 'conversation', | ||
| hash: `#message_${entry.attributes.messageId}`, | ||
| params: { token: entry.attributes.conversation }, | ||
| query: { threadId }, | ||
| }, | ||
| } | ||
| }) | ||
| } | ||
| this.messagesLoading = false | ||
| } catch (exception) { | ||
| if (CancelableRequest.isCancel(exception)) { | ||
| return | ||
| } | ||
| console.error('Error searching for messages', exception) | ||
| showError(t('spreed', 'An error occurred while performing the search')) | ||
| } | ||
| }, | ||
|
|
||
| async fetchSearchResults() { | ||
| if (!this.isSearching) { | ||
| return | ||
|
|
@@ -824,7 +872,11 @@ export default { | |
| this.showThreadsList = false | ||
|
|
||
| this.resetNavigation() | ||
| await Promise.all([this.fetchPossibleConversations(), this.fetchListedConversations()]) | ||
| await Promise.all([ | ||
| this.fetchPossibleConversations(), | ||
| this.fetchListedConversations(), | ||
| this.fetchMessagesEverywhere(), | ||
| ]) | ||
|
Comment on lines
+875
to
+879
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We wanted to have the global search as an additional action, not the default, didn't we?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd vote for it being the default. in case that it not possible, add some filter chips on the top row like Edit: the filter chips would be useful either way as the space available is not that much.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is quite problematic. A lot of people use the quick filtering to navigate to other conversations, if that always triggers yet another search request, it adds quite some load, while sometimes people might know already where they need to go. Just for the record, on our server we have:
So if we "all of a sudden" add 1.8k additional search requests it should be sensible and optional from my pov
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Thinking …"
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Got it, exactly why I proposed the filter chips idea :) By default it can be unselected and if people select it we can trigger the global message search.
|
||
| this.initializeNavigation() | ||
| }, | ||
|
|
||
|
|
@@ -890,6 +942,9 @@ export default { | |
| if (this.cancelSearchListedConversations) { | ||
| this.cancelSearchListedConversations() | ||
| } | ||
| if (this.cancelSearchMessages) { | ||
| this.cancelSearchMessages() | ||
| } | ||
| }, | ||
|
|
||
| showSettings() { | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has no use in this case