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

SHS-5905: Rework social media footer (backend) #1662

Open
wants to merge 19 commits into
base: 11.5.1-release
Choose a base branch
from

Conversation

codechefmarc
Copy link
Collaborator

@codechefmarc codechefmarc commented Oct 18, 2024

READY FOR REVIEW

Summary

  • Adds a social media block as a custom block plugin
  • Adds permission for site managers to edit the social media block
  • Adds an exception to allow the contextual link to work for site managers

Need Review By (Date)

2024-10-23

Urgency

low

Steps to Test

  1. Login to the site as an admin
  2. Visit the block layout page /admin/structure/block
  3. Under the footer region, click "Place block"
  4. Click "Place Block next to the "Social Media Block"
  5. Uncheck "Display title"
  6. Set some options for the Icon Size and the Layout
  7. Add some links into the form - test only adding a link and not a label (allowed), and test adding a label and not a link (not allowed)
  8. Save the block
  9. View on the front-end
  10. Verify that the social media block shows up
  11. Masquerade as a user with only site manager role
  12. View the front-end
  13. Verify that a site manager can edit, but not remove, the new social block

PR Checklist

@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 17:52 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 17:54 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 18:13 Destroyed
@codechefmarc codechefmarc self-assigned this Oct 18, 2024
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 18:53 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 19:30 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 21:18 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 21:38 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 21:56 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 18, 2024 22:15 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 21, 2024 21:25 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 21, 2024 21:43 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 21, 2024 22:41 Destroyed
@codechefmarc codechefmarc marked this pull request as ready for review October 21, 2024 22:50
Base automatically changed from 11.4.1-release to develop October 30, 2024 14:39
@ahughes3 ahughes3 temporarily deployed to Tugboat October 30, 2024 18:05 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 30, 2024 18:38 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 30, 2024 19:14 Destroyed
@codechefmarc codechefmarc changed the base branch from develop to 11.5.1-release October 30, 2024 19:25
@ahughes3 ahughes3 temporarily deployed to Tugboat October 30, 2024 21:32 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat October 30, 2024 23:27 Destroyed
@codechefmarc
Copy link
Collaborator Author

@cienvaras - This is ready for testing. I was able to solve the issue with the contextual menus. I see there is one test that is failing (hs_sandbox), but the rest pass so I think this one site is having a one-off problem? I re-ran the jobs a few times to see if it would clear.

@joegl
Copy link
Contributor

joegl commented Nov 1, 2024

@codechefmarc I merged PR #1677 into the 11.5.1-release to fix the field_paragraph_style permissions. You can remove them from there now 👍

@ahughes3 ahughes3 temporarily deployed to Tugboat November 2, 2024 01:21 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat November 2, 2024 01:36 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat November 5, 2024 19:55 Destroyed
@ahughes3 ahughes3 temporarily deployed to Tugboat November 5, 2024 21:04 Destroyed
Copy link
Collaborator

@cienvaras cienvaras left a comment

Choose a reason for hiding this comment

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

@codechefmarc In general everything works as expected, however the contextual menu access is still not working as expected. The contextual menu for the social media footer block is visible now, but other menus that were previously hidden (paragraphs for example) are visible too.

I also found a couple of things that might need attention:

  • In some cases, when I click on the "Add another item" button the form scrolls to the bottom and the "Attributes" fieldset is focused. This is only happening to me on the initial block creation, not on other edits.
  • The previous implementation allowed mailto: links. but url field validation doesn't allow them. This was in the original requirements but I checked the existing sites and only one site is using this kind of links. I'll check with Albert if this is still a requirement.

Also, I updated the template and added the styles and logic for the icon selection. Let me know if you have any questions.

@@ -76,9 +76,7 @@ permissions:
- 'administer main menu items'
- 'administer nodes'
- 'administer users'
- 'assign author role'
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're changing here a lot of permission unrelated to the block itself, please update to include only the necessary permissions.

'link_title' => [
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#description' => $this->t('If empty the domain name will be used.'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This help text in the specs was inaccurate, please change it to "If empty, the social platform name will be used for popular platforms. If the platform is unknown then the domain name will be used."

!\Drupal::currentUser()->hasPermission('view all contextual links')
!in_array($group, ['media', 'block_content', 'hs_blocks.social_media_block']) &&
!$current_user->hasPermission('view all contextual links') &&
!$current_user->hasPermission('edit social media block')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is allowing any user with the "edit social media block" to see any contexual menu, including types that were previously exclude like paragraphs. It's necessary to ensure that only the block types in the list have contextual links for any user without the "view all contextual links" permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants