Comments

bojanz created an issue. See original summary.

skyredwang’s picture

andreasderijcke’s picture

In preparation for this, profile entities should use RevisionableContentEntityBase.
This also makes getRevisionAuthor() and setRevisionAuthorId() obsolete, as getRevisionUser() and setRevisionUser() will be available.

Using RevisionableContentEntityBase will solve a lot of issues when trying to use diff module to compare revisions.

marthinal’s picture

Status: Postponed » Needs review
StatusFileSize
new246.53 KB
new6.09 KB

I've been working on it. This is the result:

I found this problem with entity module #2951528: Empty results for revisions of entities without langcode

So for the moment we can apply that patch.

Thanks!

marthinal’s picture

StatusFileSize
new808 bytes
new6.57 KB

If we already have revisions on our site then we need to update the new fields to avoid errors.

andriy khomych’s picture

Hi, this patch doesn't work on official RC1 release.

andriy khomych’s picture

Here is a patch for RC1.

Status: Needs review » Needs work

The last submitted patch, 7: profile-revision-ui-for-rc1-2599014-7.patch, failed testing. View results

loziju’s picture

Status: Needs work » Needs review
Related issues: +#2951528: Empty results for revisions of entities without langcode
StatusFileSize
new6.25 KB

Rerolled for rc4. Also added the reference to #2951528: Empty results for revisions of entities without langcode as highlighted in #2599014-4: Create the revision UI for profiles above.

Please note that this patch still fails against 1.x-dev. Seems like lots of changes in dev compared to rc4. Would require @bojanz / @mglaman review.

jsacksick’s picture

StatusFileSize
new3.01 KB

Here's my first attempt at this.
Wondering if adding the "Revisions" operation is a good idea, Node provides a "Revisions" tab for instance.

bojanz’s picture

Note that the prep work from previous patches was done in #2844963: Complete the revision implementation.

It does sound sensible to have a Revisions tab.

I think we're not handling permissions at all right now.
The routes generated by Entity API use EntityRevisionRouteAccessChecker, which assumes the existence of a bunch of permissions, but they're not actually generated (there's no permission provider for them).

chandeepkhosa’s picture

Thanks for the work done so far everyone, I really appreciate it.

I tried applying the patch in #10 with composer-patches and got an error when running `composer install` of `Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2019-06-06/profile_2599014-10.patch`

From the following, it says that src/ProfileListBuilder.php was unsuccessful in being patched on L138, so it probably needs a re-roll.
I'm running Drupal 8.8.1, and Profile 1.0.0

When running it with verbose, I got the following

patching file src/Entity/Profile.php

Hunk #1 succeeded at 43 (offset 6 lines).

Hunk #2 succeeded at 75 (offset 7 lines).
Hunk #3 succeeded at 88 with fuzz 2 (offset 7 lines).

patching file src/ProfileListBuilder.php

Hunk #2 FAILED at 138.

Hunk #3 succeeded at 153 with fuzz 1 (offset 2 lines).

1 out of 3 hunks FAILED -- saving rejects to file src/ProfileListBuilder.php.rej
justinmello32’s picture

Getting same patch error when trying to apply, #12.

mygumbo’s picture

Does anyone have a working patch for 8.8 and 1.1? Thank you!

jwilson3’s picture

StatusFileSize
new2.89 KB

I applied patch in #10 to 8.x-1.0-rc5 then rebased it to 8.x-1.x and manually resolved the merge conflict where ProfileListBuilder::getOperations() function was renamed to getDefaultOperations(). The rest rebased cleanly. No way to cleanly create an interdiff (that i know of) with a rebase like this, so I'll just include the relevant merge conflict and you can look at the patch itself to see how it was resolved.

++<<<<<<< HEAD
 +  public function getDefaultOperations(EntityInterface $entity) {
 +    $operations = parent::getDefaultOperations($entity);
++=======
+   public function getOperations(EntityInterface $entity) {
+     $operations = parent::getOperations($entity);
+     $profile_type = ProfileType::load($entity->bundle());
++>>>>>>> 2599014-10
jwilson3’s picture

I'm getting a merge conflict when applying patch in #15 and #2900573-50: Make profile label able to be saved and so work with Auto Entity Label or other alterations that work on save to a site, so the solution is to simply move the Profile::urlRouteParameters() method added by this patch down a little further in the code instead of at the very top of the class.

justinmello32’s picture

Hi all

This request might be better fitting on a new feature request but I do feel that it relates to revisions. In the past, profile 2 was able to leverage the Diff Module to not only interact with revisions but to show the differences between them. This functionality is incredibly useful for our content editors in which content needs to be reviewed and the editor can quickly see the diff to approve/disapprove changes. I'm incredibly happy that profile revisioning is actively being worked on but was curious if there were any plans to integrate diff into profile revisions as well?

Thanks for the work!

Justin

kylemac’s picture

Hey everyone,

Has anyone gotten diff's working on revisions?

Thanks!

kylemac’s picture

Checking back a few months later to see if there's anyone out there who has diff's working, thanks!

ludo.r’s picture

Patch #16 applies cleanly on 8.x-1.7.

Works as expected!

sime’s picture

Patch works for me, but regarding diffs and #19, someone would need to write the integration how https://www.drupal.org/project/entity_diff_ui does it for block/taxonomy/media.

sime’s picture

Just for #18 and #19 I've attached code for Diff UI support on #3409345: Add support Profile Diff UI.

sime’s picture

The `revision_created` field is never updated.

sime’s picture

casey’s picture

StatusFileSize
new2.78 KB

Reroll of patch #16

drupalfan2’s picture

Thank you for patch #25.

I am using patch #16 for a few years and I have changed to patch #25 (after updating the profile module) now, but both versions have the following problem:

When profiles are updated a new revision is only generated when the logged in user is the admin. For other users no new revisions are created when they log in and update/change their profiles.

The checkbox for "Allow profiles of this type to be revisioned" is checked.

How can I solve this problem? I want to achieve that on any profile change a new revision is generated (also for non admin users).
Thanks.

johnjw59’s picture

StatusFileSize
new2.8 KB
new325 bytes

Very small tweak to the patch attached. Just adjusted the weight of the new "Revisions" operations link so it's not the default option (default should remain "Edit").