- First commit to issue fork.
- Merge request !15Issue #3193717: Write the visit in Kernel TERMINATE event → (Open) created by admirlju
This was more work than expected. Since the patch fails to apply I coded it by hand. The thing is this patch worked only for entity types of Node, while the module is supposed to support any entity type, also implemented it using dependency injection. Fixed the tests and added doc comments.
There is also a similar fix in 📌 Disabled page caching Needs review but using a different event. That one adds content to a recently read table on KernelEvent::REQUEST, so they are added before the page is loaded to the client, I go a bit into details in comment #11.
- Status changed to Needs work
almost 2 years ago 1:59pm 8 September 2023 Okay, so it looks like this will not work for anonymous users, at least not after the first session is created in
recently_read_entity_view()
. This happens becausehook_entity_view()
runs only when the view is not cached. So this will have to be moved somewhere else.- Status changed to Needs review
almost 2 years ago 7:32am 11 September 2023 I moved the anonymous session check to an event subscriber, that runs on KernelEvents::REQUEST on priority 27. This way the session check for anonymous users gets done even if the page is already cached.
- First commit to issue fork.
- 🇸🇮Slovenia jernejmramor
Hello,
I've taken a look into this issue and rebased latest dev into it and fixed failing tests. So this is now ready to be re reviewed.
However please note that this issue changes how the module works so I would recommend creating a new major release for it.
In previous versions of this module and current dev branch, tracked entities are logged immediately when user navigates to a page where an entity needs to be tracked that will be done immediately and the block that comes with the module will display entity which we are currently on.In this issue this behavior changes. When user navigates to an entity which should get tracked then this entity won't appear in the recently read block as we are still currently viewing it. It will appear correctly after navigating to a different page.
For example:
Current dev: User navigates to /node/1. Block already displays /node/1 in recently read block.
This issue: User navigates to /node/1. Block doesn't display /node/1 as read. User navigates to somewhere else where the block is still visible. /node/1 is now displayed in the block.I would prefer the module to work like it does in this issue, as it only display which entities we read after we navigated away from instead, of having entity tracked immediately.
Leaving this in needs review as some changes were made since this was last worked on.