hasan-ozbey / flarum-diff

View post edit histories in your Flarum forum.
https://discuss.flarum.org/d/22779-diff-for-flarum
MIT License
8 stars 6 forks source link

Hide "Options" for last revision if it's the only non-deleted revision #8

Closed hasan-ozbey closed 4 years ago

hasan-ozbey commented 4 years ago

Bug Report

Current Behavior If there is only one non-deleted revision in revision list and it's the last one, "Revert Changes" action fails because there is no any other content to be used for revert action.

Steps to Reproduce

  1. Edit a post
  2. Click on "original content" revision in the revision list
  3. Click on Options -> Delete button and delete the "original content"
  4. Click on "most recent" revision in the revision list
  5. Click on Options -> Revert Changes button
  6. See the "Reverting of changes failed." error

Expected Behavior "Options" button should not be visible if last revision is the only non-deleted revision in the revision list.

Screenshots

Environment

Possible Solution I think I should count deleted revisions and change some logic here: https://github.com/the-turk/flarum-diff/blob/e2980c8f540d11b47f831d500ed4c7834271e64f/js/src/forum/components/DiffModal.js#L150-L152