Merge pull request #14585 from owncloud/fix-avatars-for-users-with-at

Use custom attribute instead of the div identifier
This commit is contained in:
Lukas Reschke 2015-02-27 18:40:53 +01:00
commit 13b0b7dfaf
2 changed files with 3 additions and 3 deletions

View File

@ -666,7 +666,7 @@ OC.Share={
html += '<a href="#" class="unshare"><img class="svg" alt="'+t('core', 'Unshare')+'" title="'+t('core', 'Unshare')+'" src="'+OC.imagePath('core', 'actions/delete')+'"/></a>'; html += '<a href="#" class="unshare"><img class="svg" alt="'+t('core', 'Unshare')+'" title="'+t('core', 'Unshare')+'" src="'+OC.imagePath('core', 'actions/delete')+'"/></a>';
if (oc_config.enable_avatars === true) { if (oc_config.enable_avatars === true) {
if (shareType === OC.Share.SHARE_TYPE_USER) { if (shareType === OC.Share.SHARE_TYPE_USER) {
html += '<div id="avatar-' + escapeHTML(shareWith) + '" class="avatar"></div>'; html += '<div data-user="' + escapeHTML(shareWith) + '" class="avatar"></div>';
} else { } else {
html += '<div class="avatar" style="padding-right: 32px"></div>'; html += '<div class="avatar" style="padding-right: 32px"></div>';
} }
@ -703,7 +703,7 @@ OC.Share={
html += '</li>'; html += '</li>';
html = $(html).appendTo('#shareWithList'); html = $(html).appendTo('#shareWithList');
if (oc_config.enable_avatars === true && shareType === OC.Share.SHARE_TYPE_USER) { if (oc_config.enable_avatars === true && shareType === OC.Share.SHARE_TYPE_USER) {
$('#avatar-' + escapeHTML(shareWith)).avatar(escapeHTML(shareWith), 32); $('.avatar[data-user="' + escapeHTML(shareWith) + '"]').avatar(escapeHTML(shareWith), 32);
} }
// insert cruds button into last label element // insert cruds button into last label element
var lastLabel = html.find('>label:last'); var lastLabel = html.find('>label:last');

View File

@ -459,7 +459,7 @@ describe('OC.Share tests', function() {
expect($('#shareWithList').children().length).toEqual(2); expect($('#shareWithList').children().length).toEqual(2);
expect($('#avatar-user1').length).toEqual(1); expect($('.avatar[data-user="user1"]').length).toEqual(1);
expect(args.length).toEqual(2); expect(args.length).toEqual(2);
expect(args[0]).toEqual('user1'); expect(args[0]).toEqual('user1');
}); });