Skip to content

Commit 35a9c51

Browse files
authored
Merge pull request #12334 from nextcloud/bugfix/12164/share-dialog-userid
Only show label if the shareWith value is relevant
2 parents 7940a79 + 8ed945a commit 35a9c51

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

core/js/sharedialogview.js

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -478,44 +478,51 @@
478478
autocompleteRenderItem: function(ul, item) {
479479
var icon = 'icon-user';
480480
var text = item.label;
481+
var description = '';
482+
var type = '';
483+
var getTranslatedType = function(type) {
484+
switch (type) {
485+
case 'HOME':
486+
return t('core', 'Home');
487+
case 'WORK':
488+
return t('core', 'Work');
489+
case 'OTHER':
490+
return t('core', 'Other');
491+
default:
492+
return '' + type;
493+
}
494+
};
495+
if (typeof item.type !== 'undefined' && item.type !== null) {
496+
type = getTranslatedType(item.type) + ' ';
497+
}
498+
481499
if (typeof item.name !== 'undefined') {
482500
text = item.name;
483501
}
484502
if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) {
485503
icon = 'icon-contacts-dark';
486504
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) {
487505
icon = 'icon-shared';
506+
description += item.value.shareWith;
488507
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) {
489508
text = t('core', '{sharee} (remote group)', { sharee: text }, undefined, { escape: false });
490509
icon = 'icon-shared';
510+
description += item.value.shareWith;
491511
} else if (item.value.shareType === OC.Share.SHARE_TYPE_EMAIL) {
492512
icon = 'icon-mail';
513+
description += item.value.shareWith;
493514
} else if (item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
494515
text = t('core', '{sharee} ({type}, {owner})', {sharee: text, type: item.value.circleInfo, owner: item.value.circleOwner}, undefined, {escape: false});
495516
icon = 'icon-circle';
496517
} else if (item.value.shareType === OC.Share.SHARE_TYPE_ROOM) {
497518
icon = 'icon-talk';
498519
}
499-
var description = '';
500-
var getTranslatedType = function(type) {
501-
switch (type) {
502-
case 'HOME':
503-
return t('core', 'Home');
504-
case 'WORK':
505-
return t('core', 'Home');
506-
case 'OTHER':
507-
return t('core', 'Other');
508-
default:
509-
return type;
510-
}
511-
};
512-
if (typeof item.type !== 'undefined' && item.type !== null) {
513-
description = getTranslatedType(item.type);
514-
}
520+
515521
var insert = $("<div class='share-autocomplete-item'/>");
516522
if (item.merged) {
517523
insert.addClass('merged');
518524
text = item.value.shareWith;
525+
description = type;
519526
} else {
520527
var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
521528
if (item.value.shareType === OC.Share.SHARE_TYPE_USER || item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
@@ -526,7 +533,7 @@
526533
}
527534
avatar.imageplaceholder(item.uuid, text, 32);
528535
}
529-
description = item.value.shareWith;
536+
description = type + description;
530537
}
531538
if (description !== '') {
532539
insert.addClass('with-description');

0 commit comments

Comments
 (0)