fix "mark all as read" in tag views marking the wrong entries (#2374)

This commit is contained in:
Athou
2026-11-09 06:08:40 +01:00
parent f6e30a77da
commit eb8626f0e1
9 changed files with 60 additions and 12 deletions

View File

@@ -116,10 +116,11 @@ public class FeedEntryService {
List<FeedSubscription> subscriptions,
Instant olderThan,
Instant insertedBefore,
List<FeedEntryKeyword> keywords) {
List<FeedEntryKeyword> keywords,
String tag) {
List<FeedEntryStatus> statuses =
feedEntryStatusDAO.findBySubscriptions(
user, subscriptions, true, keywords, null, -1, -1, null, false, null, null, null);
user, subscriptions, true, keywords, null, -1, -1, null, false, tag, null, null);
markList(statuses, olderThan, insertedBefore);
}

View File

@@ -37,4 +37,8 @@ public class MarkRequest implements Serializable {
@Schema(description = "if marking a category or 'all', exclude those subscriptions from the marking")
private List<Long> excludedSubscriptions;
@Schema(description = "if marking a category or 'all', only mark entries tagged with this tag")
@Size(max = 40)
private String tag;
}

View File

@@ -299,7 +299,8 @@ public class CategoryREST {
if (ALL.equals(req.getId())) {
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
removeExcludedSubscriptions(subs, req.getExcludedSubscriptions());
feedEntryService.markSubscriptionEntries(user, subs, olderThan, insertedBefore, entryKeywords);
feedEntryService.markSubscriptionEntries(
user, subs, olderThan, insertedBefore, entryKeywords, req.getTag());
} else if (STARRED.equals(req.getId())) {
feedEntryService.markStarredEntries(user, olderThan, insertedBefore);
} else {
@@ -307,7 +308,8 @@ 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, insertedBefore, entryKeywords);
feedEntryService.markSubscriptionEntries(
user, subs, olderThan, insertedBefore, entryKeywords, req.getTag());
}
return Response.ok().build();
}

View File

@@ -334,7 +334,7 @@ public class FeedREST {
FeedSubscription subscription = feedSubscriptionDAO.findById(user, Long.valueOf(req.getId()));
if (subscription != null) {
feedEntryService.markSubscriptionEntries(
user, Collections.singletonList(subscription), olderThan, insertedBefore, entryKeywords);
user, Collections.singletonList(subscription), olderThan, insertedBefore, entryKeywords, null);
}
return Response.ok().build();
}

View File

@@ -369,12 +369,12 @@ public class FeverREST {
} else if ("feed".equals(source)) {
FeedSubscription subscription = feedSubscriptionDAO.findById(user, id);
feedEntryService.markSubscriptionEntries(
user, Collections.singletonList(subscription), null, insertedBefore, null);
user, Collections.singletonList(subscription), null, insertedBefore, null, null);
} else if ("group".equals(source)) {
FeedCategory parent = feedCategoryDAO.findById(user, id);
List<FeedCategory> categories = feedCategoryDAO.findAllChildrenCategories(user, parent);
List<FeedSubscription> subscriptions = feedSubscriptionDAO.findByCategories(user, categories);
feedEntryService.markSubscriptionEntries(user, subscriptions, null, insertedBefore, null);
feedEntryService.markSubscriptionEntries(user, subscriptions, null, insertedBefore, null, null);
}
}
}

View File

@@ -421,7 +421,7 @@ public class GoogleReaderREST {
Long subId = parsed.feedSubscriptionId();
FeedSubscription sub = subId == null ? null : feedSubscriptionDAO.findById(user, subId);
if (sub != null) {
feedEntryService.markSubscriptionEntries(user, List.of(sub), olderThan, null, null);
feedEntryService.markSubscriptionEntries(user, List.of(sub), olderThan, null, null, null);
}
}
case LABEL -> {
@@ -429,12 +429,12 @@ public class GoogleReaderREST {
if (category != null) {
List<FeedCategory> categories = feedCategoryDAO.findAllChildrenCategories(user, category);
List<FeedSubscription> subs = feedSubscriptionDAO.findByCategories(user, categories);
feedEntryService.markSubscriptionEntries(user, subs, olderThan, null, null);
feedEntryService.markSubscriptionEntries(user, subs, olderThan, null, null, null);
}
}
default ->
feedEntryService.markSubscriptionEntries(
user, feedSubscriptionDAO.findAll(user), olderThan, null, null);
user, feedSubscriptionDAO.findAll(user), olderThan, null, null, null);
}
return Response.ok("OK").build();