1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 13:00:56 +01:00

This might make emails work better.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-09 09:58:48 -08:00
parent 7aa95fd112
commit e3a91902b7
6 changed files with 38 additions and 27 deletions

View file

@ -280,9 +280,14 @@ class DifferentialCommentEditor {
}
}
$phids = array($this->actorPHID);
$handles = id(new PhabricatorObjectHandleData($phids))
->loadHandles();
$actor_handle = $handles[$this->actorPHID];
id(new DifferentialCommentMail(
$revision,
$this->actorPHID,
$actor_handle,
$comment,
/* $changesets TODO */ array(),
/* $inline_comments TODO */ array()))

View file

@ -418,10 +418,16 @@ class DifferentialRevisionEditor {
$revision->loadRelationships();
$phids = array($this->getActorPHID());
$handles = id(new PhabricatorObjectHandleData($phids))
->loadHandles();
$actor_handle = $handles[$this->getActorPHID()];
if ($add['rev']) {
$message = id(new DifferentialNewDiffMail(
$revision,
$this->getActorPHID(),
$actor_handle,
$changesets))
->setIsFirstMailAboutRevision($is_new)
->setIsFirstMailToRecipients(true)
@ -449,7 +455,7 @@ class DifferentialRevisionEditor {
if (!$is_new && $add['ccs']) {
$mail[] = id(new DifferentialCCWelcomeMail(
$revision,
$this->getActorPHID(),
$actor_handle,
$changesets))
->setIsFirstMailToRecipients(true)
->setToPHIDs(array_keys($add['ccs']));

View file

@ -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/storage/comment');
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/queryfx');

View file

@ -23,8 +23,7 @@ abstract class DifferentialMail {
protected $to = array();
protected $cc = array();
protected $actorName;
protected $actorID;
protected $actorHandle;
protected $revision;
protected $comment;
@ -35,17 +34,25 @@ abstract class DifferentialMail {
protected $heraldTranscriptURI;
protected $heraldRulesHeader;
public function getActorName() {
return $this->actorName;
}
abstract protected function renderSubject();
abstract protected function renderBody();
public function setActorName($actor_name) {
$this->actorName = $actor_name;
public function setActorHandle($actor_handle) {
$this->actorHandle = $actor_handle;
return $this;
}
abstract protected function renderSubject();
abstract protected function renderBody();
public function getActorHandle() {
return $this->actorHandle;
}
protected function getActorName() {
$handle = $this->getActorHandle();
if ($handle) {
return $handle->getName();
}
return '???';
}
public function setXHeraldRulesHeader($header) {
$this->heraldRulesHeader = $header;
@ -65,8 +72,9 @@ abstract class DifferentialMail {
$body = $this->buildBody();
$mail = new PhabricatorMetaMTAMail();
if ($this->getActorID()) {
$mail->setFrom($this->getActorID());
$handle = $this->getActorHandle();
if ($handle) {
$mail->setFrom($handle->getPHID());
$mail->setReplyTo($this->getReplyHandlerEmailAddress());
} else {
$mail->setFrom($this->getReplyHandlerEmailAddress());
@ -190,15 +198,6 @@ EOTEXT;
return $this->cc;
}
public function setActorID($actor_id) {
$this->actorID = $actor_id;
return $this;
}
public function getActorID() {
return $this->actorID;
}
public function setRevision($revision) {
$this->revision = $revision;
return $this;

View file

@ -31,13 +31,13 @@ class DifferentialCommentMail extends DifferentialMail {
public function __construct(
DifferentialRevision $revision,
$actor_id,
PhabricatorObjectHandle $actor,
DifferentialComment $comment,
array $changesets,
array $inline_comments) {
$this->setRevision($revision);
$this->setActorID($actor_id);
$this->setActorHandle($actor);
$this->setComment($comment);
$this->setChangesets($changesets);
$this->setInlineComments($inline_comments);

View file

@ -31,11 +31,11 @@ abstract class DifferentialReviewRequestMail extends DifferentialMail {
public function __construct(
DifferentialRevision $revision,
$actor_id,
PhabricatorObjectHandle $actor,
array $changesets) {
$this->setRevision($revision);
$this->setActorID($actor_id);
$this->setActorHandle($actor);
$this->setChangesets($changesets);
}