Skip to content

Commit 8e818d7

Browse files
Merge pull request #11193 from nextcloud/feat/composer/autocomplete-own-identifies
feat(composer): suggest recipients from own identities
2 parents 3e1af3d + 6fc54b4 commit 8e818d7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/components/Composer.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,20 @@ export default {
12271227
this.loadingIndicatorCc = addressType === 'cc'
12281228
this.loadingIndicatorBcc = addressType === 'bcc'
12291229
this.recipientSearchTerms[addressType] = term
1230+
1231+
// Autocomplete from own identifies (useful for testing)
1232+
const accounts = this.accounts.filter((a) => !a.isUnified)
1233+
const selfRecipients = accounts
1234+
.filter(
1235+
account => account.emailAddress.toLowerCase().indexOf(term.toLowerCase()) !== -1
1236+
|| account.name.toLowerCase().indexOf(term.toLowerCase()) !== -1,
1237+
)
1238+
.map(account => ({
1239+
email: account.emailAddress,
1240+
label: account.name,
1241+
}))
1242+
this.autocompleteRecipients = uniqBy('email')(this.autocompleteRecipients.concat(selfRecipients))
1243+
12301244
debouncedSearch(term).then((results) => {
12311245
if (addressType === 'to') {
12321246
this.loadingIndicatorTo = false

0 commit comments

Comments
 (0)