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

Issue #3385634 by nkoporec: Inline images are not displaying in social footer block #3509

Conversation

nkoporec
Copy link
Contributor

@nkoporec nkoporec commented Sep 6, 2023

Problem

When inserting an inline image in social footer block via the admin/config/opensocial/footer-block settings page, the image is not rendered after hitting the save button. The DOM element is there but the URL to the image is broken for other users (it works for the one that saved the form and uploaded the image).

The reason for this is that by default CKEditor will save inline images in the private directory, this ties the image to be only viewed/accessed by users who created this private image or have access to the entity that this image is attached to, since this form is not tied to any entity but rather its a custom implementation it means that only user who uploaded the inline image will have access to it.

Solution

Implement a hook_file_download() in social_footer module that allows access to private images used within the text field of the social footer block settings.

Issue tracker

https://www.drupal.org/project/social/issues/3385634

Theme issue tracker

[Required if applicable] Paste a link to the drupal.org theme issue queue item, either from socialbase or socialblue. If any other issue trackers were used, include links to those too.

How to test

  1. Log in as user 1.
  2. Go to admin/config/opensocial/footer-block and upload an image via the CKEditor.
  3. Save the form
  4. Log in as different user and check the footer block if the image is displaying correctly.

Definition of done

Before merge

  • Code/peer review is completed
  • All commit messages are clear and clean. If applicable a rebase was performed
  • All automated tests are green
  • Functional/manual tests of the acceptance criteria are approved
  • All acceptance criteria were met
  • New features or changes to existing features are covered by tests, either unit (preferably) or behat
  • Update path is tested. New hook_updates should respect update order, right naming convention and consider hook_post_update code
  • Module can be safely uninstalled. Update/implement hook_uninstall and make sure that removed configuration or dependencies are removed/uninstalled
  • This pull request has all required labels (team/type/priority)
  • This pull request has a milestone
  • This pull request has an assignee (if applicable)
  • Any front end changes are tested on all major browsers
  • New UI elements, or changes on UI elements are approved by the design team
  • New features, or feature changes are approved by the product owner

After merge

  • Code is tested on all branches that it has been cherry-picked
  • Update hook number might need adjustment, make sure they have the correct order
  • The Drupal.org ticket(s) are updated according to this pull request status

Screenshots

Before:
image

After:
image

Release notes

Fixed an issue where inline images would not render correctly in social footer block.

Change Record

Translations

@nkoporec nkoporec added type: bug Fixes a bug in Open Social status: needs review This pull request is waiting for a requested review prio: medium team: guardians labels Sep 6, 2023
@nkoporec nkoporec added this to the 11.10.1 milestone Sep 6, 2023
@nkoporec nkoporec requested a review from a team September 6, 2023 14:27
@nkoporec nkoporec force-pushed the issue/3385634/inline-images-are-not-displaying-in-social-footer-block branch from 51fcf9f to 0f63249 Compare September 6, 2023 14:35
@mergeable
Copy link

mergeable bot commented Sep 6, 2023

Thanks for contributing towards Open Social! A maintainer from the @goalgorilla/maintainers group might not review all changes from all teams/contributors. Please don't be discouraged if it takes a while. In the meantime, we have some automated checks running and it might be that you will see our comments with some tips or requests to speed up the review process. 😊

@nkoporec nkoporec force-pushed the issue/3385634/inline-images-are-not-displaying-in-social-footer-block branch 4 times, most recently from 8b408f7 to 8fcb674 Compare September 7, 2023 05:49
@BiaInacio
Copy link
Contributor

Image is being displayed on the footer as expected!
image

@tbsiqueira tbsiqueira force-pushed the issue/3385634/inline-images-are-not-displaying-in-social-footer-block branch from 8fcb674 to 2e315c9 Compare September 8, 2023 07:25
@tbsiqueira
Copy link
Contributor

@nkoporec, please add tests to this feature, this is a quick test win

@nkoporec
Copy link
Contributor Author

@tbsiqueira as discussed, I created a follow up for the test, as currently theI attach the file "/files/opensocial.jpg" to "Image" is broken and all tests that are using it are tagged as disabled

@nkoporec nkoporec force-pushed the issue/3385634/inline-images-are-not-displaying-in-social-footer-block branch from 8a3a347 to fd1064e Compare September 14, 2023 06:37
@tbsiqueira tbsiqueira force-pushed the issue/3385634/inline-images-are-not-displaying-in-social-footer-block branch from fd1064e to e5b0451 Compare September 15, 2023 10:30
@nkoporec nkoporec merged commit a33cc8c into main Sep 15, 2023
190 checks passed
@nkoporec nkoporec deleted the issue/3385634/inline-images-are-not-displaying-in-social-footer-block branch September 15, 2023 13:32
@tbsiqueira tbsiqueira added backport: verified This pull request has been back ported to an older minor version status: no action needed and removed status: needs review This pull request is waiting for a requested review labels Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: verified This pull request has been back ported to an older minor version prio: medium team: guardians type: bug Fixes a bug in Open Social
3 participants