]> BookStack Code Mirror - bookstack/commit
Reviewed and refactored additional editor draft save warnings
authorDan Brown <redacted>
Mon, 4 Oct 2021 19:26:55 +0000 (20:26 +0100)
committerDan Brown <redacted>
Mon, 4 Oct 2021 19:26:55 +0000 (20:26 +0100)
commitf99af807d044b55ef8ec6c43d8ad8c7d61b47146
treee5bc45c4c1118e4d718b5b464d9a8e5b0736a1d3
parent756b55bbffedb6e5fde91f9fbc61f5a382f20705
Reviewed and refactored additional editor draft save warnings

- Added testing to cover warning cases.
- Refactored logic to be simpler and move much of the business out of
  the controller.
- Added new message that's more suitable to the case this was handling.
- For detecting an outdated draft, checked the draft created_at time
  instead of updated_at to better fit the scenario being checked.
- Updated some method types to align with those potentially being used
  in the logic of the code.
- Added a cache of shown messages on the front-end to prevent them
  re-showing on every save during the session, even if dismissed.
app/Entities/Models/PageRevision.php
app/Entities/Tools/PageEditActivity.php
app/Http/Controllers/PageController.php
resources/js/components/page-editor.js
resources/lang/en/entities.php
tests/Entity/PageDraftTest.php