OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Reload currentUser when turbo:load occurs
Oliver Günther144122456d20
diff --git a/frontend/src/app/core/current-user/current-user.module.ts b/frontend/src/app/core/current-user/current-user.module.tsindex 58a386ce2f2..0516cfa2e93 100644--- a/frontend/src/app/core/current-user/current-user.module.ts+++ b/frontend/src/app/core/current-user/current-user.module.ts@@ -6,6 +6,15 @@ import { CurrentUserQuery } from './current-user.query';import { ErrorReporterBase } from 'core-app/core/errors/error-reporter-base';import { firstValueFrom } from 'rxjs';+function loadUserMetadata(currentUserService:CurrentUserService) {+ const userMeta = document.querySelectorAll('meta[name=current_user]')[0] as HTMLElement|undefined;+ currentUserService.setUser({+ id: userMeta?.dataset.id || null,+ name: userMeta?.dataset.name || null,+ loggedIn: userMeta?.dataset.loggedIn === 'true',+ });+}+export function bootstrapModule(injector:Injector):void {const currentUserService = injector.get(CurrentUserService);@@ -15,12 +24,9 @@ export function bootstrapModule(injector:Injector):void {.then(({ id }) => ({ user: id || 'anon' })),);- const userMeta = document.querySelectorAll('meta[name=current_user]')[0] as HTMLElement|undefined;- currentUserService.setUser({- id: userMeta?.dataset.id || null,- name: userMeta?.dataset.name || null,- loggedIn: userMeta?.dataset.loggedIn === 'true',- });++ loadUserMetadata(currentUserService);+ document.addEventListener('turbo:load', () => loadUserMetadata(currentUserService));}@NgModule({