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

Show warning in editor when local draft is out of date #324

Merged
merged 1 commit into from Jul 22, 2020

Conversation

thebaer
Copy link
Member

@thebaer thebaer commented Jun 11, 2020

When editing a post, this tracks the updated date that the local, in-browser draft is based on, and compares it to the post's actual updated value in the database.

If the database's updated value is after the local draft's updated date, this warning is shown to the user, allowing them to delete their local draft and load the latest version:

Screenshot from 2020-06-11 11-46-46

This fixes #41.

Testing notes: This PR includes style changes; update your stylesheet by running: make ui. Also note your database timezone must be set to UTC for this to work correctly.


  • I have signed the CLA

@thebaer thebaer added this to the 0.13 milestone Jun 11, 2020
@cjeller1592
Copy link
Contributor

cjeller1592 commented Jun 11, 2020

Works good on my end!

Would it be worth it to add language mentioning if you want to override the draft updated elsewhere?

This post has been updated elsewhere since you last published! If you want to override that update, then continue with this draft. If not, delete draft and reload.

But that might be such a small use case that I don't think it's worth mentioning.

@thebaer
Copy link
Member Author

thebaer commented Jul 22, 2020

Thanks for checking this out, @cjeller1592! I wanted to keep it concise, which is why I chose the current verbiage. But if it's confusing to people we can definitely change it in the future.

Merging this now!

@ghost
Copy link

ghost commented May 11, 2021

I recently updated to the new release candidate and am observing an odd behavior with this feature. All posts show this message, and clicking delete and redraft simply creates a new blank post that still shows this message.

I would guess this must be related to time configuration. I checked and the machine is set to UTC and is synced with a time server. My local machine is configured to the same time in EST.

Any ideas what might be going on?

EDIT: I tried to clear the database and reinstall writefreely and was still getting this message. Figured out that meant it was probably something related to the cache. Cleared my browser's cache and it went away. There might be a cookie getting set that it causing this message to persist in some cases.

@thebaer
Copy link
Member Author

thebaer commented May 12, 2021

Hmm, what timezone is your database set to (assuming you're running MySQL)?

@ghost
Copy link

ghost commented May 13, 2021

Hmm, what timezone is your database set to (assuming you're running MySQL)?

I don't see anything setting a timezone in /etc/mysql. I suppose it would be whatever the default is after running the MariaDB setup scripts on a stock Ubuntu machine set to UTC.

Since I never explicitly set up time zones in SQL before, I just ran mysql_tzinfo_to_sql /usr/share/zoneinfo | sudo mysql -u root -p mysql and got the output:

Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.

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

Successfully merging this pull request may close these issues.

After update through API, editor shows old content
2 participants