[Pkg-owncloud-commits] [owncloud] 121/165: Dont use the old .status way

David Prévot taffit at moszumanska.debian.org
Thu Apr 23 04:06:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 04674c06cca5884e6269461b2ae9a6e64a00953d
Author: Joas Schilling <nickvergessen at owncloud.com>
Date:   Mon Apr 20 18:15:06 2015 +0200

    Dont use the old .status way
---
 apps/encryption/controller/settingscontroller.php       | 13 ++-----------
 apps/encryption/js/settings-personal.js                 | 17 +++++++----------
 .../tests/controller/SettingsControllerTest.php         |  6 +++---
 3 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/apps/encryption/controller/settingscontroller.php b/apps/encryption/controller/settingscontroller.php
index 1555ff0..7fa3f46 100644
--- a/apps/encryption/controller/settingscontroller.php
+++ b/apps/encryption/controller/settingscontroller.php
@@ -118,23 +118,14 @@ class SettingsController extends Controller {
 		if ($result === true) {
 			$this->session->setStatus(Session::INIT_SUCCESSFUL);
 			return new DataResponse(
-				['data' => [
-						'status' => 'success',
-						'message' => (string) $this->l->t('Private key password successfully updated.'),
-					],
-				]
+				['message' => (string) $this->l->t('Private key password successfully updated.')]
 			);
 		} else {
 			return new DataResponse(
-				['data' => [
-						'message' => (string) $errorMessage,
-					],
-				],
+				['message' => (string) $errorMessage],
 				Http::STATUS_BAD_REQUEST
 			);
 		}
 
 	}
-
-
 }
diff --git a/apps/encryption/js/settings-personal.js b/apps/encryption/js/settings-personal.js
index dcfbba4..6860987 100644
--- a/apps/encryption/js/settings-personal.js
+++ b/apps/encryption/js/settings-personal.js
@@ -9,16 +9,13 @@ function updatePrivateKeyPasswd() {
 	var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val();
 	OC.msg.startSaving('#encryption .msg');
 	$.post(
-	OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword')
-		, { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
-		,  function( data ) {
-			if (data.status === "error") {
-				OC.msg.finishedSaving('#encryption .msg', data);
-			} else {
-				OC.msg.finishedSaving('#encryption .msg', data);
-			}
-		}
-	);
+		OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword'),
+		{ oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
+	).success(function(response) {
+		OC.msg.finishedSuccess('#encryption .msg', response.message);
+	}).fail(function(response) {
+		OC.msg.finishedError('#encryption .msg', response.responseJSON.message);
+	});
 }
 
 $(document).ready(function(){
diff --git a/apps/encryption/tests/controller/SettingsControllerTest.php b/apps/encryption/tests/controller/SettingsControllerTest.php
index a127737..478bf82 100644
--- a/apps/encryption/tests/controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/controller/SettingsControllerTest.php
@@ -131,7 +131,7 @@ class SettingsControllerTest extends TestCase {
 
 		$this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
 		$this->assertSame('The current log-in password was not correct, please try again.',
-			$data['data']['message']);
+			$data['message']);
 	}
 
 	/**
@@ -158,7 +158,7 @@ class SettingsControllerTest extends TestCase {
 
 		$this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
 		$this->assertSame('The old password was not correct, please try again.',
-			$data['data']['message']);
+			$data['message']);
 	}
 
 	/**
@@ -216,7 +216,7 @@ class SettingsControllerTest extends TestCase {
 
 		$this->assertSame(Http::STATUS_OK, $result->getStatus());
 		$this->assertSame('Private key password successfully updated.',
-			$data['data']['message']);
+			$data['message']);
 	}
 
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list