[aur-dev] [PATCH] Drop the message when no changes were made to an account
When no changes has been made to the account there's no need for a message, and it is no longer applicable since the setting of SSH keys is done in a separate function now. Reported-by: Alexis Chotard <alexis.horgix.chotard@gmail.com> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- web/lib/acctfuncs.inc.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 417ee6d..be5d0e2 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -350,10 +350,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$P="",$C="", account_set_ssh_keys($UID, $ssh_keys, $ssh_fingerprints); - if (!$result) { - print __("No changes were made to the account, %s%s%s.", - "<strong>", htmlspecialchars($U,ENT_QUOTES), "</strong>"); - } else { + if ($result) { print __("The account, %s%s%s, has been successfully modified.", "<strong>", htmlspecialchars($U,ENT_QUOTES), "</strong>"); } -- 2.4.4
On Sat, 27 Jun 2015 at 16:26:07, Johannes Löthberg wrote:
When no changes has been made to the account there's no need for a message, and it is no longer applicable since the setting of SSH keys is done in a separate function now.
Reported-by: Alexis Chotard <alexis.horgix.chotard@gmail.com> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- web/lib/acctfuncs.inc.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) [...]
Applied, thanks!
On Sat, 27 Jun 2015 at 16:54:04, Lukas Fleischer wrote:
On Sat, 27 Jun 2015 at 16:26:07, Johannes Löthberg wrote:
When no changes has been made to the account there's no need for a message, and it is no longer applicable since the setting of SSH keys is done in a separate function now.
Reported-by: Alexis Chotard <alexis.horgix.chotard@gmail.com> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- web/lib/acctfuncs.inc.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) [...]
Applied, thanks!
Just noticed that this doesn't seem to work. PDO::exec() returns false if an error occurs and the number of modified rows otherwise. So this results in an empty page (with just a heading) when no changes are made. Maybe we should just replace "!$result" with "$result === false" instead? Regards, Lukas
This commit changes the messages printed when changing the accound details so that it only prints that no changes were made if either the account change SQL query or the account_set_ssh_keys call failed. Reported-by: Alexis Chotard <alexis.horgix.chotard@gmail.com> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- This should work properly. (And hopefully Lukas won't be mad at me for being so slow-minded today.) web/lib/acctfuncs.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 417ee6d..861de0a 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -348,9 +348,9 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$P="",$C="", $q.= " WHERE ID = ".intval($UID); $result = $dbh->exec($q); - account_set_ssh_keys($UID, $ssh_keys, $ssh_fingerprints); + $ssh_key_result = account_set_ssh_keys($UID, $ssh_keys, $ssh_fingerprints); - if (!$result) { + if ($result === false || $ssh_key_result === false) { print __("No changes were made to the account, %s%s%s.", "<strong>", htmlspecialchars($U,ENT_QUOTES), "</strong>"); } else { -- 2.4.4
On Sat, 27 Jun 2015 at 17:48:39, Johannes Löthberg wrote:
This commit changes the messages printed when changing the accound details so that it only prints that no changes were made if either the account change SQL query or the account_set_ssh_keys call failed.
Reported-by: Alexis Chotard <alexis.horgix.chotard@gmail.com> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- This should work properly. (And hopefully Lukas won't be mad at me for being so slow-minded today.) [...]
Not at all! Thanks for all your work on aurweb! I replaced the previous patch on pu with this one.
participants (2)
-
Johannes Löthberg
-
Lukas Fleischer