summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-07-02 21:37:41 +0200
committerLukas Reschke <lukas@owncloud.com>2015-07-02 21:37:41 +0200
commit7d94d963e9cab3fee0837bf28dae3ac37c90ea46 (patch)
tree617ca99600a1543b934062fe30e5afb1ec1e242c
parent9cba7c1793bbb4bd094d882915f9867fe95ef597 (diff)
parentc051c180ab4b3566a5d196d43ed47aa3bbdc5df1 (diff)
downloadnextcloud-server-7d94d963e9cab3fee0837bf28dae3ac37c90ea46.tar.gz
nextcloud-server-7d94d963e9cab3fee0837bf28dae3ac37c90ea46.zip
Merge pull request #17356 from owncloud/stable8.1-apps-keepgloballist
[stable8.1] Fix global app list state
-rw-r--r--settings/js/apps.js5
-rw-r--r--settings/tests/js/appsSpec.js26
2 files changed, 29 insertions, 2 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 7849e1b7573..d1de3d727c0 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 60e3692def4..907d441ff4d 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
+ }
+ });
});
});