Skip to content

Commit

Permalink
fix: adjust autocompleteQuery payload
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Nov 5, 2024
1 parent 1448547 commit f52f5ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/LeftSidebar/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ export default {

const response = await request({
searchText: this.searchText,
token: undefined,
token: 'new',
onlyUsers: !this.canStartConversations,
})

Expand Down
29 changes: 14 additions & 15 deletions src/services/coreService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,22 @@ type SearchPayload = {
/**
* Fetch possible conversations
*
* @param data the wrapping object;
* @param data.searchText The string that will be used in the search query.
* @param [data.token] The token of the conversation (if any), or "new" for a new one
* @param [data.onlyUsers] Only return users
* @param payload the wrapping object;
* @param payload.searchText The string that will be used in the search query.
* @param [payload.token] The token of the conversation (if any), or "new" for a new one
* @param [payload.onlyUsers] Whether to return only registered users
* @param options options
*/
const autocompleteQuery = async function({ searchText, token, onlyUsers }: SearchPayload, options: object) {
token = token || 'new'
onlyUsers = !!onlyUsers

const shareTypes = [
SHARE.TYPE.USER,
!onlyUsers ? SHARE.TYPE.GROUP : null,
!onlyUsers ? SHARE.TYPE.CIRCLE : null,
(!onlyUsers && token !== 'new') ? SHARE.TYPE.EMAIL : null,
(!onlyUsers && canInviteToFederation) ? SHARE.TYPE.REMOTE : null,
].filter(type => type !== null)
const autocompleteQuery = async function({ searchText, token = 'new', onlyUsers = false }: SearchPayload, options: object) {
const shareTypes = onlyUsers
? [SHARE.TYPE.USER]
: [
SHARE.TYPE.USER,
SHARE.TYPE.GROUP,
SHARE.TYPE.CIRCLE,
token !== 'new' ? SHARE.TYPE.EMAIL : null,
canInviteToFederation ? SHARE.TYPE.REMOTE : null,
].filter(type => type !== null)

return axios.get(generateOcsUrl('core/autocomplete/get'), {
...options,
Expand Down

0 comments on commit f52f5ff

Please sign in to comment.