isRenderedInCurrentRequest for ViewsBlockDisplay always return false.

A comment in this function:

There is no way to know if a block is embedded on a page, because blocks can be rendered in isolation (see big_pipe, esi, ...). To be sure we're not disclosing information we're not sure about, we always return false.

I think we can actually return a correct value by using BlockAccessControlHandler::checkAccess
I dont think any information disclosure is introduced, as this uses the same access checks as every other block.

Comments

StryKaizer created an issue. See original summary.

strykaizer’s picture

Status: Active » Needs review
StatusFileSize
new1.09 KB
borisson_’s picture

Issue tags: +dcnlights

I think we might have to look at writing a test for this? Functionally this works though, I sat next to @StryKaizer as he demonstrated it. I also already did my code style nitpicks before the patch was posted. So that's good as well.

In any case, I really like the simplicity here as well as the added functionality. Looks great!

@Thomas: If you think we don't need tests for this, I feel confident in setting this to RTBC. If you want tests, I'll try to have a look at that tomorrow at #dcnlights.

drunken monkey’s picture

Component: General code » Views integration
StatusFileSize
new914 bytes
new1.09 KB

Oh no, Joris, your nitpick-fu is getting weaker!
- Changed to use dependency injection.
- Broke overlong line across multiple lines.

Otherwise, though, this really looks great. Very simple implementation for something we thought we had "no way" of doing, adds nice functionality – very good.
What I'm worried a bit about, though, is performance. This will potentially load several additional entities on every page request where something (probably mostly facets, especially at this point) wants to know whether a block is displayed. Also, I think there is no caching involved? (Except on the entity load level, I guess – which would cover the most part, of course.) Or does at least the facet source do caching?

I've not checked whether this actually works correctly, but if you two are certain of it, that's good enough for me. Tests would be nice, of course, but I'd commit this without them, too. I'd just like to hear your opinion about the performance impact.

(Not sure which component is right here – "Views Integration" or "Plugins". Let's go with the former.)

strykaizer’s picture

Performancewise, if a block search api view exists which has facets (or search api sorts), then yes, this would introduce an entityload per block using the same search api display.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I don't think the performance hit here is big enough compared to the increase in functionality. I think we can just commit this.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

OK, good to hear!
Committed.
Thanks again, both of you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.