issue: Canned Response Inline Images #6623
Merged
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.
This addresses an issue where saving edits made to a canned response with two or more inline images either breaks the page or causes 500 error. This is due to incorrectly formatted array of IDs for the inline images causing further issues with
$att->file->getId()
on render.This adds a check in
keepOnlyFileIds()
to see if the$value
from the array of IDs is an array itself. If so, we will break apart the$value
array into$id
(File ID) =>$value
(File Name) to match the expected format. If the$value
is not an array, it will use the existing format (as before). This is important as we have two different array formats for the File IDs depending on what method is called to generate them. We need to be able to account for both formats. In addition, this adds the file name to the$attachment
array ingetAttachmentIds()
so we can save the new attachment name (if different).Lastly, this fixes an issue where the Canned Response attachment upload field was blindly including all attachments rather than excluding the inline images.