Skip to content

Commit 79a6120

Browse files
feat: Update button styling
1 parent 26de83e commit 79a6120

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/slackBotFunction/app/slack/slack_events.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,15 @@ def open_citation(channel: str, timestamp: str, message: Any, params: Dict[str,
637637
title = f"*{title}*"
638638
body = f"> {body.replace("\n", "\n> ").replace(new_button_block, "")}"
639639

640-
# Highlight selected citation
641-
i = body.find(f'"action_id": "cit_{source_number}",\n')
642-
body = body[:i] + new_button_block + body[i:]
640+
# Highlight selected citation by updating the button style
641+
for block in blocks:
642+
if block.get("type") == "actions":
643+
for element in block.get("elements", []):
644+
if element.get("type") == "button":
645+
if element.get("action_id") == f"cite_{source_number}":
646+
element["style"] = "primary"
647+
else:
648+
element.pop("style", None)
643649

644650
# Add citation content before feedback block
645651
citation_block = {

0 commit comments

Comments
 (0)