From 8ed945a519bf91c0a6918b3fd678ac94ebf102b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 7 Nov 2018 15:40:50 +0100 Subject: [PATCH] Only show label if the shareWith value is relevant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For local users / groups the display name is enough to show, we just need details for email/remote shares Signed-off-by: Julius Härtl --- core/js/sharedialogview.js | 41 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 082bf9571d..e2ef8db90e 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -478,6 +478,24 @@ autocompleteRenderItem: function(ul, item) { var icon = 'icon-user'; var text = item.label; + var description = ''; + var type = ''; + var getTranslatedType = function(type) { + switch (type) { + case 'HOME': + return t('core', 'Home'); + case 'WORK': + return t('core', 'Work'); + case 'OTHER': + return t('core', 'Other'); + default: + return '' + type; + } + }; + if (typeof item.type !== 'undefined' && item.type !== null) { + type = getTranslatedType(item.type) + ' '; + } + if (typeof item.name !== 'undefined') { text = item.name; } @@ -485,37 +503,26 @@ icon = 'icon-contacts-dark'; } else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) { icon = 'icon-shared'; + description += item.value.shareWith; } else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) { text = t('core', '{sharee} (remote group)', { sharee: text }, undefined, { escape: false }); icon = 'icon-shared'; + description += item.value.shareWith; } else if (item.value.shareType === OC.Share.SHARE_TYPE_EMAIL) { icon = 'icon-mail'; + description += item.value.shareWith; } else if (item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) { text = t('core', '{sharee} ({type}, {owner})', {sharee: text, type: item.value.circleInfo, owner: item.value.circleOwner}, undefined, {escape: false}); icon = 'icon-circle'; } else if (item.value.shareType === OC.Share.SHARE_TYPE_ROOM) { icon = 'icon-talk'; } - var description = ''; - var getTranslatedType = function(type) { - switch (type) { - case 'HOME': - return t('core', 'Home'); - case 'WORK': - return t('core', 'Home'); - case 'OTHER': - return t('core', 'Other'); - default: - return type; - } - }; - if (typeof item.type !== 'undefined' && item.type !== null) { - description = getTranslatedType(item.type); - } + var insert = $("