Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make BeforeTemplateRenderedEvent aware of the actual response #23012

Merged
merged 2 commits into from Sep 28, 2020

Conversation

juliushaertl
Copy link
Member

With this listeners can make there rendering dependent on the actual TemplateResponse. As an example the user_status app can only register the menu if a template with the user base template is returned.

Not sure if backporting to 20 would still be fine, though it might be nice to save some additional processing time on requests that use a blank template response like Collabora/ONLYOFFICE.

As a separate note, the user_status script has a special performance impact due to the emoji picker being loaded immediately, which is quite expensive, so this would be something where we also can improve the loading time for the user template, but I'd tackle that in a separate PR once i found a good solution.

image

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@rullzer rullzer force-pushed the enh/template-reponse-renderas branch from 56307a9 to 8ab2422 Compare September 24, 2020 18:00
@@ -61,7 +62,7 @@ public function handle(Event $event): void {
return;
}

if (!$event->isLoggedIn()) {
if (!$event->isLoggedIn() || $event->getResponse()->getRenderAs() !== TemplateResponse::RENDER_AS_USER) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue I see here is that there will be a lot of places where we will never do this check.
But yeah I don't see any other solutiopn either as an extra event will also just have this loaded on each page.

@rullzer rullzer merged commit 3cf46e6 into master Sep 28, 2020
@rullzer rullzer deleted the enh/template-reponse-renderas branch September 28, 2020 14:03
@rullzer
Copy link
Member

rullzer commented Sep 28, 2020

Backport?

@juliushaertl
Copy link
Member Author

/backport to stable20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants