Page MenuHomePhabricator

Save drafts automatically
Closed, ResolvedPublic

Description

Context

As users translate, drafts should be saved automatically.

Narrative

As a user, I can see how the in-progress translation gets saved automatically, so that my work does not get lost.

Acceptance Criteria

  1. As the user edits a translation it gets saved automatically:
    1. Saving should happen after completing a paragraph.
    2. If there is unsaved content, saving should happen on “leaving the page” events (e.g., the user clicking on “all translations” link)
    3. Clicking on “Publish translation” will save the translation (in addition to publishing it, of course)
  2. A text indicator will show “Saved X min. ago” or “saving...” (if the translation is being saved)
    1. When hovering the indicator, a tooltip will indicate “Translation drafts are saved automatically”
  3. There will no longer be an explicit “Save as draft” button. Only the “Publish translation” one as it used to be

Design notes

Note the “saved 2 minutes ago”:

cx_translate-link.png (614×819 px, 216 KB)

Event Timeline

Arrbee raised the priority of this task from to Medium.
Arrbee updated the task description. (Show Details)
Arrbee changed Security from none to None.

There will soon be a core facility for this: T75241

There is a genera; problem with “Saved X min. ago" labesl. To keep that statement true at any point of time, you need a ticking clock in UX. You see saved 4 second ago, you wait for 10 seconds,- now you should see Saved 14 seconds ago. Updating this at regular intervals is not trivial.

Google drive for example, does not show this timestamp

pasted_file (100×495 px, 6 KB)

They just say: "All changes saved in Drive" and avoids this "clock display".

So @Pginer-WMF, please clarify what is the time intervals for updating this message and what is the cut of relative time to show nothing/actual time.

We also have a problem of constructing the relative time from moment.js and concatenating with "Saving " to create grammatically correct sentence - This is a problem only if we donot restrict the relative time stamp to say "minutes" alone.

I have the following proposal:

Always use minutes as time unit. No "seconds" or "hours". At every 1 minute update the label. And at every x minute autosave. x is always less than 60 and I think 10 mins autosave is reasonable - in case no autosave triggering event happened.

We can also optimize the save api call by checking if anything really changed or not in the translation.

Change 176896 had a related patch set uploaded (by Santhosh):
Save the draft translations automatically

https://gerrit.wikimedia.org/r/176896

Patch-For-Review

Screenshot of the indicator from the above patch

pasted_file (121×1 px, 18 KB)

@santhosh your approach sounds good to me.
The problem with "all changes saved" is that we are not planning to save as the user types (Google docs moves from "all changes saved" to "saving" as the user types a single character). In our case we plan to have a bigger latency to avoid excessive load so we cannot say either "all changes saved" or "saving" while the user is editing a paragraph we have not triggered saving for.

I think that using only minutes should be enough. Here are some additional considerations:

  • Don't use "0 minutes ago", use "Saved just now" instead.
  • If it takes more than 5 or 10 minutes, trigger auto-save. If there are changes the user would be happy to don't lose 10 minutes editing what may be a complex paragraph to translate. If there are no changes we can update the indicator ("Saved just now") anyway since the important thing is to communicate that changes won't be lost.

-To be extra safe we can have a special "Not saved for a while. Retrying..." when the counter goes beyond the limits we defined above (which may happen due to connection problems).

santhosh moved this task from Done to In Review on the LE-Sprint-79 board.

Change 176896 merged by jenkins-bot:
Save the draft translations automatically

https://gerrit.wikimedia.org/r/176896

Arrbee subscribed.