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

Section should not allow text longer than 3000 characters #81

Closed
caedmon opened this issue Oct 24, 2019 · 8 comments
Closed

Section should not allow text longer than 3000 characters #81

caedmon opened this issue Oct 24, 2019 · 8 comments
Labels
good first issue Good for newcomers

Comments

@caedmon
Copy link

caedmon commented Oct 24, 2019

No description provided.

@yhatt
Copy link
Owner

yhatt commented Oct 25, 2019

Welcome pull request for the finale of Hacktoberfest.

@shakti97
Copy link

are you talking about the text in the section type?

@caedmon
Copy link
Author

caedmon commented Oct 25, 2019

@shakti97 yes. Currently it appears to allow any or no text, but from the block kit doc, the text field is required and has a length limit of 3000.
https://api.slack.com/reference/block-kit/blocks#section

@anusha5695
Copy link

@caedmon : I would like to pick this

@caedmon
Copy link
Author

caedmon commented Oct 27, 2019

Looks like the text field is actually optional if fields is used, but if present must not be empty.
And if fields is used, there must be at least one valid text object in the fields array.

@s0rthak
Copy link

s0rthak commented Nov 20, 2019

Can I take this up?

Approach

  1. Utilize a second opts parameter in plainText and mrkdwn methods in src/block-kit/composition/utils.ts to take in a maxLength property
  2. Run the text key with a length checker helper function that throws if maxLength is over the specified limit
  3. Pass the maxLength parameter in Section (3000 characters) and Button (75 characters).
  4. Add tests which throw in these two cases.

I've checked from the Block Kit Builder that the error is the same as mentioned in the documentation in these two cases.

@yhatt
Copy link
Owner

yhatt commented Nov 25, 2019

We're always welcome to pull request.

I myself would not work on this because Slack will have already throw error on API side, but it should have worth for someone.

@yhatt
Copy link
Owner

yhatt commented Mar 6, 2020

We have already been ready to receive pull request from community, but this issue is too survived long with no pull requests in spite of a lot of declarations for contribution. I suppose this issue has to reconsider if we really should leave this in the issue tracker.

IMO, many users (included us) think that app-side validation does not need because Slack have already validated the output blocks while calling API.

We would close this in a week if received no other actions about this from user.

@yhatt yhatt closed this as completed Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants