]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix javascript error in calendar app
authorStefan <mu.stefan@googlemail.com>
Wed, 16 Apr 2014 20:41:57 +0000 (22:41 +0200)
committerStefan <mu.stefan@googlemail.com>
Wed, 16 Apr 2014 20:41:57 +0000 (22:41 +0200)
Fix owncloud/calendar#409
If you haven't allowed to share items per email the element "email" will never appear and you will get a null exception.

License: WTFPL

core/js/share.js

index 03202c1a61c3ad1771180fb93b50102b882af21b..2813570f718d91bbce3a8bcc9def35fd18d4ffe6 100644 (file)
@@ -331,25 +331,27 @@ OC.Share={
                                        .append( insert )
                                        .appendTo( ul );
                        };
-                       $('#email').autocomplete({
-                               minLength: 1,
-                               source: function (search, response) {
-                                       $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWithEmail', search: search.term }, function(result) {
-                                               if (result.status == 'success' && result.data.length > 0) {
-                                                       response(result.data);
-                                               }
-                                       });
-                                       },
-                               select: function( event, item ) {
-                                       $('#email').val(item.item.email);
-                                       return false;
-                               }
-                       })
-                       .data("ui-autocomplete")._renderItem = function( ul, item ) {
-                               return $( "<li>" )
-                                       .append( "<a>" + item.displayname + "<br>" + item.email + "</a>" )
-                                       .appendTo( ul );
-                       };
+                       if (link) {
+                               $('#email').autocomplete({
+                                       minLength: 1,
+                                       source: function (search, response) {
+                                               $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWithEmail', search: search.term }, function(result) {
+                                                       if (result.status == 'success' && result.data.length > 0) {
+                                                               response(result.data);
+                                                       }
+                                               });
+                                               },
+                                       select: function( event, item ) {
+                                               $('#email').val(item.item.email);
+                                               return false;
+                                       }
+                               })
+                               .data("ui-autocomplete")._renderItem = function( ul, item ) {
+                                       return $( "<li>" )
+                                               .append( "<a>" + item.displayname + "<br>" + item.email + "</a>" )
+                                               .appendTo( ul );
+                               };
+                       }
 
                } else {
                        html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Resharing is not allowed')+'" style="width:90%;" disabled="disabled"/>';