Changeset View
Changeset View
Standalone View
Standalone View
src/applications/feed/PhabricatorFeedStoryPublisher.php
| Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | private function insertNotifications($chrono_key, array $subscribed_phids) { | ||||
| } | } | ||||
| $notif = new PhabricatorFeedStoryNotification(); | $notif = new PhabricatorFeedStoryNotification(); | ||||
| $sql = array(); | $sql = array(); | ||||
| $conn = $notif->establishConnection('w'); | $conn = $notif->establishConnection('w'); | ||||
| $will_receive_mail = array_fill_keys($this->mailRecipientPHIDs, true); | $will_receive_mail = array_fill_keys($this->mailRecipientPHIDs, true); | ||||
| foreach (array_unique($subscribed_phids) as $user_phid) { | $user_phids = array_unique($subscribed_phids); | ||||
| foreach ($user_phids as $user_phid) { | |||||
| if (isset($will_receive_mail[$user_phid])) { | if (isset($will_receive_mail[$user_phid])) { | ||||
| $mark_read = 1; | $mark_read = 1; | ||||
| } else { | } else { | ||||
| $mark_read = 0; | $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, | ||||
| $mark_read); | $mark_read); | ||||
| } | } | ||||
| if ($sql) { | if ($sql) { | ||||
| queryfx( | queryfx( | ||||
| $conn, | $conn, | ||||
| 'INSERT INTO %T '. | 'INSERT INTO %T '. | ||||
| '(primaryObjectPHID, userPHID, chronologicalKey, hasViewed) '. | '(primaryObjectPHID, userPHID, chronologicalKey, hasViewed) '. | ||||
| 'VALUES %Q', | 'VALUES %Q', | ||||
| $notif->getTableName(), | $notif->getTableName(), | ||||
| implode(', ', $sql)); | implode(', ', $sql)); | ||||
| } | } | ||||
| PhabricatorUserCache::clearCaches( | |||||
| PhabricatorUserNotificationCountCacheType::KEY_COUNT, | |||||
| $user_phids); | |||||
| } | } | ||||
| private function sendNotification($chrono_key, array $subscribed_phids) { | private function sendNotification($chrono_key, array $subscribed_phids) { | ||||
| $data = array( | $data = array( | ||||
| 'key' => (string)$chrono_key, | 'key' => (string)$chrono_key, | ||||
| 'type' => 'notification', | 'type' => 'notification', | ||||
| 'subscribers' => $subscribed_phids, | 'subscribers' => $subscribed_phids, | ||||
| ); | ); | ||||
| ▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines | |||||