Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F538594
PhabricatorNotificationClearController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorNotificationClearController.php
View Options
<?php
final
class
PhabricatorNotificationClearController
extends
PhabricatorNotificationController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$chrono_key
=
$request
->
getStr
(
'chronoKey'
);
if
(
$request
->
isDialogFormPost
())
{
$should_clear
=
true
;
}
else
{
$should_clear
=
$request
->
hasCSRF
();
}
if
(
$should_clear
)
{
$table
=
new
PhabricatorFeedStoryNotification
();
queryfx
(
$table
->
establishConnection
(
'w'
),
'UPDATE %T SET hasViewed = 1 '
.
'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s'
,
$table
->
getTableName
(),
$viewer
->
getPHID
(),
$chrono_key
);
PhabricatorUserCache
::
clearCache
(
PhabricatorUserNotificationCountCacheType
::
KEY_COUNT
,
$viewer
->
getPHID
());
return
id
(
new
AphrontReloadResponse
())
->
setURI
(
'/notification/'
);
}
$dialog
=
new
AphrontDialogView
();
$dialog
->
setUser
(
$viewer
);
$dialog
->
addCancelButton
(
'/notification/'
);
if
(
$chrono_key
)
{
$dialog
->
setTitle
(
pht
(
'Really mark all notifications as read?'
));
$dialog
->
addHiddenInput
(
'chronoKey'
,
$chrono_key
);
$is_serious
=
PhabricatorEnv
::
getEnvConfig
(
'phabricator.serious-business'
);
if
(
$is_serious
)
{
$dialog
->
appendChild
(
pht
(
'All unread notifications will be marked as read. You can not '
.
'undo this action.'
));
}
else
{
$dialog
->
appendChild
(
pht
(
"You can't ignore your problems forever, you know."
));
}
$dialog
->
addSubmitButton
(
pht
(
'Mark All Read'
));
}
else
{
$dialog
->
setTitle
(
pht
(
'No notifications to mark as read.'
));
$dialog
->
appendChild
(
pht
(
'You have no unread notifications.'
));
}
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 8:51 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
120005
Default Alt Text
PhabricatorNotificationClearController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment