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

chore(hybrid-cloud): Stabilize issue integration defaults for split silo #56297

Merged
merged 1 commit into from
Sep 20, 2023
Merged
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
16 changes: 11 additions & 5 deletions src/sentry/integrations/mixins/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from typing import Any, ClassVar, Mapping, Sequence

from sentry.integrations.utils import where_should_sync
from sentry.models import ExternalIssue, GroupLink, UserOption
from sentry.models import ExternalIssue, GroupLink
from sentry.models.project import Project
from sentry.models.user import User
from sentry.notifications.utils import get_notification_group_title
from sentry.services.hybrid_cloud.integration import integration_service
from sentry.services.hybrid_cloud.user import RpcUser
Expand Down Expand Up @@ -181,14 +182,19 @@ def store_issue_last_defaults(self, project: Project, user: RpcUser, data):
user_id=user.id, value=new_user_defaults, **user_option_key
)

def get_defaults(self, project, user):
def get_defaults(self, project: Project, user: User):
project_defaults = self.get_project_defaults(project.id)

user_option_key = dict(user=user, key="issue:defaults", project=project)
user_defaults = UserOption.objects.get_value(default={}, **user_option_key).get(
self.model.provider, {}
user_option_value = get_option_from_list(
user_option_service.get_many(
filter={"user_ids": [user.id], "keys": ["issue:defaults"], "project_id": project.id}
),
key="issue:defaults",
default={},
)

user_defaults = user_option_value.get(self.model.provider, {})

defaults = {}
defaults.update(project_defaults)
defaults.update(user_defaults)
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/integrations/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_status_sync_inbound_unresolve(self):
assert Group.objects.get(id=group.id).status == GroupStatus.UNRESOLVED


@region_silo_test
@region_silo_test(stable=True)
class IssueDefaultTest(TestCase):
def setUp(self):
self.group.status = GroupStatus.RESOLVED
Expand Down
Loading