StashEdit: Refactor and simplify edit.stash.js
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 8 Aug 2016 23:03:39 +0000 (16:03 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 11 Aug 2016 01:13:48 +0000 (01:13 +0000)
commit5b13d7827f05dbc362cad58083ab597b8b37e88c
tree5a93620386104fee70d8cff8cd99a7d1a34ccdd5
parent3853783ef73f22daf175afa8a59800b8b4f2726c
StashEdit: Refactor and simplify edit.stash.js

* Reduce call sites for stashEdit() to only inside checkStash().

* Update onFormLoaded() to not call stashEdit() directly but instead
  call checkStash(). This avoids hardcoding the priority and
  simplifies code by ensuring isTextChanged() and isSummaryChanged()
  are always checked before stashEdit() is called.

* Move texthash and priority handling to stashEdit().

* Don't clear lastTextHash if text hasn't changed.

* Remove check for 'origSummary' in onTextFocus. Have stash rate
  always be 3s for the textarea, and always 1s for the summary.

Change-Id: I3f049df6ee2e1c218e8b3c1c397ff0bc50e58c8e
resources/src/mediawiki.action/mediawiki.action.edit.stash.js