Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96119339
PhabricatorBadgesEditor.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
Sun, Dec 22, 20:18
Size
3 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 20:18 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23126529
Attached To
rPH Phabricator
PhabricatorBadgesEditor.php
View Options
<?php
final
class
PhabricatorBadgesEditor
extends
PhabricatorApplicationTransactionEditor
{
public
function
getEditorApplicationClass
()
{
return
'PhabricatorBadgesApplication'
;
}
public
function
getEditorObjectsDescription
()
{
return
pht
(
'Badges'
);
}
public
function
getCreateObjectTitle
(
$author
,
$object
)
{
return
pht
(
'%s created this badge.'
,
$author
);
}
public
function
getCreateObjectTitleForFeed
(
$author
,
$object
)
{
return
pht
(
'%s created %s.'
,
$author
,
$object
);
}
protected
function
supportsSearch
()
{
return
true
;
}
public
function
getTransactionTypes
()
{
$types
=
parent
::
getTransactionTypes
();
$types
[]
=
PhabricatorTransactions
::
TYPE_COMMENT
;
$types
[]
=
PhabricatorTransactions
::
TYPE_EDGE
;
$types
[]
=
PhabricatorTransactions
::
TYPE_EDIT_POLICY
;
return
$types
;
}
protected
function
shouldSendMail
(
PhabricatorLiskDAO
$object
,
array
$xactions
)
{
return
true
;
}
public
function
getMailTagsMap
()
{
return
array
(
PhabricatorBadgesTransaction
::
MAILTAG_DETAILS
=>
pht
(
'Someone changes the badge
\'
s details.'
),
PhabricatorBadgesTransaction
::
MAILTAG_COMMENT
=>
pht
(
'Someone comments on a badge.'
),
PhabricatorBadgesTransaction
::
MAILTAG_OTHER
=>
pht
(
'Other badge activity not listed above occurs.'
),
);
}
protected
function
shouldPublishFeedStory
(
PhabricatorLiskDAO
$object
,
array
$xactions
)
{
return
true
;
}
protected
function
expandTransactions
(
PhabricatorLiskDAO
$object
,
array
$xactions
)
{
$actor
=
$this
->
getActor
();
$actor_phid
=
$actor
->
getPHID
();
$results
=
parent
::
expandTransactions
(
$object
,
$xactions
);
// Automatically subscribe the author when they create a badge.
if
(
$this
->
getIsNewObject
())
{
if
(
$actor_phid
)
{
$results
[]
=
id
(
new
PhabricatorBadgesTransaction
())
->
setTransactionType
(
PhabricatorTransactions
::
TYPE_SUBSCRIBERS
)
->
setNewValue
(
array
(
'+'
=>
array
(
$actor_phid
=>
$actor_phid
),
));
}
}
return
$results
;
}
protected
function
buildReplyHandler
(
PhabricatorLiskDAO
$object
)
{
return
id
(
new
PhabricatorBadgesReplyHandler
())
->
setMailReceiver
(
$object
);
}
protected
function
buildMailTemplate
(
PhabricatorLiskDAO
$object
)
{
$name
=
$object
->
getName
();
$id
=
$object
->
getID
();
$topic
=
pht
(
'Badge %d'
,
$id
);
$subject
=
pht
(
'Badge %d: %s'
,
$id
,
$name
);
return
id
(
new
PhabricatorMetaMTAMail
())
->
setSubject
(
$subject
)
->
addHeader
(
'Thread-Topic'
,
$topic
);
}
protected
function
getMailTo
(
PhabricatorLiskDAO
$object
)
{
return
array
(
$object
->
getCreatorPHID
(),
$this
->
requireActor
()->
getPHID
(),
);
}
protected
function
buildMailBody
(
PhabricatorLiskDAO
$object
,
array
$xactions
)
{
$body
=
parent
::
buildMailBody
(
$object
,
$xactions
);
$body
->
addLinkSection
(
pht
(
'BADGE DETAIL'
),
PhabricatorEnv
::
getProductionURI
(
'/badges/view/'
.
$object
->
getID
().
'/'
));
return
$body
;
}
protected
function
getMailSubjectPrefix
()
{
return
pht
(
'[Badge]'
);
}
}
Event Timeline
Log In to Comment