From: Stefan Date: Wed, 16 Apr 2014 20:41:57 +0000 (+0200) Subject: Fix javascript error in calendar app X-Git-Tag: v7.0.0alpha2~407^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1d8eb4467710cf61503ec7e32e1f6c24a4479eb1;p=nextcloud-server.git Fix javascript error in calendar app 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 --- diff --git a/core/js/share.js b/core/js/share.js index 03202c1a61c..2813570f718 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -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 $( "
  • " ) - .append( "" + item.displayname + "
    " + item.email + "
    " ) - .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 $( "
  • " ) + .append( "" + item.displayname + "
    " + item.email + "
    " ) + .appendTo( ul ); + }; + } } else { html += '';