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

Remove 1 banner limitation and add the unpublish others as an option #102

Merged
merged 12 commits into from
Jan 13, 2021

Conversation

andybroomfield
Copy link
Contributor

Fix #99.

This removes the single alert banner limitation, and replaces it with a checkbox on the alert banner confirmation page to unpublish others.
This also updates the banner order to go by (if the type_of_alert) field is present, by Death of notable person, major, minor, annoucement. Then by date updated.
Move the dismiss token from state api and onto the entity (Note this will require running database updates to update the entity).
Updates the tests to account for new banner behaviour.

@andybroomfield
Copy link
Contributor Author

Drafiting this as a PR so people can check work to date.

@andybroomfield andybroomfield force-pushed the feature/99-unpublish-others-on-confirmation branch from e25dbc5 to 2710c1a Compare December 21, 2020 10:50
@andybroomfield
Copy link
Contributor Author

This should be mostly done now, but need to get the test working before merging.

@andybroomfield andybroomfield force-pushed the feature/99-unpublish-others-on-confirmation branch from 3774a87 to b031d08 Compare December 22, 2020 11:14
…nfirmation

Ref #99

WIP: Initial add the unpublish checkbox and allow more than one banner to be
live at a time. If the checkbox is ticked, unpublish all other banners.
- Removes the existing check one banner test (as now more than one banner)
- Adds extra assertions to the confirmation form test by setting the value
  of the unpublish others checkbox and verifing if an alternative banner is
  published or not.
  (This relies on loading the caniocal banner and checking for the respective
  Put banner live / Remove banner link).
- Update the entity type defintion
- Provide update hook to update the entity
- Add get and set token methods to the entity class
- Update the js so each banner can be dismissed seperatly
- Updates the JS test to handle precense of multiple banners
- Test dismissing each in turn and verified only that banner remains dismissed
- Since the state is now part of the entity, remove the state service
- Goes by the type of alert
  (Death, Major, Minor, Announcement -- Depending on how the field
  type_of_alert is set up)
- Then by the date changed (most recent first).
  Note: if the type is missing, then banners with a type get displayed first.
@andybroomfield andybroomfield force-pushed the feature/99-unpublish-others-on-confirmation branch from b031d08 to c6a08e8 Compare December 22, 2020 16:04
@andybroomfield andybroomfield marked this pull request as ready for review January 4, 2021 17:26
@andybroomfield
Copy link
Contributor Author

andybroomfield commented Jan 4, 2021

This is ready for review now.
I've made the banner order test use a kernel test, hopefully it isn't too complicated to follow what it is testing, but if it is feedback on how to improve it welcome.

@andybroomfield andybroomfield force-pushed the feature/99-unpublish-others-on-confirmation branch from 9d89d5d to 7108d05 Compare January 4, 2021 19:14
@finnlewis
Copy link
Member

Thanks @andybroomfield - just testing now.

@finnlewis
Copy link
Member

I've tested this locally on a fresh install of LocalGov Drupal and on the Lambeth site, both appear to work as expected. I can set multiple banners to be live at the same time, and unselect the box to unpublish other banners.

Works for me.

@ekes want to take a look at the code?

Copy link
Member

@finnlewis finnlewis left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Tested locally on fresh install of LocalGov Drupal and on a copy of the Lambeth site.

I've taken a cursory look at the code and can't see anything that jumps out.

Tests and functionality work for me so happy to approve.

Thanks @andybroomfield !

@finnlewis
Copy link
Member

It would be great to get this one merged. Are you waiting on more reviewing @andybroomfield ?
I've just pinged @ekes to see if he has anything to add.

@andybroomfield
Copy link
Contributor Author

@finnlewis if your happy I will merge this tomorrow and prep a release.

@andybroomfield andybroomfield merged commit 3b2e583 into master Jan 13, 2021
@andybroomfield andybroomfield deleted the feature/99-unpublish-others-on-confirmation branch April 14, 2021 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the one banner live limitation, replace with an option to unpublish others on the confirmation page
2 participants