Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93587804
PhabricatorNotificationTestController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 29, 23:27
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 23:27 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22671236
Attached To
rPH Phabricator
PhabricatorNotificationTestController.php
View Options
<?php
final
class
PhabricatorNotificationTestController
extends
PhabricatorNotificationController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$story_type
=
'PhabricatorNotificationAdHocFeedStory'
;
$story_data
=
array
(
'title'
=>
pht
(
'This is a test notification, sent at %s.'
,
phabricator_datetime
(
time
(),
$viewer
)),
);
$viewer_phid
=
$viewer
->
getPHID
();
// NOTE: Because we don't currently show you your own notifications, make
// sure this comes from a different PHID.
$application_phid
=
id
(
new
PhabricatorNotificationsApplication
())
->
getPHID
();
// TODO: When it's easier to get these buttons to render as forms, this
// would be slightly nicer as a more standard isFormPost() check.
if
(
$request
->
validateCSRF
())
{
id
(
new
PhabricatorFeedStoryPublisher
())
->
setStoryType
(
$story_type
)
->
setStoryData
(
$story_data
)
->
setStoryTime
(
time
())
->
setStoryAuthorPHID
(
$application_phid
)
->
setRelatedPHIDs
(
array
(
$viewer_phid
))
->
setPrimaryObjectPHID
(
$viewer_phid
)
->
setSubscribedPHIDs
(
array
(
$viewer_phid
))
->
setNotifyAuthor
(
true
)
->
publish
();
}
return
id
(
new
AphrontAjaxResponse
());
}
}
Event Timeline
Log In to Comment