Page MenuHomePhorge

Phriction: evaluate real page move (breaking change)
Open, LowPublic

Description

Current Problem: Moving a document tears it down

At the moment, when you Move a Phriction document (that is, "Rename URL", for friends), the document is not really moved, and these things happen instead:

  • if the destination never existed:
    • a new dummy copy is created with a single new version with the current content (!)
  • if the destination existed and was deleted:
    • a new single revision is appended in the history of the deleted document (!)

In all cases, all the following unexpected things happen after moving, at least:

  1. T15822: When a phriction page is moved, history should follow the page move
  2. T15575: Moving a Phriction page does not move its Tags
  3. the destination page has not past subscribers
  4. the destination page has not past awarded tokens (SUPER IMPORTANT BABY TEQUILAS LOL)
  5. the destination page has not past flags
  6. the destination page has not past comments
  7. the destination page has different PHID

Basically, you "Move" a page... and instead you disintegrate it 💣 from its ashes a new wild page appears (with just your title, and your content) like a strange delicate baby phoenix lol

Exploration of the Current Status

At the moment a PhrictionDocument seems quite sticky on its title. Maybe they should be called "Title placeholders" for friends.

So, at the moment the Move feature works by making sure that the source PhrictionDocument is mostly untouched and by making sure that there is a new document placeholder:

https://we.phorge.it/source/phorge/browse/master/src/applications/phriction/controller/PhrictionMoveController.php;18336f0b9a9808866e2a32fc910707cd6e169dc8$71-85

https://we.phorge.it/source/phorge/browse/master/src/applications/phriction/storage/PhrictionDocument.php;18336f0b9a9808866e2a32fc910707cd6e169dc8$59-68

And by adding a new version:

https://we.phorge.it/source/phorge/browse/master/src/applications/phriction/xaction/PhrictionDocumentMoveToTransaction.php;18336f0b9a9808866e2a32fc910707cd6e169dc8$28-37

So that's why the new document is really something completely separated at the moment.

So, the current business logic that seems to have more limitations than features is:

→ A PhrictionDocument is currently title-oriented.

Considering New Approaches

There is some natural desire for this:

→ A PhrictionDocument should be able to change title while keeping versions and all metadata.

Non-Proposal

If we don't want to afford new approaches, we can just make sure to inherit past stuff and edges (I say "inherit", to intentionally stay a bit vague between "copy" and "move").

So at least on the new copy we should

  • move versions
  • copy? tags
  • copy? subscribers
  • copy? awarded tokens
  • copy? flags
  • move? comments
  • ...

But this is a lot of work and more delicate than just changing the title.

Proposal

CurrentAfter ✨
Target documentThe target page is a new dummy one from scratchThe target page is the source page \o/
Source documentAdd version with ChangeType = 3 MOVE_AWAYThe source page is a new dummy one from scratch with add version with ChangeType = 3 MOVE_AWAY

Possible pitfalls:

  • What we should do on the deleted target page?
    • Possible solution: we can just apply a move to that too. Appending (2) in its title. So their versions are NOT meld with the old page.
  • feel free to share comments to discuss possible pitfalls and add here 🌈

Quality Assurance

Whatever the solution, this is the minimal test plan for any solutions:

  1. all the points under "Current Problem" are all solved
  2. already existing "move" transactions must still work
  3. create a page "source", create a page "destination", move "source" to "destination": it still should say "You can not move this document there, because it would overwrite an existing document which is already at that location. Move or delete the existing document first."
  4. create a page "source", create a page "destination", delete "destination", move "source" to "destination": it still works like before (unclear what should happen to the target destination, since it has history and metadata and comments, maybe should be moved elsewhere)