From 87cfdf99a52989aab5d57ca0c4744242039107fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 22 Jun 2021 16:36:18 +0200 Subject: Support contacts member type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/components/MemberList.vue | 12 ++++++++---- src/models/constants.ts | 12 +++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/MemberList.vue b/src/components/MemberList.vue index ffd8fb12..e8a1a6d7 100644 --- a/src/components/MemberList.vue +++ b/src/components/MemberList.vue @@ -151,11 +151,15 @@ export default { .map(type => parseInt(type, 10)) // Map populated types to the group entry .map(type => CIRCLES_MEMBER_GROUPING.find(group => group.type === type)) + // Removed undefined group + .filter(group => group !== undefined) // Injecting headings - .map(group => [{ - heading: true, - ...group, - }, ...(this.groupedList[group.type] || [])]) + .map(group => { + return [{ + heading: true, + ...group, + }, ...(this.groupedList[group.type] || [])] + }) // Merging sub-arrays .flat() }, diff --git a/src/models/constants.ts b/src/models/constants.ts index ae7b4374..d8356e17 100644 --- a/src/models/constants.ts +++ b/src/models/constants.ts @@ -156,11 +156,21 @@ export const CIRCLES_MEMBER_GROUPING = [ share: OC.Share.SHARE_TYPE_EMAIL, type: MEMBER_TYPE_MAIL }, + // TODO: implement SHARE_TYPE_CONTACT + { + id: `picker-contact`, + label: t('contacts', 'Contacts'), + share: OC.Share.SHARE_TYPE_EMAIL, + type: MEMBER_TYPE_CONTACT + }, ] // Generating a map between share types and circle member types export const SHARES_TYPES_MEMBER_MAP = CIRCLES_MEMBER_GROUPING.reduce((list, entry) => { - list[entry.share] = entry.type + // ! Ignore duplicate share types + if (!list[entry.share]) { + list[entry.share] = entry.type + } return list }, {}) -- cgit v1.2.3