Skip to content

Commit

Permalink
Merge pull request #12334 from nextcloud/bugfix/12164/share-dialog-us…
Browse files Browse the repository at this point in the history
…erid

Only show label if the shareWith value is relevant
  • Loading branch information
MorrisJobke authored Nov 7, 2018
2 parents 7940a79 + 8ed945a commit 35a9c51
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions core/js/sharedialogview.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,44 +478,51 @@
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;
}
if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) {
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 = $("<div class='share-autocomplete-item'/>");
if (item.merged) {
insert.addClass('merged');
text = item.value.shareWith;
description = type;
} else {
var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
if (item.value.shareType === OC.Share.SHARE_TYPE_USER || item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
Expand All @@ -526,7 +533,7 @@
}
avatar.imageplaceholder(item.uuid, text, 32);
}
description = item.value.shareWith;
description = type + description;
}
if (description !== '') {
insert.addClass('with-description');
Expand Down

0 comments on commit 35a9c51

Please sign in to comment.