]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed share with link checkbox missing as regular user
authorVincent Petry <pvince81@owncloud.com>
Mon, 21 Oct 2013 09:29:40 +0000 (11:29 +0200)
committerVincent Petry <pvince81@owncloud.com>
Mon, 21 Oct 2013 09:29:40 +0000 (11:29 +0200)
Instead of loading the app config setting "shareapi_allow_links" using a
synchronous ajax call that fails when the user is not an admin, this fix
puts the flag directly in the template so it doesn't need to be loaded
afterwards.

Fixes #5440

apps/files/index.php
apps/files/templates/index.php
core/js/share.js

index 8d877be8ac981a9a2f0ffb6e4861dcf8ed6653d7..2f1e084560bce3bc37e34adfb35552333db39081 100644 (file)
@@ -138,6 +138,7 @@ if ($needUpgrade) {
        $tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
        $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
        $tmpl->assign("mailNotificationEnabled", \OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'yes'));
+       $tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
        $tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
        $tmpl->assign('disableSharing', false);
        $tmpl->assign('ajaxLoad', $ajaxLoad);
index 32a59f1e1a6a03e6b9687a6c73355ef18e6e05d8..001adb77ab5a035289c7a21664dcfc3d41b55571 100644 (file)
 <input type="hidden" name="encryptedFiles" id="encryptedFiles" value="<?php $_['encryptedFiles'] ? p('1') : p('0'); ?>" />
 <input type="hidden" name="encryptedInitStatus" id="encryptionInitStatus" value="<?php p($_['encryptionInitStatus']) ?>" />
 <input type="hidden" name="mailNotificationEnabled" id="mailNotificationEnabled" value="<?php p($_['mailNotificationEnabled']) ?>" />
+<input type="hidden" name="allowShareWithLink" id="allowShareWithLink" value="<?php p($_['allowShareWithLink']) ?>" />
+
index 6ec15f01c1eaaadd53a5863f80af332520a80497..9c606b9de62268478115693fc4b3465734db08a0 100644 (file)
@@ -203,18 +203,7 @@ OC.Share={
                        html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Share with')+'" />';
                        html += '<ul id="shareWithList">';
                        html += '</ul>';
-                       var linksAllowed = false;
-                       $.ajax({
-                               type: 'GET',
-                               url: OC.filePath('core', 'ajax', 'appconfig.php'),
-                               data: { action:'getValue', app:'core', key:'shareapi_allow_links', defaultValue:'yes' },
-                               async: false,
-                               success: function(result) {
-                                       if (result && result.status === 'success' && result.data === 'yes') {
-                                               linksAllowed = true;
-                                       }
-                               }
-                       });
+                       var linksAllowed = $('#allowShareWithLink').val() === 'yes';
                        if (link && linksAllowed) {
                                html += '<div id="link">';
                                html += '<input type="checkbox" name="linkCheckbox" id="linkCheckbox" value="1" /><label for="linkCheckbox">'+t('core', 'Share with link')+'</label>';