diff options
author | Björn Schießle <bjoern@schiessle.org> | 2015-12-14 16:04:05 +0100 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2015-12-15 11:43:17 +0100 |
commit | 2f6caa30753214f6d4ad2fc3b9f0b5956a96b06f (patch) | |
tree | 8937e3ef78b9cbca29242544e4d6c3f8b3c8cdf8 /apps | |
parent | c8366f3de580495441b1495b56b2ccdb8f619508 (diff) | |
download | nextcloud-server-2f6caa30753214f6d4ad2fc3b9f0b5956a96b06f.tar.gz nextcloud-server-2f6caa30753214f6d4ad2fc3b9f0b5956a96b06f.zip |
show display name but internally use the user name
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/ajax/external.php | 3 | ||||
-rw-r--r-- | apps/files_sharing/js/external.js | 3 | ||||
-rw-r--r-- | apps/files_sharing/js/public.js | 7 | ||||
-rw-r--r-- | apps/files_sharing/lib/controllers/sharecontroller.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/templates/public.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/controller/sharecontroller.php | 1 |
6 files changed, 11 insertions, 6 deletions
diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php index 7c41dc96813..4e6ea6126b3 100644 --- a/apps/files_sharing/ajax/external.php +++ b/apps/files_sharing/ajax/external.php @@ -21,6 +21,7 @@ if (OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) { $token = $_POST['token']; $remote = $_POST['remote']; $owner = $_POST['owner']; +$ownerDisplayName = $_POST['ownerDisplayName']; $name = $_POST['name']; $password = $_POST['password']; @@ -51,7 +52,7 @@ if (substr($remote, 0, 5) === 'https' and !OC_Util::getUrlContent($remote)) { \OCP\JSON::error(array('data' => array('message' => $l->t('Invalid or untrusted SSL certificate')))); exit; } else { - $mount = $externalManager->addShare($remote, $token, $password, $name, $owner, true); + $mount = $externalManager->addShare($remote, $token, $password, $name, $ownerDisplayName, true); /** * @var \OCA\Files_Sharing\External\Storage $storage diff --git a/apps/files_sharing/js/external.js b/apps/files_sharing/js/external.js index f658de307ab..45a6ef02758 100644 --- a/apps/files_sharing/js/external.js +++ b/apps/files_sharing/js/external.js @@ -19,7 +19,7 @@ */ OCA.Sharing.showAddExternalDialog = function (share, passwordProtected, callback) { var remote = share.remote; - var owner = share.owner; + var owner = share.ownerDisplayName || share.owner; var name = share.name; var remoteClean = (remote.substr(0, 8) === 'https://') ? remote.substr(8) : remote.substr(7); @@ -92,6 +92,7 @@ remote: share.remote, token: share.token, owner: share.owner, + ownerDisplayName: share.ownerDisplayName || share.owner, name: share.name, password: password}, function(result) { if (result.status === 'error') { diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index c2dd6d3ed38..a36a2a822ee 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -194,9 +194,10 @@ OCA.Sharing.PublicApp = { var remote = $(this).find('input[type="text"]').val(); var token = $('#sharingToken').val(); var owner = $('#save').data('owner'); + var ownerDisplayName = $('#save').data('owner-display-name'); var name = $('#save').data('name'); var isProtected = $('#save').data('protected') ? 1 : 0; - OCA.Sharing.PublicApp._saveToOwnCloud(remote, token, owner, name, isProtected); + OCA.Sharing.PublicApp._saveToOwnCloud(remote, token, owner, ownerDisplayName, name, isProtected); }); $('#save #save-button').click(function () { @@ -220,11 +221,11 @@ OCA.Sharing.PublicApp = { this.fileList.changeDirectory(params.path || params.dir, false, true); }, - _saveToOwnCloud: function(remote, token, owner, name, isProtected) { + _saveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) { var location = window.location.protocol + '//' + window.location.host + OC.webroot; var url = remote + '/index.php/apps/files#' + 'remote=' + encodeURIComponent(location) // our location is the remote for the other server - + "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected; + + "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) +"&ownerDisplayName=" + encodeURIComponent(ownerDisplayName) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected; if (remote.indexOf('://') > 0) { diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index 71aef146f82..27d5dd07dac 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -162,6 +162,7 @@ class ShareController extends Controller { $shareTmpl = []; $shareTmpl['displayName'] = User::getDisplayName($shareOwner); + $shareTmpl['owner'] = $shareOwner; $shareTmpl['filename'] = $file; $shareTmpl['directory_path'] = $linkItem['file_target']; $shareTmpl['mimetype'] = Filesystem::getMimeType($originalSharePath); diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index e04643b9df8..7698fa3dc80 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -60,7 +60,7 @@ $previewSupported = OC\Preview::isMimeSupported($_['mimetype']) ? 'true' : 'fals if ($_['server2serversharing']) { ?> <span id="save" data-protected="<?php p($_['protected']) ?>" - data-owner="<?php p($_['displayName']) ?>" data-name="<?php p($_['filename']) ?>"> + data-owner-display-name="<?php p($_['displayName']) ?>" data-owner="<?php p($_['owner']) ?>" data-name="<?php p($_['filename']) ?>"> <button id="save-button"><?php p($l->t('Add to your ownCloud')) ?></button> <form class="save-form hidden" action="#"> <input type="text" id="remote_address" placeholder="example.com/owncloud"/> diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php index 11e0e236e7b..573533ee0f7 100644 --- a/apps/files_sharing/tests/controller/sharecontroller.php +++ b/apps/files_sharing/tests/controller/sharecontroller.php @@ -158,6 +158,7 @@ class ShareControllerTest extends \Test\TestCase { $response = $this->shareController->showShare($this->token); $sharedTmplParams = array( 'displayName' => $this->user, + 'owner' => $this->user, 'filename' => 'file1.txt', 'directory_path' => '/file1.txt', 'mimetype' => 'text/plain', |