diff --git a/lib/Service/Group/ContactsGroupService.php b/lib/Service/Group/ContactsGroupService.php index e8780ba78d..3db47971e8 100644 --- a/lib/Service/Group/ContactsGroupService.php +++ b/lib/Service/Group/ContactsGroupService.php @@ -97,7 +97,9 @@ public function getUsers(string $groupId): array { } foreach ($emails as $email) { $receivers[] = [ - 'email' => $email + 'id' => $r['UID'], + 'name' => $r['FN'] ?: $email, + 'email' => $email, ]; } } diff --git a/lib/Service/GroupsIntegration.php b/lib/Service/GroupsIntegration.php index 3e4bb64e27..2bd330d602 100644 --- a/lib/Service/GroupsIntegration.php +++ b/lib/Service/GroupsIntegration.php @@ -51,6 +51,7 @@ public function getMatchingGroups(string $term): array { 'label' => $g['name'] . ' (' . $gs->getNamespace() . ')', 'email' => $gid, 'source' => 'groups', + 'contents' => $gs->getUsers($g['id']), ]; } } diff --git a/src/components/Composer.vue b/src/components/Composer.vue index 846c9ece14..97626fcc60 100644 --- a/src/components/Composer.vue +++ b/src/components/Composer.vue @@ -1523,11 +1523,24 @@ export default { let changed = false if (option.id) { - if (!existing.has(option.email.toLowerCase())) { - const recipient = { ...option } - this.newRecipients.push(recipient) - list.push(recipient) - changed = true + let toAdd + + if (option.contents) { + toAdd = option.contents.map((content) => ({ + email: content.email, + label: content.name, + })) + } else { + toAdd = [option] + } + + for (const opt of toAdd) { + if (!existing.has(opt.email.toLowerCase())) { + const recipient = { ...opt } + this.newRecipients.push(recipient) + list.push(recipient) + changed = true + } } } else { const emailList = parseEmailList(option.email)