Path: blob/master/src/applications/notification/storage/PhabricatorFeedStoryNotification.php
12256 views
<?php12final class PhabricatorFeedStoryNotification extends PhabricatorFeedDAO {34protected $userPHID;5protected $primaryObjectPHID;6protected $chronologicalKey;7protected $hasViewed;89protected function getConfiguration() {10return array(11self::CONFIG_IDS => self::IDS_MANUAL,12self::CONFIG_TIMESTAMPS => false,13self::CONFIG_COLUMN_SCHEMA => array(14'chronologicalKey' => 'uint64',15'hasViewed' => 'bool',16'id' => null,17),18self::CONFIG_KEY_SCHEMA => array(19'PRIMARY' => null,20'userPHID' => array(21'columns' => array('userPHID', 'chronologicalKey'),22'unique' => true,23),24'userPHID_2' => array(25'columns' => array('userPHID', 'hasViewed', 'primaryObjectPHID'),26),27'key_object' => array(28'columns' => array('primaryObjectPHID'),29),30'key_chronological' => array(31'columns' => array('chronologicalKey'),32),33),34) + parent::getConfiguration();35}3637public static function updateObjectNotificationViews(38PhabricatorUser $user,39$object_phid) {4041if (PhabricatorEnv::isReadOnly()) {42return;43}4445$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();4647$notification_table = new PhabricatorFeedStoryNotification();48$conn = $notification_table->establishConnection('w');4950queryfx(51$conn,52'UPDATE %T53SET hasViewed = 154WHERE userPHID = %s55AND primaryObjectPHID = %s56AND hasViewed = 0',57$notification_table->getTableName(),58$user->getPHID(),59$object_phid);6061unset($unguarded);6263$count_key = PhabricatorUserNotificationCountCacheType::KEY_COUNT;64PhabricatorUserCache::clearCache($count_key, $user->getPHID());65$user->clearCacheData($count_key);66}6768}697071