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
*.log
test/files/normalise.jpg.png
test/files/normalise-resized.jpg

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

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

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

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

Loading…
Cancel
Save