Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105962647
PhabricatorApplicationTransactionNoEffectResponse.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, Mar 21, 03:34
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Mar 23, 03:34 (2 d)
Engine
blob
Format
Raw Data
Handle
25049928
Attached To
rPH Phabricator
PhabricatorApplicationTransactionNoEffectResponse.php
View Options
<?php
final
class
PhabricatorApplicationTransactionNoEffectResponse
extends
AphrontProxyResponse
{
private
$viewer
;
private
$exception
;
private
$cancelURI
;
public
function
setCancelURI
(
$cancel_uri
)
{
$this
->
cancelURI
=
$cancel_uri
;
return
$this
;
}
public
function
setException
(
PhabricatorApplicationTransactionNoEffectException
$exception
)
{
$this
->
exception
=
$exception
;
return
$this
;
}
protected
function
buildProxy
()
{
return
new
AphrontDialogResponse
();
}
public
function
reduceProxyResponse
()
{
$request
=
$this
->
getRequest
();
$ex
=
$this
->
exception
;
$xactions
=
$ex
->
getTransactions
();
$type_comment
=
PhabricatorTransactions
::
TYPE_COMMENT
;
$only_empty_comment
=
(
count
(
$xactions
)
==
1
)
&&
(
head
(
$xactions
)->
getTransactionType
()
==
$type_comment
);
if
(
$ex
->
hasAnyEffect
())
{
$title
=
pht
(
'%d Action(s) With No Effect'
,
count
(
$xactions
));
$tail
=
pht
(
'Apply remaining actions?'
);
$continue
=
pht
(
'Apply Other Actions'
);
}
else
if
(
$ex
->
hasComment
())
{
$title
=
pht
(
'Post as Comment'
);
$tail
=
pht
(
'Do you want to post your comment anyway?'
);
$continue
=
pht
(
'Post Comment'
);
}
else
if
(
$only_empty_comment
)
{
// Special case this since it's common and we can give the user a nicer
// dialog than "Action Has No Effect".
$title
=
pht
(
'Empty Comment'
);
$tail
=
null
;
$continue
=
null
;
}
else
{
$title
=
pht
(
'%d Action(s) Have No Effect'
,
count
(
$xactions
));
$tail
=
null
;
$continue
=
null
;
}
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$request
->
getUser
())
->
setTitle
(
$title
);
foreach
(
$xactions
as
$xaction
)
{
$dialog
->
appendChild
(
phutil_tag
(
'p'
,
array
(),
$xaction
->
getNoEffectDescription
()));
}
$dialog
->
appendChild
(
$tail
);
if
(
$continue
)
{
$passthrough
=
$request
->
getPassthroughRequestParameters
();
foreach
(
$passthrough
as
$key
=>
$value
)
{
$dialog
->
addHiddenInput
(
$key
,
$value
);
}
$dialog
->
addHiddenInput
(
'__continue__'
,
1
);
$dialog
->
addSubmitButton
(
$continue
);
}
$dialog
->
addCancelButton
(
$this
->
cancelURI
);
return
$this
->
getProxy
()->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment