diff options
author | Stefan <mu.stefan@googlemail.com> | 2014-04-16 22:41:57 +0200 |
---|---|---|
committer | Stefan <mu.stefan@googlemail.com> | 2014-04-16 22:41:57 +0200 |
commit | 1d8eb4467710cf61503ec7e32e1f6c24a4479eb1 (patch) | |
tree | 1be154977bd8c87ab7e9eed4d3adb0da0d1008e7 /core/js/share.js | |
parent | 7178e3956933242188fbd186f2b8308546bbb0fe (diff) | |
download | nextcloud-server-1d8eb4467710cf61503ec7e32e1f6c24a4479eb1.tar.gz nextcloud-server-1d8eb4467710cf61503ec7e32e1f6c24a4479eb1.zip |
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
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 40 |
1 files changed, 21 insertions, 19 deletions
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 $( "<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"/>'; |