From c1567db4162e05102959b9e66f65bf1f6e1e9eaa Mon Sep 17 00:00:00 2001 From: Shmuel Melamud Date: Wed, 13 Jul 2022 20:07:20 +0300 Subject: [PATCH] Reaction is always visible to its owner, even if a detailed list of all reactions is not visible. --- .../java/org/moera/node/rest/CommentReactionController.java | 2 +- .../java/org/moera/node/rest/PostingReactionController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/moera/node/rest/CommentReactionController.java b/src/main/java/org/moera/node/rest/CommentReactionController.java index 145ab36b..748c7a6c 100644 --- a/src/main/java/org/moera/node/rest/CommentReactionController.java +++ b/src/main/java/org/moera/node/rest/CommentReactionController.java @@ -253,7 +253,7 @@ public ReactionInfo get(@PathVariable UUID postingId, @PathVariable UUID comment if (!comment.getPosting().getId().equals(postingId)) { throw new ObjectNotFoundFailure("comment.wrong-posting"); } - if (!requestContext.isPrincipal(comment.getViewReactionsE())) { + if (!requestContext.isPrincipal(comment.getViewReactionsE()) && !requestContext.isClient(ownerName)) { return ReactionInfo.ofComment(commentId); // FIXME ugly, return 404 } diff --git a/src/main/java/org/moera/node/rest/PostingReactionController.java b/src/main/java/org/moera/node/rest/PostingReactionController.java index e53c767b..1c0f7250 100644 --- a/src/main/java/org/moera/node/rest/PostingReactionController.java +++ b/src/main/java/org/moera/node/rest/PostingReactionController.java @@ -244,7 +244,7 @@ public ReactionInfo get(@PathVariable UUID postingId, @PathVariable String owner if (!requestContext.isPrincipal(posting.getViewE())) { throw new ObjectNotFoundFailure("posting.not-found"); } - if (!requestContext.isPrincipal(posting.getViewReactionsE())) { + if (!requestContext.isPrincipal(posting.getViewReactionsE()) && !requestContext.isClient(ownerName)) { return ReactionInfo.ofPosting(postingId); // FIXME ugly, return 404 }