Page MenuHomePhabricator

PageUpdater: implement EditResult class
Closed, ResolvedPublic


This task description was written after the feature was implemented. I just wanted to tidy up the phab tasks.

To achieve goals described in T254074: Implement the reverted edit tag, it is necessary to improve how PageUpdater handles and communicates the outcome of the edit, most importantly whether the edit was a revert. To encapsulate all information previously provided through $originalRevId, $undidRevId and others, an EditResult object is introduced.

Most important design aspects:

  • EditResult is immutable.
  • It is constructed only using EditResultBuilder (builder pattern).
  • PageUpdater is responsible for operating the EditResultBuilder.
  • PageUpdater provides a public markAsRevert method that lets callers specify the type of the revert, reverted revisions and the restored revision.
  • A revert can be exact or non-exact. Thus all undos are reverts, but not all of them will be exact. This is indicated by EditResult::isExactRevert method.
  • The EditResult object is built when the edit is saved and then passed to extensions using PageSaveComplete hook.