mirror of
https://github.com/tiennm99/coolify.git
synced 2026-05-03 14:21:11 +00:00
fix(user): complete User model fixes for non-web contexts
- Fix currentTeam() to return null instead of crashing when no session - Fix role() to use $this->currentTeam() instead of global helper - Add roleInTeam() method for explicit team context - Remove unused otherTeams() method - Fix InviteLink authorization bypass when role() returns null - Fix confirmEmailChange() null safety for currentTeam() - Fix ActivityMonitor to handle null currentTeam with fallback chain 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,8 +79,10 @@ class ActivityMonitor extends Component
|
||||
$causer_id = data_get($this->activity, 'causer_id');
|
||||
$user = User::find($causer_id);
|
||||
if ($user) {
|
||||
$teamId = $user->currentTeam()->id;
|
||||
if (! self::$eventDispatched) {
|
||||
$teamId = data_get($this->activity, 'properties.team_id')
|
||||
?? $user->currentTeam()?->id
|
||||
?? $user->teams->first()?->id;
|
||||
if ($teamId && ! self::$eventDispatched) {
|
||||
if (filled($this->eventData)) {
|
||||
$this->eventToDispatch::dispatch($teamId, $this->eventData);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user