From 8e8812ce1fcb5950e43e0a5e19b8a7d4b8472b8d Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Tue, 6 Aug 2019 13:38:41 +0300 Subject: [PATCH] web: People: Fixed getContacts selector --- .../Client/src/store/people/selectors.js | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/products/ASC.People/Client/src/store/people/selectors.js b/products/ASC.People/Client/src/store/people/selectors.js index 8cd0991081..9975471c5b 100644 --- a/products/ASC.People/Client/src/store/people/selectors.js +++ b/products/ASC.People/Client/src/store/people/selectors.js @@ -64,34 +64,35 @@ export const getUserRole = user => { export const getContacts = (contacts) => { const pattern = { contact: [ - { type: "mail", value: "", icon: "MailIcon" }, - { type: "phone", value: "", icon: "PhoneIcon" }, - { type: "mobphone", value: "", icon: "MobileIcon" }, - { type: "gmail", value: "", icon: "GmailIcon" }, - { type: "skype", value: "", icon: "SkypeIcon" }, - { type: "msn", value: "", icon: "WindowsMsnIcon" }, - { type: "icq", value: "", icon: "IcqIcon" }, - { type: "jabber", value: "", icon: "JabberIcon" }, - { type: "aim", value: "", icon: "AimIcon" } + { type: "mail", icon: "MailIcon" }, + { type: "phone", icon: "PhoneIcon" }, + { type: "mobphone", icon: "MobileIcon" }, + { type: "gmail", icon: "GmailIcon" }, + { type: "skype", icon: "SkypeIcon" }, + { type: "msn", icon: "WindowsMsnIcon" }, + { type: "icq", icon: "IcqIcon" }, + { type: "jabber", icon: "JabberIcon" }, + { type: "aim", icon: "AimIcon" } ], social: [ - { type: "facebook", value: "", icon: "ShareFacebookIcon" }, - { type: "livejournal", value: "", icon: "LivejournalIcon" }, - { type: "myspace", value: "", icon: "MyspaceIcon" }, - { type: "twitter", value: "", icon: "ShareTwitterIcon" }, - { type: "blogger", value: "", icon: "BloggerIcon" }, - { type: "yahoo", value: "", icon: "YahooIcon" } + { type: "facebook", icon: "ShareFacebookIcon" }, + { type: "livejournal", icon: "LivejournalIcon" }, + { type: "myspace", icon: "MyspaceIcon" }, + { type: "twitter", icon: "ShareTwitterIcon" }, + { type: "blogger", icon: "BloggerIcon" }, + { type: "yahoo", icon: "YahooIcon" } ] }; const mapContacts = (a, b) => { - return a.map(a => ({ ...a, ...b.find(({ type }) => type === a.type) })).filter(c => c.value !== ""); + return a.map(a => ({ ...a, ...b.find(({ type }) => type === a.type) })) + .filter(c => (c.value !== "" && c.icon)); } let info = {}; - info.contact = mapContacts(pattern.contact, contacts); - info.social = mapContacts(pattern.social, contacts); + info.contact = mapContacts(contacts, pattern.contact); + info.social = mapContacts(contacts, pattern.social); return info; };