Merge pull request #661 from Hubcapp/master

Mark Read button now respects filters
This commit is contained in:
Athou
2014-11-01 11:18:50 +01:00
5 changed files with 12 additions and 5 deletions

View File

@@ -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() {

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();
}