@@ -46,14 +46,9 @@ public function resolveReviewersAsRecipients(): array {
46
46
* @return EmailReviewer[]
47
47
*/
48
48
public function resolveReviewers (bool $ revisionChangedToNeedReview ): array {
49
- $ rawReviewers = $ this ->rawRevision -> getReviewers ();
49
+ $ rawReviewers = $ this ->resolveUnresignedReviewers ();
50
50
$ reviewers = [];
51
51
foreach ($ rawReviewers as $ reviewerPHID => $ rawReviewer ) {
52
- if ($ rawReviewer ->isResigned ()) {
53
- // In the future, we could show resigned reviewers in the email body
54
- continue ;
55
- }
56
-
57
52
$ allReviewerStatuses = array_map (function ($ reviewer ) {
58
53
return $ reviewer ->getReviewerStatus ();
59
54
}, $ rawReviewers );
@@ -64,18 +59,22 @@ public function resolveReviewers(bool $revisionChangedToNeedReview): array {
64
59
$ reviewers [] = new EmailReviewer ($ reviewer ->name (), $ isActionable , $ status , $ reviewer ->toRecipients ($ this ->actorEmail ));
65
60
}
66
61
return $ reviewers ;
67
-
68
62
}
69
63
70
64
/**
71
65
* @return EmailRecipient[]
72
66
*/
73
67
public function resolveSubscribersAsRecipients (): array {
74
68
$ recipientPHIDs = PhabricatorSubscribersQuery::loadSubscribersForPHID ($ this ->rawRevision ->getPHID ());
75
-
76
69
$ recipientUsers = array_map (fn (string $ phid ) => $ this ->userStore ->findAllBySubscribersById ($ phid ), $ recipientPHIDs );
77
70
$ recipientUsers = array_merge (...$ recipientUsers ); // Flatten array of arrays
78
71
$ recipients = array_map (fn (PhabricatorUser $ user ) => EmailRecipient::from ($ user , $ this ->actorEmail ), $ recipientUsers );
72
+
73
+ foreach (array_keys ($ this ->resolveUnresignedReviewers ()) as $ reviewerPHID ) {
74
+ $ reviewer = $ this ->userStore ->findReviewerByPHID ($ reviewerPHID );
75
+ $ recipients = array_merge ($ recipients , $ reviewer ->getWatchersAsRecipients ($ this ->actorEmail ));
76
+ }
77
+
79
78
return array_values (array_filter ($ recipients ));
80
79
}
81
80
@@ -95,4 +94,15 @@ public function resolveAllPossibleRecipients(): array
95
94
96
95
return array_merge ($ subscribers , $ reviewers , $ authorList );
97
96
}
98
- }
97
+
98
+ /**
99
+ * @return Phabricatoruser[]
100
+ */
101
+ private function resolveUnresignedReviewers (): array {
102
+ $ reviewers = $ this ->rawRevision ->getReviewers ();
103
+ return array_filter ($ reviewers , function ($ rawReviewer ) {
104
+ // In the future, we could show resigned reviewers in the email body
105
+ return !$ rawReviewer ->isResigned ();
106
+ });
107
+ }
108
+ }
0 commit comments