(ctx context.Context, _ *struct{})
| 103 | } |
| 104 | |
| 105 | func (s *Server) handleListReviews(ctx context.Context, _ *struct{}) (*listReviewsOutput, error) { |
| 106 | p, err := s.requireAccountScope(ctx) |
| 107 | if err != nil { |
| 108 | return nil, err |
| 109 | } |
| 110 | if s.deps.ListReviews == nil { |
| 111 | return nil, NewError(http.StatusNotImplemented, "not_implemented", "reviews are not available on this deployment") |
| 112 | } |
| 113 | items, err := s.deps.ListReviews(ctx, p.User.ID) |
| 114 | if err != nil { |
| 115 | return nil, NewError(http.StatusInternalServerError, "internal_error", "failed to list reviews") |
| 116 | } |
| 117 | views := make([]ReviewView, 0, len(items)) |
| 118 | for _, it := range items { |
| 119 | views = append(views, reviewView(it)) |
| 120 | } |
| 121 | return &listReviewsOutput{Body: NewPage(views, "")}, nil |
| 122 | } |
| 123 | |
| 124 | // requireOwnedReview resolves a held message by id, scoped to the account, and |
| 125 | // returns it (404 if it isn't a hold the account owns). The ownership check is |
nothing calls this directly
no test coverage detected