prevent users from starring/tagging entries that are not theirs

This commit is contained in:
Athou
2026-08-22 08:09:28 +02:00
parent d2aaddea33
commit 43588df2b4
11 changed files with 20 additions and 31 deletions

View File

@@ -19,9 +19,6 @@ public class StarRequest implements Serializable {
@Size(max = 128)
private String id;
@Schema(description = "feed id", required = true)
private Long feedId;
@Schema(description = "starred or not", required = true)
private boolean starred;
}

View File

@@ -89,11 +89,9 @@ public class EntryREST {
@Valid @Parameter(description = "Star Request", required = true) StarRequest req) {
Preconditions.checkNotNull(req);
Preconditions.checkNotNull(req.getId());
Preconditions.checkNotNull(req.getFeedId());
User user = authenticationContext.getCurrentUser();
feedEntryService.starEntry(
user, Long.valueOf(req.getId()), req.getFeedId(), req.isStarred());
feedEntryService.starEntry(user, Long.valueOf(req.getId()), req.isStarred());
return Response.ok().build();
}

View File

@@ -388,9 +388,7 @@ public class FeverREST {
if ("read".equals(action) || "unread".equals(action)) {
feedEntryService.markEntry(user, id, "read".equals(action));
} else if ("saved".equals(action) || "unsaved".equals(action)) {
FeedEntry entry = feedEntryDAO.findById(id);
FeedSubscription sub = feedSubscriptionDAO.findByFeed(user, entry.getFeed());
feedEntryService.starEntry(user, id, sub.getId(), "saved".equals(action));
feedEntryService.starEntry(user, id, "saved".equals(action));
}
} else if ("feed".equals(source)) {
FeedSubscription subscription = feedSubscriptionDAO.findById(user, id);

View File

@@ -402,16 +402,11 @@ public class GoogleReaderREST {
if (markUnread) {
feedEntryService.markEntry(user, entryId, false);
}
if (star || unstar) {
FeedSubscription sub = feedSubscriptionDAO.findByFeed(user, entry.getFeed());
if (sub != null) {
if (star) {
feedEntryService.starEntry(user, entryId, sub.getId(), true);
}
if (unstar) {
feedEntryService.starEntry(user, entryId, sub.getId(), false);
}
}
if (star) {
feedEntryService.starEntry(user, entryId, true);
}
if (unstar) {
feedEntryService.starEntry(user, entryId, false);
}
}