Skip to content

Commit 21dd8ca

Browse files
authored
feat(shared-views): Only use positions from starred views (#86848)
This PR makes it so that the GET endpoint _only_ uses the `position` column from the `GroupSearchViewStarred` endpoint, rather than from `GroupSearchView`. This was previously gated via a feature flag that only I have had access to, and it works perfectly fine. After this change, we should be able to safely drop the `position` column from the GroupSearchView table and clear out any usages. depends on #86737 to be merged and run
1 parent 85daaf2 commit 21dd8ca

File tree

2 files changed

+5
-47
lines changed

2 files changed

+5
-47
lines changed

src/sentry/issues/endpoints/organization_group_search_views.py

+5-21
Original file line numberDiff line numberDiff line change
@@ -110,34 +110,18 @@ def get(self, request: Request, organization: Organization) -> Response:
110110
data={"detail": "You do not have access to any projects."},
111111
)
112112

113-
if features.has("organizations:issue-view-sharing", organization):
114-
starred_views = GroupSearchViewStarred.objects.filter(
115-
organization=organization, user_id=request.user.id
116-
)
117-
118-
return self.paginate(
119-
request=request,
120-
queryset=starred_views,
121-
order_by="position",
122-
on_results=lambda x: serialize(
123-
x,
124-
request.user,
125-
serializer=GroupSearchViewStarredSerializer(
126-
has_global_views=has_global_views,
127-
default_project=default_project,
128-
organization=organization,
129-
),
130-
),
131-
)
113+
starred_views = GroupSearchViewStarred.objects.filter(
114+
organization=organization, user_id=request.user.id
115+
)
132116

133117
return self.paginate(
134118
request=request,
135-
queryset=query,
119+
queryset=starred_views,
136120
order_by="position",
137121
on_results=lambda x: serialize(
138122
x,
139123
request.user,
140-
serializer=GroupSearchViewSerializer(
124+
serializer=GroupSearchViewStarredSerializer(
141125
has_global_views=has_global_views,
142126
default_project=default_project,
143127
organization=organization,

tests/sentry/issues/endpoints/test_organization_group_search_views.py

-26
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ class OrganizationGroupSearchViewsGetTest(BaseGSVTestCase):
130130

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

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

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

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

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

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

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

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

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

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

258253
@with_feature({"organizations:issue-stream-custom-views": True})
259254
@with_feature({"organizations:global-views": True})
260-
@with_feature({"organizations:issue-view-sharing": True})
261255
def test_adds_view_with_no_id(self) -> None:
262256
views = self.client.get(self.url).data
263257
views.append(
@@ -286,7 +280,6 @@ def test_adds_view_with_no_id(self) -> None:
286280

287281
@with_feature({"organizations:issue-stream-custom-views": True})
288282
@with_feature({"organizations:global-views": True})
289-
@with_feature({"organizations:issue-view-sharing": True})
290283
def test_reorder_views(self) -> None:
291284
views = self.client.get(self.url).data
292285
view_one = views[0]
@@ -316,7 +309,6 @@ def test_reorder_views(self) -> None:
316309

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

644623
@with_feature({"organizations:issue-stream-custom-views": True})
645624
@with_feature({"organizations:global-views": True})
646-
@with_feature({"organizations:issue-view-sharing": True})
647625
def test_empty_time_filters_resets_to_default(self) -> None:
648626
views = self.client.get(self.url).data
649627
views[0]["timeFilters"] = {}
@@ -692,7 +670,6 @@ class OrganizationGroupSearchViewsProjectsTransactionTest(TransactionTestCase):
692670
# the test has finished. This causes the endpoint to unexpectedly succeed when it should fail.
693671
@with_feature({"organizations:issue-stream-custom-views": True})
694672
@with_feature({"organizations:global-views": True})
695-
@with_feature({"organizations:issue-view-sharing": True})
696673
def test_invalid_project_ids(self) -> None:
697674
url = reverse(
698675
"sentry-api-0-organization-group-search-views",
@@ -874,7 +851,6 @@ def setUp(self) -> None:
874851

875852
@with_feature({"organizations:issue-stream-custom-views": True})
876853
@with_feature({"organizations:global-views": True})
877-
@with_feature({"organizations:issue-view-sharing": True})
878854
def test_basic_get_page_filters_with_global_filters(self) -> None:
879855
self.login_as(user=self.user)
880856
response = self.client.get(self.url)
@@ -928,7 +904,6 @@ def test_get_page_filters_without_global_filters_user_2(self) -> None:
928904

929905
@with_feature({"organizations:issue-stream-custom-views": True})
930906
@with_feature({"organizations:global-views": True})
931-
@with_feature({"organizations:issue-view-sharing": True})
932907
def test_default_page_filters_with_global_views(self) -> None:
933908
self.login_as(user=self.user_3)
934909
response = self.client.get(self.url)
@@ -987,7 +962,6 @@ def setUp(self) -> None:
987962

988963
@with_feature({"organizations:issue-stream-custom-views": True})
989964
@with_feature({"organizations:global-views": True})
990-
@with_feature({"organizations:issue-view-sharing": True})
991965
def test_cannot_rename_other_users_views(self) -> None:
992966
self.login_as(user=self.user)
993967
views = self.client.get(self.url).data

0 commit comments

Comments
 (0)