Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F69342179
DiffusionTagListController.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
Mon, Jul 1, 08:55
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Jul 3, 08:55 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18699116
Attached To
rPH Phabricator
DiffusionTagListController.php
View Options
<?php
final
class
DiffusionTagListController
extends
DiffusionController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$response
=
$this
->
loadDiffusionContext
();
if
(
$response
)
{
return
$response
;
}
$viewer
=
$this
->
getViewer
();
$drequest
=
$this
->
getDiffusionRequest
();
$repository
=
$drequest
->
getRepository
();
$pager
=
id
(
new
PHUIPagerView
())
->
readFromRequest
(
$request
);
$params
=
array
(
'limit'
=>
$pager
->
getPageSize
()
+
1
,
'offset'
=>
$pager
->
getOffset
(),
);
if
(
strlen
(
$drequest
->
getSymbolicCommit
()))
{
$is_commit
=
true
;
$params
[
'commit'
]
=
$drequest
->
getSymbolicCommit
();
}
else
{
$is_commit
=
false
;
}
switch
(
$repository
->
getVersionControlSystem
())
{
case
PhabricatorRepositoryType
::
REPOSITORY_TYPE_SVN
:
$tags
=
array
();
break
;
default
:
$conduit_result
=
$this
->
callConduitWithDiffusionRequest
(
'diffusion.tagsquery'
,
$params
);
$tags
=
DiffusionRepositoryTag
::
newFromConduit
(
$conduit_result
);
break
;
}
$tags
=
$pager
->
sliceResults
(
$tags
);
$content
=
null
;
$header
=
id
(
new
PHUIHeaderView
())
->
setHeader
(
pht
(
'Tags'
))
->
setHeaderIcon
(
'fa-tags'
);
if
(!
$tags
)
{
$content
=
$this
->
renderStatusMessage
(
pht
(
'No Tags'
),
$is_commit
?
pht
(
'This commit has no tags.'
)
:
pht
(
'This repository has no tags.'
));
}
else
{
$commits
=
id
(
new
DiffusionCommitQuery
())
->
setViewer
(
$viewer
)
->
withRepository
(
$repository
)
->
withIdentifiers
(
mpull
(
$tags
,
'getCommitIdentifier'
))
->
needCommitData
(
true
)
->
execute
();
$tag_list
=
id
(
new
DiffusionTagListView
())
->
setTags
(
$tags
)
->
setUser
(
$viewer
)
->
setCommits
(
$commits
)
->
setDiffusionRequest
(
$drequest
);
$phids
=
$tag_list
->
getRequiredHandlePHIDs
();
$handles
=
$this
->
loadViewerHandles
(
$phids
);
$tag_list
->
setHandles
(
$handles
);
$content
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
$repository
->
getDisplayName
())
->
setBackground
(
PHUIObjectBoxView
::
BLUE_PROPERTY
)
->
setTable
(
$tag_list
)
->
setPager
(
$pager
);
}
$crumbs
=
$this
->
buildCrumbs
(
array
(
'tags'
=>
true
,
'commit'
=>
$drequest
->
getSymbolicCommit
(),
));
$crumbs
->
setBorder
(
true
);
$tabs
=
$this
->
buildTabsView
(
'tags'
);
$view
=
id
(
new
PHUITwoColumnView
())
->
setHeader
(
$header
)
->
setTabs
(
$tabs
)
->
setFooter
(
$content
);
return
$this
->
newPage
()
->
setTitle
(
array
(
pht
(
'Tags'
),
$repository
->
getDisplayName
(),
))
->
setCrumbs
(
$crumbs
)
->
appendChild
(
$view
)
->
addClass
(
'diffusion-history-view'
);
}
}
Event Timeline
Log In to Comment