Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92659416
PhabricatorProjectFeedController.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 22, 12:08
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 12:08 (2 d)
Engine
blob
Format
Raw Data
Handle
22480623
Attached To
rPH Phabricator
PhabricatorProjectFeedController.php
View Options
<?php
final
class
PhabricatorProjectFeedController
extends
PhabricatorProjectController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$user
=
$request
->
getUser
();
$query
=
id
(
new
PhabricatorProjectQuery
())
->
setViewer
(
$user
)
->
needMembers
(
true
)
->
needWatchers
(
true
)
->
needImages
(
true
)
->
needSlugs
(
true
);
$id
=
$request
->
getURIData
(
'id'
);
$slug
=
$request
->
getURIData
(
'slug'
);
if
(
$slug
)
{
$query
->
withSlugs
(
array
(
$slug
));
}
else
{
$query
->
withIDs
(
array
(
$id
));
}
$project
=
$query
->
executeOne
();
if
(!
$project
)
{
return
new
Aphront404Response
();
}
if
(
$slug
&&
$slug
!=
$project
->
getPrimarySlug
())
{
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
'/tag/'
.
$project
->
getPrimarySlug
().
'/'
);
}
require_celerity_resource
(
'phabricator-profile-css'
);
$query
=
new
PhabricatorFeedQuery
();
$query
->
setFilterPHIDs
(
array
(
$project
->
getPHID
(),
));
$query
->
setLimit
(
50
);
$query
->
setViewer
(
$request
->
getUser
());
$stories
=
$query
->
execute
();
$feed
=
$this
->
renderStories
(
$stories
);
$content
=
phutil_tag_div
(
'phabricator-project-feed'
,
$feed
);
$nav
=
$this
->
buildIconNavView
(
$project
);
$nav
->
selectFilter
(
"feed/{$id}/"
);
$nav
->
appendChild
(
$content
);
return
$this
->
buildApplicationPage
(
array
(
$nav
,
),
array
(
'title'
=>
$project
->
getName
(),
));
}
private
function
renderFeedPage
(
PhabricatorProject
$project
)
{
$query
=
new
PhabricatorFeedQuery
();
$query
->
setFilterPHIDs
(
array
(
$project
->
getPHID
()));
$query
->
setViewer
(
$this
->
getRequest
()->
getUser
());
$query
->
setLimit
(
100
);
$stories
=
$query
->
execute
();
if
(!
$stories
)
{
return
pht
(
'There are no stories about this project.'
);
}
return
$this
->
renderStories
(
$stories
);
}
private
function
renderStories
(
array
$stories
)
{
assert_instances_of
(
$stories
,
'PhabricatorFeedStory'
);
$builder
=
new
PhabricatorFeedBuilder
(
$stories
);
$builder
->
setUser
(
$this
->
getRequest
()->
getUser
());
$builder
->
setShowHovercards
(
true
);
$view
=
$builder
->
buildView
();
return
phutil_tag_div
(
'profile-feed'
,
$view
->
render
());
}
}
Event Timeline
Log In to Comment