]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use custom attribute instead of the div identifier
authorLukas Reschke <lukas@owncloud.com>
Fri, 27 Feb 2015 16:38:59 +0000 (17:38 +0100)
committerLukas Reschke <lukas@owncloud.com>
Fri, 27 Feb 2015 16:38:59 +0000 (17:38 +0100)
Otherwise problems arrive when a username contains characters such as an `@`

Fixes https://github.com/owncloud/user_shibboleth/issues/38

core/js/share.js
core/js/tests/specs/shareSpec.js

index 692ce0b0ba046f75d53d654b8c50913df27b119f..2370916e8bedb53e32179aaacbb18dabd506129c 100644 (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>';
                        if (oc_config.enable_avatars === true) {
                                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 {
                                        html += '<div class="avatar" style="padding-right: 32px"></div>';
                                }
@@ -703,7 +703,7 @@ OC.Share={
                        html += '</li>';
                        html = $(html).appendTo('#shareWithList');
                        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
                        var lastLabel = html.find('>label:last');
index 1856fc27bc6835fa756fc397890f85dffbb14538..bcdc1df3d37deb0a5ab48c0c2c8bcc0189733198 100644 (file)
@@ -459,7 +459,7 @@ describe('OC.Share tests', function() {
 
                                        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[0]).toEqual('user1');
                                });