forked from Archives/Athou_commafeed
Merge pull request #661 from Hubcapp/master
Mark Read button now respects filters
This commit is contained in:
@@ -489,6 +489,7 @@ module.controller('ToolbarCtrl', [
|
||||
type : $stateParams._type,
|
||||
id : $stateParams._id,
|
||||
olderThan : olderThan,
|
||||
keywords: $location.search().q,
|
||||
read : true
|
||||
});
|
||||
};
|
||||
@@ -881,6 +882,7 @@ module.controller('FeedListCtrl', [
|
||||
service.mark({
|
||||
id : $scope.selectedId,
|
||||
olderThan : olderThan || $scope.timestamp,
|
||||
keywords: $location.search().q,
|
||||
read : true
|
||||
}, function() {
|
||||
CategoryService.refresh(function() {
|
||||
|
||||
@@ -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]));
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user