mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-03 19:31:02 +01:00
Allow notifications to be published as read if the user also is getting an email
Summary: See discussion in T1403. Possibly we'll add a preference for this or something? Test Plan: Not yet in use. See future diff. Reviewers: btrahan, vrana Reviewed By: vrana CC: aran Maniphest Tasks: T1403 Differential Revision: https://secure.phabricator.com/D3784
This commit is contained in:
parent
51c4b199d0
commit
951864d388
1 changed files with 15 additions and 1 deletions
|
@ -25,6 +25,7 @@ final class PhabricatorFeedStoryPublisher {
|
|||
private $storyAuthorPHID;
|
||||
private $primaryObjectPHID;
|
||||
private $subscribedPHIDs = array();
|
||||
private $mailRecipientPHIDs = array();
|
||||
|
||||
public function setRelatedPHIDs(array $phids) {
|
||||
$this->relatedPHIDs = $phids;
|
||||
|
@ -60,6 +61,11 @@ final class PhabricatorFeedStoryPublisher {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setMailRecipientPHIDs(array $phids) {
|
||||
$this->mailRecipientPHIDs = $phids;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function publish() {
|
||||
$class = $this->storyType;
|
||||
if (!$class) {
|
||||
|
@ -136,14 +142,22 @@ final class PhabricatorFeedStoryPublisher {
|
|||
$sql = array();
|
||||
$conn = $notif->establishConnection('w');
|
||||
|
||||
$will_receive_mail = array_fill_keys($this->mailRecipientPHIDs, true);
|
||||
|
||||
foreach (array_unique($subscribed_phids) as $user_phid) {
|
||||
if (isset($will_receive_mail[$user_phid])) {
|
||||
$mark_read = 1;
|
||||
} else {
|
||||
$mark_read = 0;
|
||||
}
|
||||
|
||||
$sql[] = qsprintf(
|
||||
$conn,
|
||||
'(%s, %s, %s, %d)',
|
||||
$this->primaryObjectPHID,
|
||||
$user_phid,
|
||||
$chrono_key,
|
||||
0);
|
||||
$mark_read);
|
||||
}
|
||||
|
||||
queryfx(
|
||||
|
|
Loading…
Reference in a new issue