Skip to content

Commit

Permalink
Clean up some external-groups log message formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
forevermatt committed Sep 4, 2024
1 parent aa20567 commit cbc532f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions application/common/components/ExternalGroupsSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public static function syncAllSets(array $syncSetsParams)
));
} else {
Yii::warning(sprintf(
'Syncing %s external groups from Google Sheet (%s)...',
json_encode($appPrefix),
"Syncing '%s' external groups from Google Sheet (%s)...",
$appPrefix,
$googleSheetId
));
self::syncSet($appPrefix, $googleSheetId);
Expand All @@ -51,7 +51,7 @@ private static function syncSet(string $appPrefix, string $googleSheetId)
$desiredExternalGroups = self::getExternalGroupsFromGoogleSheet($googleSheetId);
$errors = User::syncExternalGroups($appPrefix, $desiredExternalGroups);
Yii::warning(sprintf(
'Ran sync for %s external groups.',
"Ran sync for '%s' external groups.",
$appPrefix
));

Expand Down
10 changes: 5 additions & 5 deletions application/common/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,9 @@ public static function syncExternalGroups(string $appPrefix, array $desiredExter
$successful = $user->updateExternalGroups($appPrefix, $groupsForPrefix);
if (! $successful) {
$errors[] = sprintf(
"Failed to update external groups for %s: \n%s",
'Failed to update external groups for %s: %s',
$email,
json_encode($user->getFirstErrors(), JSON_PRETTY_PRINT)
join(' / ', $user->getFirstErrors())
);
}
}
Expand All @@ -1082,9 +1082,9 @@ public function updateExternalGroups(string $appPrefix, string $csvAppExternalGr
if (! str_starts_with($appExternalGroup, $appPrefix . '-')) {
$this->addErrors([
'groups_external' => sprintf(
'The given group %s does not start with the given prefix (%s)',
json_encode($appExternalGroup),
json_encode($appPrefix)
'The given group (%s) does not start with the given prefix (%s)',
$appExternalGroup,
$appPrefix
),
]);
return false;
Expand Down

0 comments on commit cbc532f

Please sign in to comment.