requireOwnedReview resolves a held message by id, scoped to the account, and returns it (404 if it isn't a hold the account owns). The ownership check is the tenant guard for the id-only review routes.
(ctx context.Context, userID, id string)
| 125 | // returns it (404 if it isn't a hold the account owns). The ownership check is |
| 126 | // the tenant guard for the id-only review routes. |
| 127 | func (s *Server) requireOwnedReview(ctx context.Context, userID, id string) (*identity.Message, error) { |
| 128 | if s.deps.GetReviewWithContent == nil { |
| 129 | return nil, NewError(http.StatusNotImplemented, "not_implemented", "reviews are not available on this deployment") |
| 130 | } |
| 131 | msg, err := s.deps.GetReviewWithContent(ctx, userID, id) |
| 132 | if err != nil || msg == nil { |
| 133 | return nil, NewError(http.StatusNotFound, "not_found", "review not found") |
| 134 | } |
| 135 | return msg, nil |
| 136 | } |
| 137 | |
| 138 | func (s *Server) handleGetReview(ctx context.Context, in *getReviewInput) (*reviewDetailOutput, error) { |
| 139 | p, err := s.requireAccountScope(ctx) |
no test coverage detected