Skip to content

Commit

Permalink
make excludeFromAll work again
Browse files Browse the repository at this point in the history
  • Loading branch information
fffw committed Apr 29, 2016
1 parent f641f0e commit 6e6a84f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Expand Up @@ -33,11 +33,14 @@ angular.module('feeds-directives', []).directive('feed', ['feedService', '$compi
return feedEntry;
}

// the source field is the key of the feed, we need the feed title instead
function replaceSource(feedEntry, feeds) {
// Add/replace below fields to an entry:
// 1. the source field of an entry is the key of the feed, we need the feed title instead.
// 2. if the feed one entry belongs to needs to be excluded from All tab, apply to the entry itself.
function updateEntryFields(feedEntry, feeds) {
var source = feedEntry.source;
if (source) {
var feed = feeds[source];
feedEntry.excludeFromAll = feed.excludeFromAll;
if (feed && feed.title) {
feedEntry.source = feed.title;
}
Expand All @@ -47,7 +50,7 @@ angular.module('feeds-directives', []).directive('feed', ['feedService', '$compi
function sanitizeEntries(entries, feeds) {
for (var i = 0; i < entries.length; i++) {
sanitizeFeedEntry(entries[i]);
replaceSource(entries[i], feeds);
updateEntryFields(entries[i], feeds);
}
}

Expand Down
Expand Up @@ -4,7 +4,7 @@
<div ng-init="feedsTitle = 'all';feedEntries = allEntries">
<div id="feeds-container-all" class="feeds-container" ng-controller="FeedCtrl">
<div ng-if="tabVisible()" class="infinite-scroll" infinite-scroll="addMoreItems()" infinite-scroll-container="'#feeds-container-all'">
<div ng-repeat="feed in entries" ng-if="!allFeeds[feed.source].excludeFromAll">
<div ng-repeat="feed in entries" ng-if="!feed.excludeFromAll">
<div ng-include src="'partials/feed.html'"></div>
</div>
</div>
Expand Down

0 comments on commit 6e6a84f

Please sign in to comment.