mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 10:41:08 +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 $storyAuthorPHID;
|
||||||
private $primaryObjectPHID;
|
private $primaryObjectPHID;
|
||||||
private $subscribedPHIDs = array();
|
private $subscribedPHIDs = array();
|
||||||
|
private $mailRecipientPHIDs = array();
|
||||||
|
|
||||||
public function setRelatedPHIDs(array $phids) {
|
public function setRelatedPHIDs(array $phids) {
|
||||||
$this->relatedPHIDs = $phids;
|
$this->relatedPHIDs = $phids;
|
||||||
|
@ -60,6 +61,11 @@ final class PhabricatorFeedStoryPublisher {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setMailRecipientPHIDs(array $phids) {
|
||||||
|
$this->mailRecipientPHIDs = $phids;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function publish() {
|
public function publish() {
|
||||||
$class = $this->storyType;
|
$class = $this->storyType;
|
||||||
if (!$class) {
|
if (!$class) {
|
||||||
|
@ -136,14 +142,22 @@ final class PhabricatorFeedStoryPublisher {
|
||||||
$sql = array();
|
$sql = array();
|
||||||
$conn = $notif->establishConnection('w');
|
$conn = $notif->establishConnection('w');
|
||||||
|
|
||||||
|
$will_receive_mail = array_fill_keys($this->mailRecipientPHIDs, true);
|
||||||
|
|
||||||
foreach (array_unique($subscribed_phids) as $user_phid) {
|
foreach (array_unique($subscribed_phids) as $user_phid) {
|
||||||
|
if (isset($will_receive_mail[$user_phid])) {
|
||||||
|
$mark_read = 1;
|
||||||
|
} else {
|
||||||
|
$mark_read = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$sql[] = qsprintf(
|
$sql[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'(%s, %s, %s, %d)',
|
'(%s, %s, %s, %d)',
|
||||||
$this->primaryObjectPHID,
|
$this->primaryObjectPHID,
|
||||||
$user_phid,
|
$user_phid,
|
||||||
$chrono_key,
|
$chrono_key,
|
||||||
0);
|
$mark_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
queryfx(
|
queryfx(
|
||||||
|
|
Loading…
Reference in a new issue