Skip to content

Commit 002c5a7

Browse files
committed
fix: allow to add e-mail guests when creating a conversation
- introduce 'forceTypes' in autocomplete request Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
1 parent bc72459 commit 002c5a7

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/components/NewConversationDialog/NewConversationContactsPage.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import DialpadPanel from '../UIShared/DialpadPanel.vue'
7676
import TransitionWrapper from '../UIShared/TransitionWrapper.vue'
7777
7878
import { useArrowNavigation } from '../../composables/useArrowNavigation.js'
79+
import { SHARE } from '../../constants.js'
7980
import { autocompleteQuery } from '../../services/coreService.ts'
8081
import CancelableRequest from '../../utils/cancelableRequest.js'
8182
@@ -208,7 +209,11 @@ export default {
208209
const { request, cancel } = CancelableRequest(autocompleteQuery)
209210
this.cancelSearchPossibleConversations = cancel
210211
211-
const response = await request({ searchText: this.searchText })
212+
const response = await request({
213+
searchText: this.searchText,
214+
token: 'new',
215+
forceTypes: [SHARE.TYPE.EMAIL], // e-mail guests are allowed directly after conversation creation
216+
})
212217
213218
this.searchResults = response?.data?.ocs?.data || []
214219
if (this.searchResults.length === 0) {

src/services/coreService.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type SearchPayload = {
1717
searchText: string
1818
token?: string | 'new'
1919
onlyUsers?: boolean
20+
forceTypes?: typeof SHARE.TYPE[keyof typeof SHARE.TYPE][]
2021
}
2122

2223
/**
@@ -26,18 +27,19 @@ type SearchPayload = {
2627
* @param payload.searchText The string that will be used in the search query.
2728
* @param [payload.token] The token of the conversation (if any) | 'new' for new conversations
2829
* @param [payload.onlyUsers] Whether to return only registered users
30+
* @param [payload.forceTypes] Whether to force some types to be included in query
2931
* @param options options
3032
*/
31-
const autocompleteQuery = async function({ searchText, token = 'new', onlyUsers = false }: SearchPayload, options: object) {
33+
const autocompleteQuery = async function({ searchText, token = 'new', onlyUsers = false, forceTypes = [] }: SearchPayload, options: object) {
3234
const shareTypes = onlyUsers
33-
? [SHARE.TYPE.USER]
35+
? [SHARE.TYPE.USER].concat(forceTypes)
3436
: [
3537
SHARE.TYPE.USER,
3638
SHARE.TYPE.GROUP,
3739
SHARE.TYPE.CIRCLE,
3840
token !== 'new' ? SHARE.TYPE.EMAIL : null,
3941
canInviteToFederation ? SHARE.TYPE.REMOTE : null,
40-
].filter(type => type !== null)
42+
].filter(type => type !== null).concat(forceTypes)
4143

4244
return axios.get(generateOcsUrl('core/autocomplete/get'), {
4345
...options,

0 commit comments

Comments
 (0)