Closed (fixed)
Project:
Diff
Version:
8.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
2 Oct 2016 at 10:00 UTC
Updated:
28 Oct 2016 at 00:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dhendriks commentedComment #3
miro_dietikerIndeed, bug confirmed.
Checked also revision data and it is saved correct for sticky.
Comment #4
johnchqueI will check this.
Comment #5
johnchqueDebugging I see that the field sticky of the node doesn't have a view display configuration, so when trying to load the plugin for it, the code first checks if the field is added to the entity view, if not just skip it when diffing.
Comment #6
miro_dietikerHm, How many fields are filtered out by this approach?
It's possible i'm mixing things...
We also are checking field access to make sure there is no leak.
Just for my understanding: What would happen if we skip this View Mode check completely?
Users have the Visual diff where they can see output differences.
Say, this check might make sense for consideration of the default plugin.
But if a user configures a field plugin, it should be always considered, or not?
Comment #7
johnchqueIn DiffBuilderManager::getSelectedPluginForFieldDefinition this code filters the fields that are not in the view of the entity.
The elseif case checks that when is a BaseFieldDefinition it should get its view.
Removing this else if case fields like:
Revision timestamp
Revision user ID
Paragraphs > Nested Content > Language code
Paragraphs > Nested Content > Authored by
Paragraphs > Nested Content > Published
Paragraphs > Nested Content > Authored on
Paragraphs > Nested Content > Revision user ID
Paragraphs > Nested Content > Default translation
and others are not filtered.
If an user configures a field plugin it should be considered as long as the field is part of the entity view IMHO.
Comment #8
dhendriks commentedI have no idea about the terminology like field plugin and entity view. From my point of view, if someone else changes a node, I want to be able see what he/she changed. If that is the sticky flag, then that is what I want to see. If the node's 'published' status has changed, I want to see that. And so on. I simply want to know what changed. So if all of that is filtered out now, in my opinion it shouldn't be filtered out. This is from a user's perspective, rather than a technical perspective.
Comment #9
miro_dietikerAgree about functionality. Your argument works for fields like this "sticky". It doesn't work though for "changed" field that changes always and should not be displayed...
The Drupal API doesn't allow us to make a difference between fields with user awareness or not.
Anyway, let's ignore the default setting topic for a second.
There is the admin diff field settings. If i configure a diff plugin, it should be output in the diff. No matter if this is displayed or not. The unified fields are more a technical view for field change. If you want to see visual changes, you use the visual field diff. This considers view mode display. If it is not enough to see, i switch to the field diff...
How about if we consider using the default form mode for default selection? If a field appears in the form, we propose a diff plugin as default.
Comment #10
miro_dietikerI want to iron this out for the release.
Diff doesn't do its job if a field change like this can't be visualised.
Comment #11
miro_dietikerLike discussed, we want to test...
- If is better to look at form mode
- If unwanted things appear if we drop the view mode check completely
We might need hardcoded exclusion for the revision uid and changed field as they don't make sense to diff.
Comment #12
johnchqueWhen changing to check the view instead of the form, the sticky is displayed and no other useless fields are filling the diff with useless info.
I also tested with Paragraphs and realized that the fields we had problems before are also problematic due they have are form configurable, if we remove that the diff will work flawlessly IMHO:
I will support this concept with the idea of "What you edit, what you diff".
Comment #13
johnchqueWhen removing the view check, some fields that this timestamp are shown. Not really sure about this approach.

Comment #16
dhendriks commentedWhat are the 'some fields'? Only the revision timestamp? If so, you could filter that out hard-coded, as it could be seen as a special case (more about the revision than the node).
Comment #17
miro_dietikerIndeed, revision timestamp and revision author are special fields. They exist per revision, but are technical no "content" that is revised.
They need to be manually excluded/filtered from comparision.
In fact, if you check node_revision table, it's all of them: nid, vid, revision_timestamp, revision_uid, revision_log.
Discussed with Berdir and we both agree:
- If some setting is explicitly selected and stored, it needs to be considered. no fallback.
- But if there is no setting, we still should figure out a great default.
The content type field display visibility was always only intended to be considered for the fallback / default selection.
We believe looking up for the visibility in the default form display is an even better default setting proposal.
Comment #18
johnchqueChanged to use the entity form display, and when settings are set it just skip all the form display verification. Having problems with Base Fields due when loading the displayOptions('form') it is always present even the field is hidden. Not sure how to change that.
Comment #20
johnchqueFixing some tests, discussed with @Berdir, we gonna remove that diff view mode and then fix remaining tests.
Comment #21
johnchquePatch was missing, now all test should pass.
Comment #22
miro_dietikerChanges on "Revision log message"?
That field, and the revision author, need to be excluded hardcoded from the diff fields. It's metadata about a specific revision, nothing to compare.
Will check rest in more detail later.
Comment #23
johnchqueAdded some small changes to exclude revision log and revision author from the diff / summary, by now hard coding the field names, added a @todo for following the related issue.
Comment #24
miro_dietikerYeah, lots of things read nice. Still more to deal with:
The FieldDefinitionInterface would have a getTargetEntityTypeId() and getTargetBundle().
So it seems to me you don't need to change the interface as we don't need $entity at all?
Hm,i guess i got it wrong. I thought you want to remove that setting completely in #20? Is this part of some other issue?
Comment #25
johnchqueAbout #24.1, of the previous comment I think is not possible because the base fields don't have a target Bundle. That's why when discussing with @Berdir we realized that might be better to get the entity for checking the display.
#24.2 is a setting that will be removed in another issue.
Comment #26
miro_dietikerI still feel this is a strange API definition: Getting a plugin for field definition doesn't need an entity instance.
Instead if the field definition isn't enough.. shouldn't we pass in the entity type ID and the bundle..?
What do you think?
Comment #27
johnchqueThis should be better. Discussed with @Berdir, it might be OK to use the bundle in there, but just to be sure was set as optional.
Comment #28
berdirYes, berdir said to use the *bundle*.
You still use the entity. only pass in a bundle string.
Comment #29
johnchque:/ sorry, my bad. Now should be better.
Comment #31
miro_dietikerWonderful, committed. :-)