From 41344bc35c5834fc524df6b2b69d5f22eb2eb89b Mon Sep 17 00:00:00 2001 From: Kevin Glisson Date: Tue, 14 Mar 2023 15:52:35 -0700 Subject: [PATCH] Providing better user input on long signals. --- .../plugins/dispatch_slack/case/interactive.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/interactive.py b/src/dispatch/plugins/dispatch_slack/case/interactive.py index ea0d60da1902..f04dccdae91f 100644 --- a/src/dispatch/plugins/dispatch_slack/case/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/case/interactive.py @@ -1329,7 +1329,16 @@ def signal_button_click( db_session=db_session, signal_instance_id=context["subject"].id ) - blocks = [Section(text=f"```{json.dumps(signal.raw, indent=2)}```")] + # truncate text and redirect to ui + raw_text = json.dumps(signal.raw, indent=2) + if len(raw_text) > 2900: + blocks = [ + Section( + text=f"```{raw_text[:2750]}... \n Signal text too long, please vist Dispatch UI for full details.```" + ) + ] + else: + blocks = [Section(text=f"```{raw_text}```")] modal = Modal( title="Raw Signal",