fix: Trix field disable_attachments option unexpected behaviour #2462
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR comes in order to fix a critical regression introduced by #2429 which changed
by
Unfortunately this created an unexpected behaviour making
@attachments_disabled
always defaulting totrue
. Here is why:This has the side effect of breaking the attachment feature by always disabling it even when specifying an attachment key or manually set the
attachments_disabled
option tofalse
.This PR comes with a simple fix extracting the logic in a private method and validating if the boolean value is set to
true
orfalse
.Checklist:
Manual review steps
There's multiple ways to reproduce it:
trix
field with anattachment_key
and try to add an attachment to the contenttrix
field and explicitely set theattachments_disabled
to true, the button to add an attachment will show up anyway