Review 10.4 Merged

65766[BUGFIX] Separate 'delete' and 'discard' in DataHandler

Christian Kuhn CR +2 V +2 Nightmare +5405 −4428 updated 09/18/20, 19:24

Commit message

There are 4 "drop record" scenarios in workspaces:
* Delete a new or changed record in list/page module
* Create a delete placeholder in list/page module to mark a
  live record as to-be-deleted on workspace publish
* Discard (throw away) a change in workspace module
* Flush all workspace changes by deleting a sys_workspace
  record.

All these scenarios are handled with the same DataHandler
code which leads to tons of bugs since especially
"delete & create delete placeholder" compared to
"discard & flush" are logically different things.

The patch separates discard and flush to a new codebase.
First patch sets started with a 1:1 copy of the delete code,
then carefully refactored the code to its final state. The
roughly 850 lines of delete code are streamlined to about
300 lines for discard and flush. The code is much easier
to follow, recursions are simplified and access checks are
in one place.

Discard previously created a mixture of hard and soft deleted
records in the database, leading to a huge mess. This changed:
Discard now always means that records are dropped from database.

The discard code now properly cascades down into relations,
solving tons of bugs along the way. The functional DataHandler
tests are refactored and heavily extended to cover discard.
Two previously existing issues are not fixed yet: ManyToMany
relations are not properly cleaned up on discard, and discarding
does not fully follow localization overlays in 'connected' mode.
Those scenarios are marked with @todo's in the .csv files and
should be relatively easy to solve with dedicated single patches.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 262

Show 242 more files