The "Mark Read" button now only marks the visible entries as read, instead of the entire feed regardless of what keywords you've entered. This should allow better management of RSS feeds, if you don't want to ever look at any content which has certain keywords in it.

This commit is contained in:
Tyler Gebhard
2014-11-01 02:10:31 -04:00
parent 27f22f6094
commit 4fb60a6ec6
5 changed files with 12 additions and 5 deletions

View File

@@ -65,8 +65,8 @@ public class FeedEntryService {
feedEntryStatusDAO.saveOrUpdate(status);
}
public void markSubscriptionEntries(User user, List<FeedSubscription> subscriptions, Date olderThan) {
List<FeedEntryStatus> statuses = feedEntryStatusDAO.findBySubscriptions(user, subscriptions, true, null, null, -1, -1, null, false,
public void markSubscriptionEntries(User user, List<FeedSubscription> subscriptions, Date olderThan, String keywords) {
List<FeedEntryStatus> statuses = feedEntryStatusDAO.findBySubscriptions(user, subscriptions, true, keywords, null, -1, -1, null, false,
false, null);
markList(statuses, olderThan);
cache.invalidateUnreadCount(subscriptions.toArray(new FeedSubscription[0]));

View File

@@ -24,6 +24,9 @@ public class MarkRequest implements Serializable {
required = false)
private Long olderThan;
@ApiModelProperty(value = "only mark read if a feed has these keywords in the title or rss content", required = false)
private String keywords;
@ApiModelProperty(value = "if marking a category or 'all', exclude those subscriptions from the marking", required = false)
private List<Long> excludedSubscriptions;

View File

@@ -243,11 +243,12 @@ public class CategoryREST {
Preconditions.checkNotNull(req.getId());
Date olderThan = req.getOlderThan() == null ? null : new Date(req.getOlderThan());
String keywords = req.getKeywords();
if (ALL.equals(req.getId())) {
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
removeExcludedSubscriptions(subs, req.getExcludedSubscriptions());
feedEntryService.markSubscriptionEntries(user, subs, olderThan);
feedEntryService.markSubscriptionEntries(user, subs, olderThan, keywords);
} else if (STARRED.equals(req.getId())) {
feedEntryService.markStarredEntries(user, olderThan);
} else {
@@ -255,7 +256,7 @@ public class CategoryREST {
List<FeedCategory> categories = feedCategoryDAO.findAllChildrenCategories(user, parent);
List<FeedSubscription> subs = feedSubscriptionDAO.findByCategories(user, categories);
removeExcludedSubscriptions(subs, req.getExcludedSubscriptions());
feedEntryService.markSubscriptionEntries(user, subs, olderThan);
feedEntryService.markSubscriptionEntries(user, subs, olderThan, keywords);
}
return Response.ok().build();
}

View File

@@ -287,10 +287,11 @@ public class FeedREST {
Preconditions.checkNotNull(req.getId());
Date olderThan = req.getOlderThan() == null ? null : new Date(req.getOlderThan());
String keywords = req.getKeywords();
FeedSubscription subscription = feedSubscriptionDAO.findById(user, Long.valueOf(req.getId()));
if (subscription != null) {
feedEntryService.markSubscriptionEntries(user, Arrays.asList(subscription), olderThan);
feedEntryService.markSubscriptionEntries(user, Arrays.asList(subscription), olderThan, keywords);
}
return Response.ok().build();
}