Skip to content

Commit

Permalink
Fix Model.getFilterFromChannel when custom filters are present
Browse files Browse the repository at this point in the history
  • Loading branch information
Razvan Botea committed Apr 27, 2016
1 parent 4fc74d4 commit a841474
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,18 @@ Model.getFilterFromChannel = function(channel) {
}

if (channel.filter) {
searchFilters.and();
(function AddFilters(filterObject) {
var filterKey = Object.keys(filterObject);
searchFilters[filterKey]();
if (filterKey == 'or')
searchFilters.or();

filterObject[filterKey].forEach(function(filters, key) {
if (key == 'and' || key == 'or')
AddFilters(filterObject[filterKey]);
else {
console.log(filters);
for(var key2 in filters) {
searchFilters.addFilter(key2, filterObject[filterKey][filters[key2]]);
searchFilters.addFilter(key2, filters[key2]);
}
}
});
Expand Down

0 comments on commit a841474

Please sign in to comment.