From 1f41eb1e550430a9cf11c8d9a7464c137244c0e5 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 23 Apr 2025 22:56:37 -0500 Subject: [PATCH] Don't remind editors about stalled or abandoned projects --- lib/Benefits.php | 13 +++++++++++++ lib/Project.php | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/Benefits.php b/lib/Benefits.php index 8d6f26b6..d0a78bad 100644 --- a/lib/Benefits.php +++ b/lib/Benefits.php @@ -2,6 +2,7 @@ /** * @property-read bool $HasBenefits Are any of the benefits in this object **`TRUE`**? * @property-read bool $RequiresPassword Do any of the benefits in this object require the `User` to have a password set? + * @property-read bool $IsEditor Can this `User` manage or review projects? */ class Benefits{ use Traits\Accessor; @@ -55,6 +56,18 @@ class Benefits{ return false; } + protected function GetIsEditor(): bool{ + if( + $this->CanManageProjects + || + $this->CanReviewProjects + ){ + return true; + } + + return false; + } + protected function GetHasBenefits(): bool{ if(!isset($this->_HasBenefits)){ $this->_HasBenefits = false; diff --git a/lib/Project.php b/lib/Project.php index c8f1ed84..6f9ca9c9 100644 --- a/lib/Project.php +++ b/lib/Project.php @@ -712,13 +712,23 @@ final class Project{ } /** - * Send an email reminder to the producer notifying them about their project status. + * Send an email reminder to the producer notifying them about their project status, but only if they're not an editor. */ public function SendReminder(Enums\ProjectReminderType $type): void{ if($this->ProducerEmail === null || $this->GetReminder($type) !== null){ return; } + try{ + $user = User::GetByEmail($this->ProducerEmail); + if($user->Benefits->IsEditor){ + return; + } + } + catch(Exceptions\UserNotFoundException){ + // Pass. + } + $reminder = new ProjectReminder(); $reminder->ProjectId = $this->ProjectId; $reminder->Type = $type;