Skip to content

Commit 6894234

Browse files
committed
fix(editgroups): trim post entries + better messages
1 parent 8b91a0f commit 6894234

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

actions/EditGroupsAction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function run()
2525
$selectedGroupName = '';
2626
$action = '';
2727
$error_message = '';
28-
error_log(implode("\n", $_POST));
28+
error_log('$_POST content: ' . print_r($_POST ?? null, true));
2929

3030
if (empty($_POST)) {
3131
error_log('$_POST empty');
@@ -47,7 +47,7 @@ public function run()
4747
$type = 'success';
4848
$message = str_replace('{group}', $selectedGroupName, _t('GROUP_CREATED'));
4949
} elseif (!empty($_POST['action-update'])) {
50-
$members = $_POST['members'];
50+
$members = array_map('trim', $_POST['members']);
5151
$groupController->update($selectedGroupName, $members);
5252
$message = str_replace('{group}', $selectedGroupName, _t('GROUP_SAVED'));
5353
$type = 'success';
@@ -59,7 +59,7 @@ public function run()
5959
}
6060
} catch (Throwable $th) {
6161
$type = 'danger';
62-
$message = _t('ERROR_WHILE_EDITING_GROUP') . ':<br/>' . $th->getMessage();
62+
$message = _t('ERROR_WHILE_EDITING_GROUP') . '"' . $selectedGroupName . '" :<br/>' . $th->getMessage();
6363
}
6464
}
6565
}

includes/controllers/GroupController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ private function addOrUpdate(string $groupName, array $members, bool $add): void
252252
case 0:
253253
break;
254254
case 1:
255-
throw new UserNameDoesNotExistException(_t('USER_NAME_DOES_NOT_EXIST') . ' : ' . $member . ' ');
255+
throw new UserNameDoesNotExistException(_t('USER_NAME_DOES_NOT_EXIST') . ' : ' . $member);
256256
case 2:
257-
throw new GroupNameDoesNotExistException('included ' . _t('GROUP_NAME_DOES_NOT_EXIST'));
257+
throw new GroupNameDoesNotExistException('included "' . $member . '" ' . _t('GROUP_NAME_DOES_NOT_EXIST'));
258258
case 3:
259259
throw new InvalidInputException(_t('ERROR_RECURSIVE_GROUP'));
260260
}

lang/yeswiki_fr.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,13 +576,13 @@
576576
'REACTION_BAD_IMAGE_FORMAT' => 'Mauvais format d\'image : doit être un fichier, un icône utf8 ou une classe Fontawesome',
577577
'REACTION_NO_IMAGE' => 'Image manquante',
578578
'GROUP_NAME_ALREADY_USED' => 'le groupe existe déjà',
579-
'USER_NAME_DOES_NOT_EXIST' => 'l\'utlisateur n\'existe pas',
579+
'USER_NAME_DOES_NOT_EXIST' => 'l\'utilisateur n\'existe pas',
580580
'GROUP_NAME_DOES_NOT_EXIST' => 'le groupe n\'existe pas',
581581
'INVALID_GROUP_NAME' => 'le nom du groupe n\'est pas valide',
582582
'GROUP_SAVED' => 'groupe {group} mis à jour avec succès',
583583
'GROUP_CREATED' => 'groupe {group} créé avec succès',
584584
'GROUP_DELETED' => 'groupe {group} supprimé avec succès',
585-
'ERROR_WHILE_EDITING_GROUP' => 'error durant l\'action sur le groupe.',
585+
'ERROR_WHILE_EDITING_GROUP' => 'Erreur durant l\'action sur le groupe ',
586586
'TO_ANOTHER_YESWIKI' => 'dans un autre YesWiki',
587587
'WIKI_URL_RECENT' => 'Nécessite un YesWiki en version >= 4.5.0',
588588
'WIKI_URL' => 'Url du YesWiki',

0 commit comments

Comments
 (0)