An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(user): improve cache key and remove redundant route check
Andras Bacsaiddd78658e8c6
diff --git a/app/Http/Middleware/DecideWhatToDoWithUser.php b/app/Http/Middleware/DecideWhatToDoWithUser.phpindex b62e874cc8..dea9f6a9d9 100644--- a/app/Http/Middleware/DecideWhatToDoWithUser.php+++ b/app/Http/Middleware/DecideWhatToDoWithUser.php@@ -27,7 +27,7 @@ class DecideWhatToDoWithUserreturn $next($request);}// Instance admins can access settings and admin routes regardless of subscription- if (isInstanceAdmin() && ($request->routeIs('settings.*') || $request->routeIs('settings.index') || $request->path() === 'admin')) {+ if (isInstanceAdmin() && ($request->routeIs('settings.*') || $request->path() === 'admin')) {return $next($request);}if (! auth()->user()->hasVerifiedEmail()) {diff --git a/app/Models/User.php b/app/Models/User.phpindex d64835c42f..560f21d0f0 100644--- a/app/Models/User.php+++ b/app/Models/User.php@@ -319,7 +319,7 @@ class User extends Authenticatable implements SendsEmailreturn null;}- return Cache::remember('team:'.$this->id, 3600, function () use ($sessionTeamId) {+ return Cache::remember('user:'.$this->id.':team:'.$sessionTeamId, 3600, function () use ($sessionTeamId) {return Team::find($sessionTeamId);});}diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex f9645fd9f9..d6b5739654 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -182,8 +182,11 @@ function refreshSession(?Team $team = null): void$team = User::find(Auth::id())->teams->first();}}+ // Clear old cache key format for backwards compatibilityCache::forget('team:'.Auth::id());- Cache::remember('team:'.Auth::id(), 3600, function () use ($team) {+ // Use new cache key format that includes team ID+ Cache::forget('user:'.Auth::id().':team:'.$team->id);+ Cache::remember('user:'.Auth::id().':team:'.$team->id, 3600, function () use ($team) {return $team;});session(['currentTeam' => $team]);