Skip to content

Commit 79d1688

Browse files
committed
undo slack_thread payload
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
1 parent d3ae068 commit 79d1688

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

CHANGELOG.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
## [Unreleased][]
44

5-
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-slack/compare/0.9.0...HEAD
5+
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-slack/compare/0.10.0...HEAD
6+
7+
## [0.10.0][]
8+
9+
[0.10.0]: https://github.com/chaostoolkit-incubator/chaostoolkit-slack/compare/0.9.0...0.10.0
10+
11+
### Changed
12+
13+
- Undid last change as i's not praticale to update a slack message without its
14+
entire context. Slack API reflects the odd design of Slack.
615

716
## [0.9.0][]
817

chaosslack/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from slack_sdk import WebClient
1313

1414
__all__ = ["get_client", "get_channel_id", "discover"]
15-
__version__ = "0.9.0"
15+
__version__ = "0.10.0"
1616

1717

1818
def get_client(secrets: Secrets) -> WebClient:

chaosslack/control.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,16 @@ def before_experiment_control(
5656
secrets: Secrets,
5757
channel: Optional[str] = None,
5858
) -> None:
59-
extra = configuration.get("slack_extra")
6059
send(
6160
"Experiment is starting",
6261
context,
6362
get_state(),
6463
channel,
6564
in_thread=False,
66-
extra=extra,
6765
configuration=configuration,
6866
secrets=secrets,
6967
)
7068

71-
if current_msg:
72-
c = context.setdefault("configuration", {})
73-
c["slack_thread"] = {
74-
"channel": current_msg.get("channel"),
75-
"ts": current_msg.get("ts"),
76-
}
77-
7869

7970
def after_experiment_control(
8071
context: Experiment,
@@ -294,7 +285,6 @@ def send(
294285
in_thread: bool,
295286
thread_data: Any = None,
296287
thread_text: str = None,
297-
extra: Optional[List[str]] = None,
298288
configuration: Configuration = None,
299289
secrets: Secrets = None,
300290
) -> None:
@@ -308,16 +298,18 @@ def send(
308298
if not channel:
309299
raise InvalidActivity("missing slack channel name")
310300

301+
extra = (configuration or {}).get("slack_extra")
302+
311303
if not current_msg:
312304
current_msg = r = client.chat_postMessage(
313305
channel=channel,
314306
fallback=message,
315307
text=message,
316-
extra=extra,
317308
attachments=attachments(
318309
state,
319310
message,
320311
experiment,
312+
extra,
321313
),
322314
)
323315
elif in_thread and thread_data:
@@ -343,7 +335,7 @@ def send(
343335
channel=current_msg.get("channel"),
344336
ts=current_msg.get("ts"),
345337
text=message,
346-
attachments=attachments(state, message, experiment),
338+
attachments=attachments(state, message, experiment, extra),
347339
reply_broadcast=False,
348340
)
349341

0 commit comments

Comments
 (0)