From 2f23054b0126ec3497a7b632ff2399f6f3843a0f Mon Sep 17 00:00:00 2001
From: Bjoern Schiessle <bjoern@schiessle.org>
Date: Tue, 12 Jul 2016 16:30:09 +0200
Subject: [PATCH] s/ownCloud/Nextcloud

---
 apps/federatedfilesharing/appinfo/routes.php     |  2 +-
 ...troller.php => SaveToNextcloudController.php} |  8 ++++----
 ...est.php => SaveToNextcloudControllerTest.php} | 16 ++++++++--------
 apps/files_sharing/ajax/external.php             |  4 +---
 apps/files_sharing/js/external.js                |  1 -
 apps/files_sharing/js/public.js                  | 10 +++++-----
 6 files changed, 19 insertions(+), 22 deletions(-)
 rename apps/federatedfilesharing/lib/Controller/{SaveToOwnCloudController.php => SaveToNextcloudController.php} (92%)
 rename apps/federatedfilesharing/tests/Controller/{SaveToOwnCloudControllerTest.php => SaveToNextcloudControllerTest.php} (91%)

diff --git a/apps/federatedfilesharing/appinfo/routes.php b/apps/federatedfilesharing/appinfo/routes.php
index 534733e001f..2a90ef5b59b 100644
--- a/apps/federatedfilesharing/appinfo/routes.php
+++ b/apps/federatedfilesharing/appinfo/routes.php
@@ -21,6 +21,6 @@
 
 return [
 	'routes' => [
-		['name' => 'SaveToOwnCloud#saveToOwnCloud', 'url' => '/saveToOwnCloud', 'verb' => 'POST'],
+		['name' => 'SaveToNextcloud#saveToNextcloud', 'url' => '/saveToNextcloud', 'verb' => 'POST'],
 	]
 ];
diff --git a/apps/federatedfilesharing/lib/Controller/SaveToOwnCloudController.php b/apps/federatedfilesharing/lib/Controller/SaveToNextcloudController.php
similarity index 92%
rename from apps/federatedfilesharing/lib/Controller/SaveToOwnCloudController.php
rename to apps/federatedfilesharing/lib/Controller/SaveToNextcloudController.php
index 2318d21afb5..f2788cf1ccd 100644
--- a/apps/federatedfilesharing/lib/Controller/SaveToOwnCloudController.php
+++ b/apps/federatedfilesharing/lib/Controller/SaveToNextcloudController.php
@@ -32,7 +32,7 @@ use OCP\IRequest;
 use OCP\ISession;
 use OCP\Share\IManager;
 
-class SaveToOwnCloudController extends Controller {
+class SaveToNextcloudController extends Controller {
 
 	/** @var FederatedShareProvider */
 	private $federatedShareProvider;
@@ -47,7 +47,7 @@ class SaveToOwnCloudController extends Controller {
 	private $session;
 
 	/**
-	 * SaveToOwnCloudController constructor.
+	 * SaveToNextcloudController constructor.
 	 *
 	 * @param string $appName
 	 * @param IRequest $request
@@ -72,7 +72,7 @@ class SaveToOwnCloudController extends Controller {
 	}
 
 	/**
-	 * save public link to my ownCloud by asking the owner to create a federated
+	 * save public link to my Nextcloud by asking the owner to create a federated
 	 * share with me
 	 *
 	 * @NoCSRFRequired
@@ -83,7 +83,7 @@ class SaveToOwnCloudController extends Controller {
 	 * @param string $password
 	 * @return JSONResponse
 	 */
-	public function saveToOwnCloud($shareWith, $token, $password = '') {
+	public function saveToNextcloud($shareWith, $token, $password = '') {
 
 		try {
 			list(, $server) = $this->addressHandler->splitUserRemote($shareWith);
diff --git a/apps/federatedfilesharing/tests/Controller/SaveToOwnCloudControllerTest.php b/apps/federatedfilesharing/tests/Controller/SaveToNextcloudControllerTest.php
similarity index 91%
rename from apps/federatedfilesharing/tests/Controller/SaveToOwnCloudControllerTest.php
rename to apps/federatedfilesharing/tests/Controller/SaveToNextcloudControllerTest.php
index 9189ac76601..60136212c31 100644
--- a/apps/federatedfilesharing/tests/Controller/SaveToOwnCloudControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/SaveToNextcloudControllerTest.php
@@ -24,7 +24,7 @@ namespace OCA\FederatedFileSharing\Tests\Controller;
 
 use OC\HintException;
 use OCA\FederatedFileSharing\AddressHandler;
-use OCA\FederatedFileSharing\Controller\SaveToOwnCloudController;
+use OCA\FederatedFileSharing\Controller\SaveToNextcloudController;
 use OCA\FederatedFileSharing\FederatedShareProvider;
 use OCP\AppFramework\Http;
 use OCP\Files\IRootFolder;
@@ -34,9 +34,9 @@ use OCP\Share;
 use OCP\Share\IManager;
 use OCP\Share\IShare;
 
-class SaveToOwnCloudControllerTest extends \Test\TestCase {
+class SaveToNextcloudControllerTest extends \Test\TestCase {
 
-	/** @var  SaveToOwnCloudController */
+	/** @var  SaveToNextcloudController */
 	private $controller;
 
 	/** @var  \OCP\IRequest | \PHPUnit_Framework_MockObject_MockObject */
@@ -77,7 +77,7 @@ class SaveToOwnCloudControllerTest extends \Test\TestCase {
 		$this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
 		$this->session = $this->getMock('OCP\ISession');
 
-		$this->controller = new SaveToOwnCloudController(
+		$this->controller = new SaveToNextcloudController(
 			'federatedfilesharing', $this->request,
 			$this->federatedShareProvider,
 			$this->shareManager,
@@ -87,7 +87,7 @@ class SaveToOwnCloudControllerTest extends \Test\TestCase {
 	}
 
 	/**
-	 * @dataProvider dataTestSaveToOwnCloud
+	 * @dataProvider dataTestSaveToNextcloud
 	 *
 	 * @param string $shareWith
 	 * @param bool $validShareWith
@@ -96,7 +96,7 @@ class SaveToOwnCloudControllerTest extends \Test\TestCase {
 	 * @param bool $createSuccessful
 	 * @param string $expectedReturnData
 	 */
-	public function testSaveToOwnCloud($shareWith, $validShareWith, $token, $validToken, $createSuccessful, $expectedReturnData) {
+	public function testSaveToNextcloud($shareWith, $validShareWith, $token, $validToken, $createSuccessful, $expectedReturnData) {
 		$this->addressHandler->expects($this->any())->method('splitUserRemote')
 			->with($shareWith)
 			->willReturnCallback(
@@ -133,7 +133,7 @@ class SaveToOwnCloudControllerTest extends \Test\TestCase {
 				}
 			);
 
-		$result = $this->controller->saveToOwnCloud($shareWith, $token);
+		$result = $this->controller->saveToNextcloud($shareWith, $token);
 
 		$errorCase = !$validShareWith || !$validToken || !$createSuccessful;
 
@@ -150,7 +150,7 @@ class SaveToOwnCloudControllerTest extends \Test\TestCase {
 
 	}
 
-	public function dataTestSaveToOwnCloud() {
+	public function dataTestSaveToNextcloud() {
 		return [
 			//shareWith, validShareWith, token, validToken, createSuccessful, expectedReturnData
 			['user@server', true, 'token', true, true, 'server'],
diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php
index d57d333c7ee..20c3706c12d 100644
--- a/apps/files_sharing/ajax/external.php
+++ b/apps/files_sharing/ajax/external.php
@@ -50,10 +50,8 @@ $shareWith = \OCP\User::getUser() . '@' . $urlGenerator->getAbsoluteURL('/');
 
 $httpClient = \OC::$server->getHTTPClientService()->newClient();
 
-error_log("do th post");
-
 try {
-	$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/saveToOwnCloud',
+	$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/saveToNextcloud',
 		[
 			'body' =>
 				[
diff --git a/apps/files_sharing/js/external.js b/apps/files_sharing/js/external.js
index be384818c3c..a04a5721f37 100644
--- a/apps/files_sharing/js/external.js
+++ b/apps/files_sharing/js/external.js
@@ -99,7 +99,6 @@
 				var callbackAddShare = function(result, share) {
 					var password = share.password || '';
 					if (result) {
-						//$.post(OC.generateUrl('/apps/files_sharing/api/externalShares'), {id: share.id});
 						$.post(OC.generateUrl('apps/files_sharing/external'), {
 							remote: share.remote,
 							token: share.token,
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 4293c7b310b..6bc31879d0f 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -247,7 +247,7 @@ OCA.Sharing.PublicApp = {
 			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, ownerDisplayName, name, isProtected);
+			OCA.Sharing.PublicApp._saveToNextcloud(remote, token, owner, ownerDisplayName, name, isProtected);
 		});
 
 		$('#remote_address').on("keyup paste", function() {
@@ -307,7 +307,7 @@ OCA.Sharing.PublicApp = {
 	 * @param isProtected
 	 * @private
 	 */
-	_legacySaveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) {
+	_legacySaveToNextcloud: function (remote, token, owner, ownerDisplayName, name, isProtected) {
 
 		var location = window.location.protocol + '//' + window.location.host + OC.webroot;
 
@@ -335,7 +335,7 @@ OCA.Sharing.PublicApp = {
 		}
 	},
 
-	_saveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) {
+	_saveToNextcloud: function (remote, token, owner, ownerDisplayName, name, isProtected) {
 
 		var toggleLoading = function() {
 			var iconClass = $('#save-button-confirm').attr('class');
@@ -357,13 +357,13 @@ OCA.Sharing.PublicApp = {
 		toggleLoading();
 
 		if (remote.indexOf('@') == -1) {
-			this._legacySaveToOwnCloud(remote, token, owner, ownerDisplayName, name, isProtected);
+			this._legacySaveToNextcloud(remote, token, owner, ownerDisplayName, name, isProtected);
 			toggleLoading();
 			return;
 		}
 
 		$.post(
-			OC.generateUrl('/apps/federatedfilesharing/saveToOwnCloud'),
+			OC.generateUrl('/apps/federatedfilesharing/saveToNextcloud'),
 			{
 				'shareWith': remote,
 				'token': token
-- 
GitLab