public static function updateObjectNotificationViews(PhabricatorUser $user, $object_phid) { if (PhabricatorEnv::isReadOnly()) { return; } $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $notification_table = new PhabricatorFeedStoryNotification(); $conn = $notification_table->establishConnection('w'); queryfx($conn, 'UPDATE %T SET hasViewed = 1 WHERE userPHID = %s AND primaryObjectPHID = %s AND hasViewed = 0', $notification_table->getTableName(), $user->getPHID(), $object_phid); unset($unguarded); $count_key = PhabricatorUserNotificationCountCacheType::KEY_COUNT; PhabricatorUserCache::clearCache($count_key, $user->getPHID()); $user->clearCacheData($count_key); }