Problem/Motivation
The paragraphs are a composite part of the encapsulating node.
The diff currently shows nothing at all.
Proposed resolution
Provide a diff plugin for the paragraphs field type (currently entity reference revision), see also #2430209: Create own fieldtype for Paragraphs
And make sure the paragraph types have proper diff configuration for their fields.
Then, the encapsulating node (or whatever) containing paragraphs can show a nice diff.
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #95 | interdiff-2433099-92-95.txt | 367 bytes | johnchque |
| #95 | provide_a_custom_diff-2433099-95.patch | 5.33 KB | johnchque |
| #94 | diff_test_dependency.patch | 367 bytes | johnchque |
| #92 | interdiff-2433099-90-92.txt | 4.18 KB | johnchque |
| #92 | provide_a_custom_diff-2433099-92.patch | 5.69 KB | johnchque |
Comments
Comment #1
miro_dietikerA good example for a previously unsupported field type that needs integration with a plugin.
#2424267: Provide a diff plugin for comment settings
Comment #2
Anushka-mp commentedThe plugin for diff module since there is no field type for paragraphs the plugin is based on the field type entity_reference_revisions.
Created the issue #2459237: Services for diff plugin for adding the services for the plugin
Comment #4
Anushka-mp commentedAdding screens.
Comment #5
Anushka-mp commentedRemoved this line.
Comment #7
miro_dietikerNice work. That already helps a lot to understand what's happening.
When looking at the screenshots provided, i realise that a paragraph with multiple items is offered as one field.
It would be very nice, if diff would understand recursive structure and we could flatten the paragraph items into top level items.
I guess that's super followup fancyness.
Comment #8
lhangea commentedComment #9
Anushka-mp commentedComment #10
lhangea commentedNow that the entity parser service is injected in the base plugin class we should definitely use it :)
Comment #12
Anushka-mp commentedThe entity parser service used from the injected config.
Needs test coverage for this.
Comment #14
sasanikolic commentedAdded the tests.
Comment #16
miro_dietikerYeah, good start.
Please put this into a separate test method about diff. Will be extended with more diff cases in future.
Pick "Text" only. Image part is unused in this sequence.
Cc => C
Comment #17
sasanikolic commentedSeparated the test and added a field for text only.
Comment #21
berdirIt should be a separate test *class*, not just method. With a @dependencies diff annotation.
It also needs a test_dependencies entry in the info file for the diff module. Please upload that as a separate patch, as that needs to be committed first, then we need to wait for testbot dependencies to rebuild, then it should work.
Comment #22
miro_dietikerProviding the fix to add test dependencies to diff first.
Comment #23
sasanikolic commentedSeparated the test into a new class and added the @dependencies.
Comment #26
miro_dietikerOh, in order to make the tests pass, we first need a commit of the diff test dependency.
Comment #28
miro_dietikerPlz commit the test dependency first.
Comment #32
miro_dietikerThe original patch still needs review. I guess the dependencies need a rebuild now that is only done once per day. Let's retest in 24h.
Comment #35
miro_dietikerSo the dependency still doesn't work...
Next step: Crying out loud. ;-(
Comment #40
jeroen.b commentedComment #45
jeroen.b commented@miro_dietiker, seems like the dependency is working now?
Comment #46
miro_dietikerCool! Now time to fix and improve.
Comment #47
LKS90 commentedLocally the tests pass, and the revisions are correctly shown. Only one slight issue which might not be related to paragraphs: Under the revisions tab the operations look rather strange, some radio buttons are there which mess up the whole formatting, plus some empty padding between the two operations columns. I don't know where the revisions page is built. A screenshot of the weird formatting on /node/{ID}/revisions.
Comment #50
LKS90 commentedRebased the patch #23.
Comment #51
LKS90 commentedComment #53
LKS90 commentedWhat are you doing, testbot?
Comment #56
LKS90 commentedReproduced the issue on simplytest.me:
Probably a missing dependency. Here is a patch to try out.
Comment #58
miro_dietikerIf you look into the dependencies of the testbot run, you can see it has:
diff, entity_reference_revisions, paragraphs
Comment #59
LKS90 commentedThanks to miro_dietiker we found the cause for the test fails: Missing capitalisation of one folder name (diff -> DIff). Now the plugin should be found on the linux test bot as well.
Comment #60
berdirThere's still a case mismatch here (FIeld)
The use @var to document that, so that phpstorm actually understands it :)
The problem is that this is kind of paragraph specific or to be more specific, inline entity specific. So we should name the class and plugin in a way that makes that clear.. something like "Entity Reference Revisions Inline Diff" or so.
Or maybe we should actually just name it Paragraphs Diff or something since it's in this module, otherwise we'd need to move it to that?
Those shouldn't be needed anymore.
Unrelated change, let's remove all changes in this file.
Would it make sense to use the demo module for the test, and automatically configure it in there? The demo module would then create a paragraph node with revisions and the test could be very, very simple.
Comment #61
miro_dietikerThe demo module does much more than what is needed for setup for the diff test and i fear this makes things slow..?
Comment #62
berdirIt does much more, but it does so through the API. I'd expect that actually isn't much slower than the current test which has a lot of UI interaction.
Comment #63
LKS90 commentedHere is an updated version which uses the paragraphs_demo module. The other feedback should be implemented as well (file renaming, adding comment for @var, removing unrelated changes).
Comment #66
LKS90 commentedThe demo is committed now, here is a rebased version of the patch.
Comment #68
LKS90 commentedI'll set it on postponed for now, waiting for #2540556: Translated paragraphs is not displayed in the correct translation to be fixed before I expand the tests.
I can also open a follow up to expand the tests to cover translated paragraphs diffs in case someone wants to commit this patch.
Comment #69
jeroen.b commentedUnblocked because #2540556: Translated paragraphs is not displayed in the correct translation is fixed, so...
Comment #71
jeroen.b commentedThis patch does not work for me. When applied, the diff is empty. See attachment.
Comment #72
jeroen.b commentedHmm, I should probably configure it on admin/config/content/diff/fields first :) But that form currently doesn't save for me...
Comment #73
LKS90 commentedYep, diff needs a patch first. I can't change any options (with a blank install of d8 and diff). I created an issue #2601180: Field settings are not changed on saving and postpone this one (again... :D).
Comment #74
jeroen.b commented#2612158: Field type form doesn't save settings / #2601180: Field settings are not changed on saving are fixed, can we continue on this?
Comment #75
jeroen.b commentedComment #76
miro_dietikerEDIT: sorry, wrong issue ;-!
Comment #77
edurenye commentedRebased, did some cleanup and fixed a failing test.
I reviewed the work and the tests and seems enough covered for now.
Comment #81
edurenye commentedUps, I deleted to much.
Now should be fine.
Comment #82
miro_dietikerWould be great to have Diff support for Paragraphs in stable.
But i think we can make it into entity reference revisions, since there is no paragraphs specific code.
See also this discussion in diff module: #2649138: Recursive entity_reference diffs with inline_entity_form and entity_reference_revisions
I think we should check if entity is populated for safety (see recent inconsistency issues).
Hm, rewrite it on top of our composite test entity type?
Comment #83
miro_dietikerIn the generic diff issue i found a reference to a generic implementation:
https://github.com/vilepickle/diff/blob/entity-reference-revisions-suppo...
We should consider that and figure out what is the best mix. :-)
Comment #84
miro_dietikerDiscussed, decided. Will be provided by ERR. :-)
Comment #85
johnchqueShouldn't have too many changes.
Comment #86
johnchqueAdded a working version for testing, tested manually but still need to write tests.
Comment #87
johnchqueComment #88
johnchqueScreenshot about a manual test.

Comment #89
miro_dietikerYeah that's possibly the best thing we can do.
To annotate references with structure (resolved reference fields as [sub-]labels) we would need a total replacement of the NodeRevisionController and more because the field handlers can only return change lines and it is impossible to attach structure. That's much unfortunate for complex composite relationships and references. Field label less diffs can easily be confusing. Unsure where to create the issues to cover this.
Created followup in diff module #2711595: Allow diff providers to attach sub-labels
And eagerly waiting for tests. ;-)
Comment #90
johnchqueAdded tests. :)
Comment #92
johnchqueSorry it seems we need to add the test dependencies. Also improved the code a bit, fixed comments.
Comment #94
johnchqueThis should go first right? :)
Comment #95
johnchqueAnd the patch without the dependency.
Comment #98
miro_dietikerCommitted the test dependency.
Comment #99
miro_dietikerYeah nice and committed.
I still think diff does something wrong here. If we provide a diff builder for our own field, it should be selected out of the box.
Please create a diff followup for this.
Comment #102
johnchqueFollowup will be covered here; #2708601: Allow per-field diff configuration