Use zipObject, more test-related ignores

v1.18.x
Peter Jaszkowiak 8 years ago
parent 3da2e1f07f
commit d4e7db45b7

1
.gitignore vendored

@ -61,3 +61,4 @@ coverage
build build
*.log *.log
test/files/normalise.jpg.png test/files/normalise.jpg.png
test/files/normalise-resized.jpg

@ -171,9 +171,7 @@ module.exports = function (privileges) {
}, next); }, next);
}, },
function (results, next) { function (results, next) {
var privData = _.fromPairs(privs.map(function (priv, i) { var privData = _.zipObject(privs, results.privileges);
return [priv, results.privileges[i]];
}));
var isAdminOrMod = results.isAdministrator || results.isModerator; var isAdminOrMod = results.isAdministrator || results.isModerator;
plugins.fireHook('filter:privileges.categories.get', { plugins.fireHook('filter:privileges.categories.get', {

@ -29,9 +29,7 @@ module.exports = function (privileges) {
}, next); }, next);
}, },
function (results, next) { function (results, next) {
var privData = _.fromPairs(privs.map(function (priv, i) { var privData = _.zipObject(privs, results.privileges);
return [priv, results.privileges[i]];
}));
var disabled = parseInt(results.disabled, 10) === 1; var disabled = parseInt(results.disabled, 10) === 1;
var locked = parseInt(topic.locked, 10) === 1; var locked = parseInt(topic.locked, 10) === 1;
var deleted = parseInt(topic.deleted, 10) === 1; var deleted = parseInt(topic.deleted, 10) === 1;

@ -135,12 +135,8 @@ Topics.getTopicsByTids = function (tids, uid, callback) {
}, next); }, next);
}, },
function (results, next) { function (results, next) {
var users = _.fromPairs(results.users.map(function (user) { var users = _.zipObject(uids, results.users);
return [user.uid, user]; var categories = _.zipObject(cids, results.categories);
}));
var categories = _.fromPairs(results.categories.map(function (category) {
return [category.cid, category];
}));
for (var i = 0; i < topics.length; i += 1) { for (var i = 0; i < topics.length; i += 1) {
if (topics[i]) { if (topics[i]) {

@ -247,9 +247,7 @@ module.exports = function (Topics) {
tag.score = results.counts[index] ? results.counts[index] : 0; tag.score = results.counts[index] ? results.counts[index] : 0;
}); });
var tagData = _.fromPairs(results.tagData.map(function (tag) { var tagData = _.zipObject(uniqueTopicTags, results.tagData);
return [tag.value, tag];
}));
topicTags.forEach(function (tags, index) { topicTags.forEach(function (tags, index) {
if (Array.isArray(tags)) { if (Array.isArray(tags)) {

Loading…
Cancel
Save