Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
armenzg committed Nov 15, 2024
1 parent a4c711f commit e771176
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/sentry/api/helpers/group_index/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def get_current_release_version_of_group(group: Group, follows_semver: bool = Fa
"""
current_release_version = None
if follows_semver:
try:
if not features.has(
"organizations:releases-resolve-next-release-semver-fix", group.project.organization
):
if not features.has(
"organizations:releases-resolve-next-release-semver-fix", group.project.organization
):
try:
# This sets current_release_version to the latest semver version associated with a group
associated_release_id = GroupRelease.objects.filter(
project_id=group.project.id, group_id=group.id
Expand All @@ -150,11 +150,11 @@ def get_current_release_version_of_group(group: Group, follows_semver: bool = Fa
.values_list("version", flat=True)[:1]
.get()
)
else:
current_release_version = greatest_semver_release(group.project).version
except Release.DoesNotExist:
pass
else:
current_release_version = greatest_semver_release(group.project).version

except Release.DoesNotExist:
pass
else:
# This sets current_release_version to the most recent release associated with a group
# In order to be able to do that, `use_cache` has to be set to False. Otherwise,
Expand Down
23 changes: 23 additions & 0 deletions tests/sentry/issues/endpoints/test_group_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,29 @@ def test_resolved_in_next_release_no_release(self):
assert not GroupResolution.objects.filter(group=group).exists()
assert response.data["statusDetails"] == {}

@with_feature("organizations:releases-resolve-next-release-semver-fix")
def test_resolved_in_next_release_with_flag_no_release(self):
self.login_as(user=self.user)

project = self.create_project()
project.flags.has_releases = True
project.save()
event = self.store_event(data={}, project_id=project.id)
group = event.group
assert group is not None

url = f"/api/0/organizations/{group.organization.slug}/issues/{group.id}/"
response = self.client.put(url, data={"status": "resolvedInNextRelease"})
assert response.status_code == 200, response.content

# Refetch from DB to ensure the latest state is fetched
group = Group.objects.get(id=group.id, project=group.project.id)
assert group.status == GroupStatus.RESOLVED

# no GroupResolution because there is no release
assert not GroupResolution.objects.filter(group=group).exists()
assert response.data["statusDetails"] == {}

def test_snooze_duration(self):
group = self.create_group(status=GroupStatus.RESOLVED)

Expand Down

0 comments on commit e771176

Please sign in to comment.