From 7b86a5bc6008653b7ecd0ae091089bc524ab36f4 Mon Sep 17 00:00:00 2001
From: Cesar G <prototech91@gmail.com>
Date: Thu, 5 Dec 2013 22:31:27 -0800
Subject: [ticket/12038] Check that the move action succeeded before moving the
 rows.

PHPBB3-12038
---
 phpBB/adm/style/ajax.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'phpBB/adm/style/ajax.js')

diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js
index 78fcbd88fd..959580d6c2 100644
--- a/phpBB/adm/style/ajax.js
+++ b/phpBB/adm/style/ajax.js
@@ -8,7 +8,11 @@
  * an item is moved up. It moves the row up or down, and deactivates /
  * activates any up / down icons that require it (the ones at the top or bottom).
  */
-phpbb.addAjaxCallback('row_down', function() {
+phpbb.addAjaxCallback('row_down', function(res) {
+	if (typeof res.success === 'undefined' || !res.success) {
+		return;
+	}
+
 	var el = $(this),
 		tr = el.parents('tr'),
 		trSwap = tr.next();
@@ -16,7 +20,11 @@ phpbb.addAjaxCallback('row_down', function() {
 	tr.insertAfter(trSwap);
 });
 
-phpbb.addAjaxCallback('row_up', function() {
+phpbb.addAjaxCallback('row_up', function(res) {
+	if (typeof res.success === 'undefined' || !res.success) {
+		return;
+	}
+
 	var el = $(this),
 		tr = el.parents('tr'),
 		trSwap = tr.prev();
-- 
cgit v1.2.1