summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-11-14 09:50:57 +0100
committerGitHub <noreply@github.com>2016-11-14 09:50:57 +0100
commit4c6e9dccfe354ee435b615e1eda9e980b7398f34 (patch)
tree978f0e86b07abf28bf5bbe050e354764d5dc951f
parent8c1cd07de394adc6d6f35bc5c5c761618debe145 (diff)
parent896be27e7232cae77f8e0ec25e1fec9f548c9a9a (diff)
downloadnextcloud-server-4c6e9dccfe354ee435b615e1eda9e980b7398f34.tar.gz
nextcloud-server-4c6e9dccfe354ee435b615e1eda9e980b7398f34.zip
Merge pull request #2093 from nextcloud/fix-single-author-with-details
Fix single author with details
-rw-r--r--settings/js/apps.js13
-rw-r--r--settings/tests/js/appsSpec.js31
2 files changed, 33 insertions, 11 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 654756af531..451becc67a0 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -189,6 +189,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
});
app.author = authors.join(', ');
+ } else if (typeof app.author !== 'string') {
+ app.author = app.author['@value'];
}
var html = template(app);
@@ -539,8 +541,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
// Author Name
apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) {
+ var authors = [];
if (_.isArray(app.author)) {
- var authors = [];
_.each(app.author, function (author) {
if (typeof author === 'string') {
authors.push(author);
@@ -555,6 +557,15 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
});
return OC.Settings.Apps._search(authors.join(' '), query);
+ } else if (typeof app.author !== 'string') {
+ authors.push(app.author['@value']);
+ if (!_.isUndefined(app.author['@attributes']['homepage'])) {
+ authors.push(app.author['@attributes']['homepage']);
+ }
+ if (!_.isUndefined(app.author['@attributes']['mail'])) {
+ authors.push(app.author['@attributes']['mail']);
+ }
+ return OC.Settings.Apps._search(authors.join(' '), query);
}
return OC.Settings.Apps._search(app.author, query);
}));
diff --git a/settings/tests/js/appsSpec.js b/settings/tests/js/appsSpec.js
index d2ca1fb5c8b..aa785a6768e 100644
--- a/settings/tests/js/appsSpec.js
+++ b/settings/tests/js/appsSpec.js
@@ -185,26 +185,32 @@ describe('OC.Settings.Apps tests', function() {
{
id: 'foo',
name: 'Foo app',
- level: 0
+ level: 0,
+ author: 'foo'
},
{
id: 'alpha',
name: 'Alpha app',
- level: 300
+ level: 300,
+ author: ['alpha', 'beta']
},
{
id: 'nolevel',
- name: 'No level'
+ name: 'No level',
+ author: 'bar'
},
{
id: 'zork',
name: 'Some famous adventure game',
- level: 200
+ level: 200,
+ author: 'baz'
+
},
{
id: 'delta',
name: 'Mathematical symbol',
- level: 200
+ level: 200,
+ author: 'foobar'
}
]
})
@@ -217,26 +223,31 @@ describe('OC.Settings.Apps tests', function() {
'foo': {
id: 'foo',
name: 'Foo app',
- level: 0
+ level: 0,
+ author: 'foo'
},
'alpha': {
id: 'alpha',
name: 'Alpha app',
- level: 300
+ level: 300,
+ author: ['alpha', 'beta']
},
'nolevel': {
id: 'nolevel',
- name: 'No level'
+ name: 'No level',
+ author: 'bar'
},
'zork': {
id: 'zork',
name: 'Some famous adventure game',
- level: 200
+ level: 200,
+ author: 'baz',
},
'delta': {
id: 'delta',
name: 'Mathematical symbol',
- level: 200
+ level: 200,
+ author: 'foobar'
}
});
});