Problem/Motivation
history_node_view_alter() tracks the viewing history for all nodes that are viewed in the full view mode.
That means also previews of unsaved nodes are tracked.
Proposed resolution
Return early if $node->isNew() or if isset($node->in_preview).
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 3122056-14.patch | 2.92 KB | wim leers |
| #15 | 3122056-13-tests-only.patch | 2.24 KB | wim leers |
| #14 | 3122056-14.patch | 3.14 KB | wim leers |
| #14 | interdiff-2.txt | 3.05 KB | wim leers |
| #14 | interdiff.txt | 602 bytes | wim leers |
Comments
Comment #2
wim leers.
Comment #3
geek-merlinThe patch is trivial and makes sense. Did not test it though.
Comment #4
geek-merlinUps.
Comment #6
kristen polThanks for the patch.
1) Patch applies cleanly to 9.1.x.
2) Code is fine and addresses problem noted in the issue summary.
3) Started automated tests on 9.1.x since they were previously run against 8.9.x. This is RTBC IMO if these pass which is expected.
4) Manually tested with and without the patch as follows:
Node being previewed shows as "Updated" because of bug
After patch:
None of the nodes show as "Updated" because of fix
?destination=/parameter so that it won't load the node view page after editing and then look at the views listingSave contentaction, and then look at the views listingNote: I didn't upload screenshots for all the variations. Also, IMO this is a bug so reclassifying.
Comment #7
kristen polRTBC per #6 now that tests have passed.
Comment #8
alexpottThanks for filing this bug report and for fixing the issue. Bug fixing is very valuable. In order to commit a bug fix, we need an automated to test to prove that we've fixed the bug and ensure that we don't break it again in the future. For more information about writing tests in Drupal 8 see the following links:
Comment #10
mohit_aghera commentedAdding a WIP patch with test cases to get inputs from other contributors related to blocker
Comment #13
wim leersNit:
{@inheritdoc}Interesting … I would not have used a view to test this. I'd just have checked this using
history_read().We definitely do not need
views_ui.Oh I see … this is testing the views preview, not the node preview.
Hm, yeah, this is unfortunately not actually testing what we need to test. Let's fix that.
Comment #14
wim leers… and in doing so, I found a bug in #2, or rather, an unhandled edge case. 🤓
The interdiff is relative to my patch in #2 since I was unable to reuse anything in #10 unfortunately. On the bright side, I was able to just expand the pre-existing test coverage :)
Note that
interdiff-2.txtshows the full interdiff,interdiff.txtshows only the functional changes (no test coverage).Comment #15
wim leers😬 The fact that this did not run any tests at all is infuriating.
Hacked the patch files by hand. 🤞
Comment #17
phenaproximaMakes sense to me. My only nitpick, and it is a nitpick, is that we should probably use
\Drupal::database()->select()in the test, rather than->query().But that's non-blocking feedback; marking RTBC anyway.
Comment #27
catchThe ->query() in the test is fine - as long as it's a proper static query it's still OK to use.
Committed/pushed to 9.3.x and cherry-picked to 9.2.x, thanks!