Differential D20475 Diff 48880 src/applications/notification/controller/PhabricatorNotificationClearController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/notification/controller/PhabricatorNotificationClearController.php
<?php | <?php | ||||
final class PhabricatorNotificationClearController | final class PhabricatorNotificationClearController | ||||
extends PhabricatorNotificationController { | extends PhabricatorNotificationController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $request->getViewer(); | $viewer = $request->getViewer(); | ||||
$chrono_key = $request->getStr('chronoKey'); | $chrono_key = $request->getStr('chronoKey'); | ||||
if ($request->isDialogFormPost()) { | if ($request->isDialogFormPost()) { | ||||
$should_clear = true; | $should_clear = true; | ||||
} else { | } else { | ||||
try { | $should_clear = $request->hasCSRF(); | ||||
$request->validateCSRF(); | |||||
$should_clear = true; | |||||
} catch (AphrontMalformedRequestException $ex) { | |||||
$should_clear = false; | |||||
} | |||||
} | } | ||||
if ($should_clear) { | if ($should_clear) { | ||||
$table = new PhabricatorFeedStoryNotification(); | $table = new PhabricatorFeedStoryNotification(); | ||||
queryfx( | queryfx( | ||||
$table->establishConnection('w'), | $table->establishConnection('w'), | ||||
'UPDATE %T SET hasViewed = 1 '. | 'UPDATE %T SET hasViewed = 1 '. | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |