From 7d4357683a313f4ec96d2f2546128d4af7b2fb47 Mon Sep 17 00:00:00 2001 From: Matthew Bowker Date: Wed, 30 Mar 2022 09:16:52 -0600 Subject: [PATCH] Hide the blurb of a user when that user is disabled Summary: T15074 Test Plan: Disabled a user, then made sure their blurb disappeared. Reviewers: O1 Blessed Committers, avivey, speck Reviewed By: O1 Blessed Committers, avivey, speck Subscribers: 20after4, avivey, speck, tobiaswiese, valerio.bozzolan Maniphest Tasks: T15074 Differential Revision: https://we.phorge.it/D25035 --- .../people/storage/PhabricatorUser.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index fa6dc08e9f..1560f9f65e 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -320,12 +320,28 @@ final class PhabricatorUser const EMAIL_CYCLE_FREQUENCY = 86400; const EMAIL_TOKEN_LENGTH = 24; + /** + * This function removes the blurb from a profile. + * This is an incredibly broad hammer to handle some spam on the upstream, + * which will be refined later. + * + * @return void + */ + private function cleanUpProfile() { + $this->profile->setBlurb(''); + } + public function getUserProfile() { return $this->assertAttached($this->profile); } public function attachUserProfile(PhabricatorUserProfile $profile) { $this->profile = $profile; + + if ($this->isDisabled) { + $this->cleanUpProfile(); + } + return $this; } @@ -342,6 +358,10 @@ final class PhabricatorUser $this->profile = PhabricatorUserProfile::initializeNewProfile($this); } + if ($this->isDisabled) { + $this->cleanUpProfile(); + } + return $this->profile; }