Skip to content

Commit a9916e0

Browse files
committed
put back logic for channel_id
1 parent 121726d commit a9916e0

File tree

1 file changed

+12
-1
lines changed
  • src/sentry/integrations/slack/requests

1 file changed

+12
-1
lines changed

src/sentry/integrations/slack/requests/base.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ def _get_field_id_option(data: Mapping[str, Any], field_name: str) -> str | None
2323
return id_option
2424

2525

26+
def get_field_id(data: Mapping[str, Any], field_name: str) -> str:
27+
"""
28+
TODO(mgaeta): Hack to convert optional strings to string. SlackRequest
29+
should be refactored to deserialize `data` in the constructor.
30+
"""
31+
id_option = _get_field_id_option(data, field_name)
32+
if not id_option:
33+
raise RuntimeError
34+
return id_option
35+
36+
2637
@dataclasses.dataclass(frozen=True)
2738
class SlackRequestError(Exception):
2839
"""
@@ -105,7 +116,7 @@ def integration(self) -> RpcIntegration:
105116

106117
@property
107118
def channel_id(self) -> str | None:
108-
return _get_field_id_option(self.data, "channel")
119+
return get_field_id(self.data, "channel")
109120

110121
@property
111122
def response_url(self) -> str:

0 commit comments

Comments
 (0)