]> source.dussan.org Git - nextcloud-server.git/commitdiff
show display name but internally use the user name
authorBjörn Schießle <bjoern@schiessle.org>
Mon, 14 Dec 2015 15:04:05 +0000 (16:04 +0100)
committerBjörn Schießle <bjoern@schiessle.org>
Mon, 14 Dec 2015 16:25:10 +0000 (17:25 +0100)
apps/files_sharing/ajax/external.php
apps/files_sharing/js/external.js
apps/files_sharing/js/public.js
apps/files_sharing/lib/controllers/sharecontroller.php
apps/files_sharing/templates/public.php
apps/files_sharing/tests/controller/sharecontroller.php

index 65861ac6a041214f33b599d7db1f042e02cbd1f4..2ba1cb470c29eb8f6e0974af8515e7146112af3d 100644 (file)
@@ -40,6 +40,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'];
 
@@ -76,7 +77,7 @@ if (substr($remote, 0, 5) === 'https') {
        }
 }
 
-$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
index f658de307ab8912d98a3885289cd7042be5fcc15..45a6ef027586b1e76b59c6862d164db65cfff9d5 100644 (file)
@@ -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') {
index 70c1ba5c0c23913cc80192f5e5463031bca4eb7b..af808447381eb0ff9a11bbeabd4db5ea33564a7c 100644 (file)
@@ -242,9 +242,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);
                });
 
                $('#remote_address').on("keyup paste", function() {
@@ -291,7 +292,7 @@ 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;
                
                if(remote.substr(-1) !== '/') {
@@ -299,7 +300,7 @@ OCA.Sharing.PublicApp = {
                };
 
                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) {
index fe7b159449cec63c798ca1ef7e92e9af254a96b6..e28019c358c1f3594711f4ffd85e12710e774672 100644 (file)
@@ -181,6 +181,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);
index b5dd653d718b01980c688685c38eb48d6214c939..046f954106a34ed03e84bee161a3d3e137fa8fb8 100644 (file)
@@ -72,7 +72,7 @@ $thumbSize = 1024;
                                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"/>
index ccef4263c2b029293e4a016b45a7a797dc07c22a..168488f5613c73edc5131fe119e047fb2f98b169 100644 (file)
@@ -168,6 +168,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',