when duplicating a list, copy its description (fixes #749)

This commit is contained in:
rolux 2012-04-19 08:50:41 +00:00
parent 545a5527a9
commit a30ddb7c32

View file

@ -34,28 +34,38 @@ pandora.addList = function() {
data.query = listData.query; data.query = listData.query;
} }
} }
if (isDuplicate && listData.type == 'static') { if (isDuplicate) {
var query = { pandora.api.findLists({
conditions: [{key: 'list', value: list, operator: '=='}], query: {conditions: [{key: 'id', value: list, operator: '=='}]},
operator: '&' keys: ['description']
};
pandora.api.find({
query: query
}, function(result) { }, function(result) {
if (result.data.items) { data.description = result.data.items[0].description;
if (data.type == 'static') {
var query = {
conditions: [{key: 'list', value: list, operator: '=='}],
operator: '&'
};
pandora.api.find({ pandora.api.find({
query: query, query: query
keys: ['id'],
sort: [{key: 'id', operator: ''}],
range: [0, result.data.items]
}, function(result) { }, function(result) {
var items = result.data.items.map(function(item) { if (result.data.items) {
return item.id; pandora.api.find({
}); query: query,
addList(items); keys: ['id'],
sort: [{key: 'id', operator: ''}],
range: [0, result.data.items]
}, function(result) {
var items = result.data.items.map(function(item) {
return item.id;
});
addList(items);
});
} else {
addList();
}
}); });
} else { } else {
addList(); addList()
} }
}); });
} else { } else {