[Pkg-owncloud-commits] [owncloud] 16/23: Fix global app list state

David Prévot taffit at moszumanska.debian.org
Tue Jul 7 12:42:52 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 c051c180ab4b3566a5d196d43ed47aa3bbdc5df1
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Thu Jul 2 17:15:14 2015 +0200

    Fix global app list state
---
 settings/js/apps.js           |  5 +++--
 settings/tests/js/appsSpec.js | 26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/settings/js/apps.js b/settings/js/apps.js
index 7849e1b..d1de3d7 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -86,11 +86,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
 		}), {
 			type:'GET',
 			success: function (apps) {
-				var appList = _.map(_.indexBy(apps.apps, 'id'), function(app) {
+				var appListWithIndex = _.indexBy(apps.apps, 'id');
+				OC.Settings.Apps.State.apps = appListWithIndex;
+				var appList = _.map(appListWithIndex, function(app) {
 					// default values for missing fields
 					return _.extend({level: 0}, app);
 				});
-				OC.Settings.Apps.State.apps = appList;
 				var source   = $("#app-template").html();
 				var template = Handlebars.compile(source);
 
diff --git a/settings/tests/js/appsSpec.js b/settings/tests/js/appsSpec.js
index 60e3692..907d441 100644
--- a/settings/tests/js/appsSpec.js
+++ b/settings/tests/js/appsSpec.js
@@ -159,6 +159,32 @@ describe('OC.Settings.Apps tests', function() {
 			var results = getResultsFromDom();
 			expect(results.length).toEqual(5);
 			expect(results).toEqual(['alpha', 'delta', 'zork', 'foo', 'nolevel']);
+			expect(OC.Settings.Apps.State.apps).toEqual({
+				'foo': {
+					id: 'foo',
+					name: 'Foo app',
+					level: 0
+				},
+				'alpha': {
+					id: 'alpha',
+					name: 'Alpha app',
+					level: 300
+				},
+				'nolevel': {
+					id: 'nolevel',
+					name: 'No level'
+				},
+				'zork': {
+					id: 'zork',
+					name: 'Some famous adventure game',
+					level: 200
+				},
+				'delta': {
+					id: 'delta',
+					name: 'Mathematical symbol',
+					level: 200
+				}
+			});
 		});
 	});
 

-- 
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