getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
39.23k stars 4.21k forks source link

fix(stats): hide stats if no project access #81162

Closed oioki closed 4 hours ago

oioki commented 12 hours ago

Second attempt of https://github.com/getsentry/sentry/pull/80447

Comparing with the previous attempt, we now also allow project stats for staff users (or user.is_staff).

The superuser case is already covered in this code: https://github.com/getsentry/sentry/blob/2e5e0654c717adfa569be7875f44cb7e2bda4a74/src/sentry/api/serializers/models/project.py#L131-L136 is_superuser is True, therefore has_access is True, and the first condition in this snippet works:

if attrs["has_access"] or user.is_staff:
codecov[bot] commented 12 hours ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #81162 +/- ## ======================================= Coverage 80.33% 80.34% ======================================= Files 7223 7223 Lines 320107 320060 -47 Branches 20779 20772 -7 ======================================= - Hits 257163 257140 -23 + Misses 62551 62527 -24 Partials 393 393 ```