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

fix(slack): limit attachments to 100 #241

Merged
merged 1 commit into from May 21, 2022
Merged

fix(slack): limit attachments to 100 #241

merged 1 commit into from May 21, 2022

Conversation

piksel
Copy link
Member

@piksel piksel commented May 21, 2022

also removes last attachment if text is empty

fixes #238

also removes last attachment if text is empty
@codecov
Copy link

codecov bot commented May 21, 2022

Codecov Report

Merging #241 (4ddab62) into main (6dbcb12) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #241      +/-   ##
==========================================
+ Coverage   77.07%   77.11%   +0.04%     
==========================================
  Files          95       95              
  Lines        2844     2849       +5     
==========================================
+ Hits         2192     2197       +5     
  Misses        473      473              
  Partials      179      179              
Impacted Files Coverage Δ
pkg/services/slack/slack_json.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6dbcb12...4ddab62. Read the comment docs.

@justinsteven
Copy link
Contributor

I'm sorry but I'm not totally familiar with slack's structure and the meaning of attachments. Is it required that attachments be used? I'm guessing it's what's responsible for the pill-shaped graphics beside each line:

image

Perhaps sending more than 100 lines at once isn't a common thing, but having 99 one-line attachments and then a multi-line attachment could look odd.

Basically, do we need to be using attachments, or can we do without them.

@piksel
Copy link
Member Author

piksel commented May 21, 2022

It's mainly to allow color support, so that you can set the color of the "pill" in front of the text to show errors with red etc.
For some reason, attachments is the only API that still allows that to be specified. We could add another configuration option to send the messages as text instead, but that would instead be limited to the message length limit. Or use the blocks API, which probably have other limits...

@piksel piksel merged commit 2c9378b into main May 21, 2022
@piksel piksel deleted the fix/slack-limits branch May 21, 2022 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sending more than ~99 lines to Slack fails with too_many_attachments
2 participants