Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shared-views): Only use positions from starred views #86848

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions src/sentry/issues/endpoints/organization_group_search_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,34 +110,18 @@ def get(self, request: Request, organization: Organization) -> Response:
data={"detail": "You do not have access to any projects."},
)

if features.has("organizations:issue-view-sharing", organization):
starred_views = GroupSearchViewStarred.objects.filter(
organization=organization, user_id=request.user.id
)

return self.paginate(
request=request,
queryset=starred_views,
order_by="position",
on_results=lambda x: serialize(
x,
request.user,
serializer=GroupSearchViewStarredSerializer(
has_global_views=has_global_views,
default_project=default_project,
organization=organization,
),
),
)
starred_views = GroupSearchViewStarred.objects.filter(
organization=organization, user_id=request.user.id
)

return self.paginate(
request=request,
queryset=query,
queryset=starred_views,
order_by="position",
on_results=lambda x: serialize(
x,
request.user,
serializer=GroupSearchViewSerializer(
serializer=GroupSearchViewStarredSerializer(
has_global_views=has_global_views,
default_project=default_project,
organization=organization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class OrganizationGroupSearchViewsGetTest(BaseGSVTestCase):

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_get_user_one_custom_views(self) -> None:
objs = self.create_base_data()

Expand Down Expand Up @@ -164,7 +163,6 @@ def test_last_visited_exists_for_seen_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_get_user_two_custom_views(self) -> None:
objs = self.create_base_data()

Expand All @@ -175,7 +173,6 @@ def test_get_user_two_custom_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_get_default_views(self) -> None:
self.create_base_data()

Expand All @@ -192,7 +189,6 @@ def test_get_default_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_get_views_has_correct_default_page_filters(self) -> None:
self.create_base_data()

Expand All @@ -219,7 +215,6 @@ def setUp(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_deletes_missing_views(self) -> None:
views = self.client.get(self.url).data

Expand Down Expand Up @@ -257,7 +252,6 @@ def test_deletes_missing_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_adds_view_with_no_id(self) -> None:
views = self.client.get(self.url).data
views.append(
Expand Down Expand Up @@ -286,7 +280,6 @@ def test_adds_view_with_no_id(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_reorder_views(self) -> None:
views = self.client.get(self.url).data
view_one = views[0]
Expand Down Expand Up @@ -316,7 +309,6 @@ def test_reorder_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_rename_views(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -329,7 +321,6 @@ def test_rename_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_change_query(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -342,7 +333,6 @@ def test_change_query(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_change_sort(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -355,7 +345,6 @@ def test_change_sort(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_change_everything(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -379,7 +368,6 @@ def test_change_everything(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_invalid_no_views(self) -> None:
response = self.get_error_response(self.organization.slug, views=[])

Expand All @@ -391,7 +379,6 @@ def test_invalid_no_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_invalid_sort(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -410,7 +397,6 @@ def test_invalid_sort(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_invalid_over_max_views(self) -> None:
from sentry.api.serializers.rest_framework.groupsearchview import MAX_VIEWS

Expand All @@ -429,7 +415,6 @@ def test_invalid_over_max_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_updated_deleted_view(self) -> None:
views = self.client.get(self.url).data

Expand Down Expand Up @@ -552,7 +537,6 @@ def setUp(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_not_including_page_filters_does_not_reset_them_for_existing_views(self) -> None:
views = self.client.get(self.url).data

Expand All @@ -578,7 +562,6 @@ def test_not_including_page_filters_does_not_reset_them_for_existing_views(self)

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_default_page_filters_with_global_views(self) -> None:
views = self.client.get(self.url).data
views.append(
Expand All @@ -597,7 +580,6 @@ def test_default_page_filters_with_global_views(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_one_project_to_zero_projects(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -609,7 +591,6 @@ def test_one_project_to_zero_projects(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_to_all_projects(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -621,7 +602,6 @@ def test_to_all_projects(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_one_environment_to_zero_environments(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -632,7 +612,6 @@ def test_one_environment_to_zero_environments(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_update_time_filters(self) -> None:
views = self.client.get(self.url).data
view = views[0]
Expand All @@ -643,7 +622,6 @@ def test_update_time_filters(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_empty_time_filters_resets_to_default(self) -> None:
views = self.client.get(self.url).data
views[0]["timeFilters"] = {}
Expand Down Expand Up @@ -692,7 +670,6 @@ class OrganizationGroupSearchViewsProjectsTransactionTest(TransactionTestCase):
# the test has finished. This causes the endpoint to unexpectedly succeed when it should fail.
@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_invalid_project_ids(self) -> None:
url = reverse(
"sentry-api-0-organization-group-search-views",
Expand Down Expand Up @@ -874,7 +851,6 @@ def setUp(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_basic_get_page_filters_with_global_filters(self) -> None:
self.login_as(user=self.user)
response = self.client.get(self.url)
Expand Down Expand Up @@ -928,7 +904,6 @@ def test_get_page_filters_without_global_filters_user_2(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_default_page_filters_with_global_views(self) -> None:
self.login_as(user=self.user_3)
response = self.client.get(self.url)
Expand Down Expand Up @@ -987,7 +962,6 @@ def setUp(self) -> None:

@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@with_feature({"organizations:issue-view-sharing": True})
def test_cannot_rename_other_users_views(self) -> None:
self.login_as(user=self.user)
views = self.client.get(self.url).data
Expand Down
Loading