Skip to content

Commit

Permalink
Merge pull request #8 from theriddleofenigma/notify_user_id
Browse files Browse the repository at this point in the history
Bug fix - Empty user tags are being displayed in logs when no user notification is configured.
  • Loading branch information
theriddleofenigma authored Feb 25, 2022
2 parents cb393b8 + 7689b72 commit 07fed8a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/GoogleChatHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ protected function getNotifiableText($level): string
Logger::DEBUG => config('logging.channels.google-chat.notify_users.debug'),
][$level] ?? '';

$levelBasedUserIds = trim($levelBasedUserIds);
if (($userIds = config('logging.channels.google-chat.notify_users.default')) && $levelBasedUserIds) {
$levelBasedUserIds = ",$levelBasedUserIds";
}

return $this->constructNotifiableText($userIds . $levelBasedUserIds);
return $this->constructNotifiableText(trim($userIds) . $levelBasedUserIds);
}

/**
Expand All @@ -120,7 +121,6 @@ protected function getNotifiableText($level): string
*/
protected function constructNotifiableText($userIds): string
{
$userIds = explode(',', $userIds);
if (!$userIds) {
return '';
}
Expand All @@ -133,7 +133,9 @@ protected function constructNotifiableText($userIds): string
}

return "<users/$userId> ";
}, array_unique($userIds)));
}, array_unique(
explode(',', $userIds))
));

return $allUsers . $otherIds;
}
Expand Down

0 comments on commit 07fed8a

Please sign in to comment.