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

feat(http, validate): validate modal titles #2142

Conversation

suneettipirneni
Copy link
Member

@suneettipirneni suneettipirneni commented Feb 14, 2023

Validates modal titles within InteractionResponseData when sending a response.

Closes #1622

@github-actions github-actions bot added c-http Affects the http crate c-validate Affects the validate crate t-feature Addition of a new feature labels Feb 14, 2023
Comment on lines +71 to +74
twilight_validate::component::modal_title_length(modal_title).map_err(|e| Error {
kind: ErrorType::BuildingRequest,
source: Some(Box::new(e)),
})?;
Copy link
Member Author

@suneettipirneni suneettipirneni Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if this is the way I should handle this. If not, please let me know the desired solution.

Copy link
Member

@zeylahellyer zeylahellyer Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do validation in IntoFuture at the moment... current intuition and prior art is that this should go in CreateResponse::new (which is a breaking change). But the downside there, too, is that it's a breaking change. Both of these are problems we're aiming to solve for 0.16, so I don't have a good answer here at the moment. cc @7596ff

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this request already accepts invalid data, so this isn't even a complete fix. my reflex is to just punt to 0.16 because this comes under the whole "validate at the end" paradigm. we can at least leave the changes in the validate crate to save this pr, but i don't want to do anything to the request at the moment

@suneettipirneni suneettipirneni changed the title feat(http, validate): Validate modal titles feat(http, validate): validate modal titles Feb 14, 2023
@zeylahellyer zeylahellyer added w-do-not-merge PR is blocked or deferred w-unapproved Proposal for change has *not* been approved by @twilight-rs/core. labels Feb 17, 2023
@zeylahellyer zeylahellyer marked this pull request as draft February 17, 2023 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-http Affects the http crate c-validate Affects the validate crate t-feature Addition of a new feature w-do-not-merge PR is blocked or deferred w-unapproved Proposal for change has *not* been approved by @twilight-rs/core.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modal Title has a max length of 45
3 participants