Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate "draft" status to owner objects #72

Closed
13 tasks done
chillu opened this issue Dec 4, 2017 · 5 comments
Closed
13 tasks done

Propagate "draft" status to owner objects #72

chillu opened this issue Dec 4, 2017 · 5 comments

Comments

@chillu
Copy link
Member

chillu commented Dec 4, 2017

Overview

Authors deal with more versioned, nested relationships in SilverStripe 4. In order to simplify the mental model, many authors will still think about publication around the "main" types: Pages, and optionally Blocks. With the ownership and cascading publish abilities already in place, authors effectively regard the "main" record as changed if any of it's owned relations are changed (have an unpublished draft). The CMS needs to effectively communicate this draft status at a level that makes sense to authors, without forcing them to click through dozens of editing UIs for owned relations to determine individual draft status of these.

Example

  • Page has_many and ownsContentBlock
  • Page many_many Watcher
  • GalleryContentBlock has_many and owns GalleryItem
  • GalleryItem has_one and owns Image

Effect:

  • Changing the title of Image (without publishing) would mark GalleryItem, GalleryContentBlock and Page as changed.
  • Adding an unpublished GalleryItem would mark GalleryContentBlock and Page as changed
  • Adding and publishing a GalleryItem would not mark any records as changed
  • Adding a Watcher would not mark any records as changed

Acceptance Criteria

  • The draft status is only affected by owned relations
  • The draft status is reflected throughout nested owners, unless the ownership chain is "broken"
  • Only unpublished relations change the status of owners
  • If an owner is published, the draft status of all nested owned relations is reset
  • The draft status is triggered when an item in an owned relation is added or removed
  • If a record is owned by more than one owner ("non-exclusive ownership"), all of them show a draft status
  • The draft status is correctly reflected in the site tree (for pages with nested owned relations)
  • The draft status is correctly reflected in edit views for GridField and Page (GridField update is separate: Edit form action buttons improved. #222)
  • If an owned relation is changed on an edit screen, the change is reflected after the owner is saved (and the view is refreshed)
  • Showing the draft status does not significantly slow down tree views (for Pages), or GridField views (for other records)
  • Loading and saving data on a record (owner and owned) is not significantly slowed down either.

Notes

  • A ChangeSet adds owns relations (recursively) throughChangeSet->findReferenced(), regardless of they're changed or not.
  • Unchanged ChangeSetItem records will have VersionBefore = VersionAfter
  • A ChangeSet is auto-created when a record gets published (but not before)
  • A ChangeSet indicates a collection of records that should be published together, so we can't add "owners" here (e.g. changing an Image in the example above doesn't imply adding GalleryItem and GalleryContentBlock in a campaign to be published)
  • Given the above, we can't use ChangeSet to determine changes on records: The set doesn't exist early enough (before publish), and should only include objects that can be published.

Pull Requests

@chillu
Copy link
Member Author

chillu commented Oct 28, 2018

Removing from Zenhub epic, since that's closed now.

@chillu
Copy link
Member Author

chillu commented Mar 20, 2019

@chillu
Copy link
Member Author

chillu commented Jun 4, 2019

@unclecheese @dnsl48 When this card is done, is there anything in custom code that we'd need to move over to versioned-admin or another core repo later? So in other words: Do we need another variation of this card for the core implementation, on top of the project focus of this current PoC work?

@dnsl48
Copy link
Contributor

dnsl48 commented Jun 5, 2019

To retest & fix:

Given a Page with a Block with an Image.
Go to Gallery, find the image and update its title. Save, but do not publish.
Open site tree. Check the page status is `MODIFIED`.

Open the page for editing.

Result: the button `Published` is not active.
Expected: the button `Publish` should be active (green and indicating the page may be published)

@dnsl48
Copy link
Contributor

dnsl48 commented Jun 12, 2019

The publish button is going to a separate issue silverstripe/silverstripe-versioned-snapshots#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants