Fix authors that have a mail or homepage

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2016-10-11 10:23:45 +02:00
parent ee2d77279f
commit a6859fd863
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 24 additions and 2 deletions

View File

@ -166,7 +166,15 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
if (_.isArray(app.author)) {
app.author = app.author.join(', ');
var authors = [];
_.each(app.author, function (author) {
if (typeof author === 'string') {
authors.push(author);
} else {
authors.push(author['@value']);
}
});
app.author = authors.join(', ');
}
var html = template(app);
@ -486,7 +494,21 @@ OC.Settings.Apps = OC.Settings.Apps || {
// Author Name
apps = apps.concat(_.filter(OC.Settings.Apps.State.apps, function (app) {
if (_.isArray(app.author)) {
return app.author.join(', ').toLowerCase().indexOf(query) !== -1;
var authors = [];
_.each(app.author, function (author) {
if (typeof author === 'string') {
authors.push(author);
} else {
authors.push(author['@value']);
if (!_.isUndefined(author['@attributes']['homepage'])) {
authors.push(author['@attributes']['homepage']);
}
if (!_.isUndefined(author['@attributes']['mail'])) {
authors.push(author['@attributes']['mail']);
}
}
});
return authors.join(' ').toLowerCase().indexOf(query) !== -1;
}
return app.author.toLowerCase().indexOf(query) !== -1;
}));