From 478012cd463d06040ae93497c94fb5fadfc76308 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Thu, 15 Jun 2023 21:22:10 +0200 Subject: [PATCH] Add serious business string for defrocking a user (remove admin rights) Summary: Allow humans to understand what happened when `phabricator.serious-business` mode is enabled: The administrator role was removed from a user account. Closes T15480 Test Plan: Enable `phabricator.serious-business` mode. Enable and disable an account as admin. Check that account's feed and the general feed. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15480 Differential Revision: https://we.phorge.it/D25298 --- .../PhabricatorUserEmpowerTransaction.php | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/applications/people/xaction/PhabricatorUserEmpowerTransaction.php b/src/applications/people/xaction/PhabricatorUserEmpowerTransaction.php index d17418636f..3f3440ede0 100644 --- a/src/applications/people/xaction/PhabricatorUserEmpowerTransaction.php +++ b/src/applications/people/xaction/PhabricatorUserEmpowerTransaction.php @@ -56,9 +56,15 @@ final class PhabricatorUserEmpowerTransaction '%s empowered this user as an administrator.', $this->renderAuthor()); } else { - return pht( - '%s defrocked this user.', - $this->renderAuthor()); + if (PhabricatorEnv::getEnvConfig('phabricator.serious-business')) { + return pht( + '%s removed the administrator role from this user.', + $this->renderAuthor()); + } else { + return pht( + '%s defrocked this user.', + $this->renderAuthor()); + } } } @@ -70,10 +76,17 @@ final class PhabricatorUserEmpowerTransaction $this->renderAuthor(), $this->renderObject()); } else { - return pht( - '%s defrocked %s.', - $this->renderAuthor(), - $this->renderObject()); + if (PhabricatorEnv::getEnvConfig('phabricator.serious-business')) { + return pht( + '%s removed the administrator role from %s.', + $this->renderAuthor(), + $this->renderObject()); + } else { + return pht( + '%s defrocked %s.', + $this->renderAuthor(), + $this->renderObject()); + } } }