mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 21:10:56 +01:00
This might make emails work better.
Summary: Test Plan: Reviewers: CC:
This commit is contained in:
parent
7aa95fd112
commit
e3a91902b7
6 changed files with 38 additions and 27 deletions
|
@ -280,9 +280,14 @@ class DifferentialCommentEditor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phids = array($this->actorPHID);
|
||||||
|
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||||
|
->loadHandles();
|
||||||
|
$actor_handle = $handles[$this->actorPHID];
|
||||||
|
|
||||||
id(new DifferentialCommentMail(
|
id(new DifferentialCommentMail(
|
||||||
$revision,
|
$revision,
|
||||||
$this->actorPHID,
|
$actor_handle,
|
||||||
$comment,
|
$comment,
|
||||||
/* $changesets TODO */ array(),
|
/* $changesets TODO */ array(),
|
||||||
/* $inline_comments TODO */ array()))
|
/* $inline_comments TODO */ array()))
|
||||||
|
|
|
@ -418,10 +418,16 @@ class DifferentialRevisionEditor {
|
||||||
|
|
||||||
$revision->loadRelationships();
|
$revision->loadRelationships();
|
||||||
|
|
||||||
|
$phids = array($this->getActorPHID());
|
||||||
|
|
||||||
|
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||||
|
->loadHandles();
|
||||||
|
$actor_handle = $handles[$this->getActorPHID()];
|
||||||
|
|
||||||
if ($add['rev']) {
|
if ($add['rev']) {
|
||||||
$message = id(new DifferentialNewDiffMail(
|
$message = id(new DifferentialNewDiffMail(
|
||||||
$revision,
|
$revision,
|
||||||
$this->getActorPHID(),
|
$actor_handle,
|
||||||
$changesets))
|
$changesets))
|
||||||
->setIsFirstMailAboutRevision($is_new)
|
->setIsFirstMailAboutRevision($is_new)
|
||||||
->setIsFirstMailToRecipients(true)
|
->setIsFirstMailToRecipients(true)
|
||||||
|
@ -449,7 +455,7 @@ class DifferentialRevisionEditor {
|
||||||
if (!$is_new && $add['ccs']) {
|
if (!$is_new && $add['ccs']) {
|
||||||
$mail[] = id(new DifferentialCCWelcomeMail(
|
$mail[] = id(new DifferentialCCWelcomeMail(
|
||||||
$revision,
|
$revision,
|
||||||
$this->getActorPHID(),
|
$actor_handle,
|
||||||
$changesets))
|
$changesets))
|
||||||
->setIsFirstMailToRecipients(true)
|
->setIsFirstMailToRecipients(true)
|
||||||
->setToPHIDs(array_keys($add['ccs']));
|
->setToPHIDs(array_keys($add['ccs']));
|
||||||
|
|
|
@ -11,6 +11,7 @@ phutil_require_module('phabricator', 'applications/differential/mail/ccwelcome')
|
||||||
phutil_require_module('phabricator', 'applications/differential/mail/newdiff');
|
phutil_require_module('phabricator', 'applications/differential/mail/newdiff');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
||||||
|
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||||
phutil_require_module('phabricator', 'storage/qsprintf');
|
phutil_require_module('phabricator', 'storage/qsprintf');
|
||||||
phutil_require_module('phabricator', 'storage/queryfx');
|
phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@ abstract class DifferentialMail {
|
||||||
protected $to = array();
|
protected $to = array();
|
||||||
protected $cc = array();
|
protected $cc = array();
|
||||||
|
|
||||||
protected $actorName;
|
protected $actorHandle;
|
||||||
protected $actorID;
|
|
||||||
|
|
||||||
protected $revision;
|
protected $revision;
|
||||||
protected $comment;
|
protected $comment;
|
||||||
|
@ -35,17 +34,25 @@ abstract class DifferentialMail {
|
||||||
protected $heraldTranscriptURI;
|
protected $heraldTranscriptURI;
|
||||||
protected $heraldRulesHeader;
|
protected $heraldRulesHeader;
|
||||||
|
|
||||||
public function getActorName() {
|
abstract protected function renderSubject();
|
||||||
return $this->actorName;
|
abstract protected function renderBody();
|
||||||
}
|
|
||||||
|
|
||||||
public function setActorName($actor_name) {
|
public function setActorHandle($actor_handle) {
|
||||||
$this->actorName = $actor_name;
|
$this->actorHandle = $actor_handle;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function renderSubject();
|
public function getActorHandle() {
|
||||||
abstract protected function renderBody();
|
return $this->actorHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getActorName() {
|
||||||
|
$handle = $this->getActorHandle();
|
||||||
|
if ($handle) {
|
||||||
|
return $handle->getName();
|
||||||
|
}
|
||||||
|
return '???';
|
||||||
|
}
|
||||||
|
|
||||||
public function setXHeraldRulesHeader($header) {
|
public function setXHeraldRulesHeader($header) {
|
||||||
$this->heraldRulesHeader = $header;
|
$this->heraldRulesHeader = $header;
|
||||||
|
@ -65,8 +72,9 @@ abstract class DifferentialMail {
|
||||||
$body = $this->buildBody();
|
$body = $this->buildBody();
|
||||||
|
|
||||||
$mail = new PhabricatorMetaMTAMail();
|
$mail = new PhabricatorMetaMTAMail();
|
||||||
if ($this->getActorID()) {
|
$handle = $this->getActorHandle();
|
||||||
$mail->setFrom($this->getActorID());
|
if ($handle) {
|
||||||
|
$mail->setFrom($handle->getPHID());
|
||||||
$mail->setReplyTo($this->getReplyHandlerEmailAddress());
|
$mail->setReplyTo($this->getReplyHandlerEmailAddress());
|
||||||
} else {
|
} else {
|
||||||
$mail->setFrom($this->getReplyHandlerEmailAddress());
|
$mail->setFrom($this->getReplyHandlerEmailAddress());
|
||||||
|
@ -190,15 +198,6 @@ EOTEXT;
|
||||||
return $this->cc;
|
return $this->cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setActorID($actor_id) {
|
|
||||||
$this->actorID = $actor_id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getActorID() {
|
|
||||||
return $this->actorID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setRevision($revision) {
|
public function setRevision($revision) {
|
||||||
$this->revision = $revision;
|
$this->revision = $revision;
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -31,13 +31,13 @@ class DifferentialCommentMail extends DifferentialMail {
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
DifferentialRevision $revision,
|
DifferentialRevision $revision,
|
||||||
$actor_id,
|
PhabricatorObjectHandle $actor,
|
||||||
DifferentialComment $comment,
|
DifferentialComment $comment,
|
||||||
array $changesets,
|
array $changesets,
|
||||||
array $inline_comments) {
|
array $inline_comments) {
|
||||||
|
|
||||||
$this->setRevision($revision);
|
$this->setRevision($revision);
|
||||||
$this->setActorID($actor_id);
|
$this->setActorHandle($actor);
|
||||||
$this->setComment($comment);
|
$this->setComment($comment);
|
||||||
$this->setChangesets($changesets);
|
$this->setChangesets($changesets);
|
||||||
$this->setInlineComments($inline_comments);
|
$this->setInlineComments($inline_comments);
|
||||||
|
|
|
@ -31,11 +31,11 @@ abstract class DifferentialReviewRequestMail extends DifferentialMail {
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
DifferentialRevision $revision,
|
DifferentialRevision $revision,
|
||||||
$actor_id,
|
PhabricatorObjectHandle $actor,
|
||||||
array $changesets) {
|
array $changesets) {
|
||||||
|
|
||||||
$this->setRevision($revision);
|
$this->setRevision($revision);
|
||||||
$this->setActorID($actor_id);
|
$this->setActorHandle($actor);
|
||||||
$this->setChangesets($changesets);
|
$this->setChangesets($changesets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue