Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97892671
PhabricatorSubscriptionsEditEngineExtension.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
Tue, Jan 7, 06:48
Size
2 KB
Mime Type
text/x-php
Expires
Thu, Jan 9, 06:48 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23432651
Attached To
rPH Phabricator
PhabricatorSubscriptionsEditEngineExtension.php
View Options
<?php
final
class
PhabricatorSubscriptionsEditEngineExtension
extends
PhabricatorEditEngineExtension
{
const
EXTENSIONKEY
=
'subscriptions.subscribers'
;
const
FIELDKEY
=
'subscriberPHIDs'
;
const
EDITKEY_ADD
=
'subscribers.add'
;
const
EDITKEY_SET
=
'subscribers.set'
;
const
EDITKEY_REMOVE
=
'subscribers.remove'
;
public
function
getExtensionPriority
()
{
return
750
;
}
public
function
isExtensionEnabled
()
{
return
true
;
}
public
function
getExtensionName
()
{
return
pht
(
'Subscriptions'
);
}
public
function
supportsObject
(
PhabricatorEditEngine
$engine
,
PhabricatorApplicationTransactionInterface
$object
)
{
return
(
$object
instanceof
PhabricatorSubscribableInterface
);
}
public
function
buildCustomEditFields
(
PhabricatorEditEngine
$engine
,
PhabricatorApplicationTransactionInterface
$object
)
{
$subscribers_type
=
PhabricatorTransactions
::
TYPE_SUBSCRIBERS
;
$object_phid
=
$object
->
getPHID
();
if
(
$object_phid
)
{
$sub_phids
=
PhabricatorSubscribersQuery
::
loadSubscribersForPHID
(
$object_phid
);
}
else
{
$sub_phids
=
array
();
}
$viewer
=
$engine
->
getViewer
();
$subscribers_field
=
id
(
new
PhabricatorSubscribersEditField
())
->
setKey
(
self
::
FIELDKEY
)
->
setLabel
(
pht
(
'Subscribers'
))
->
setEditTypeKey
(
'subscribers'
)
->
setAliases
(
array
(
'subscriber'
,
'subscribers'
))
->
setIsCopyable
(
true
)
->
setUseEdgeTransactions
(
true
)
->
setCommentActionLabel
(
pht
(
'Change Subscribers'
))
->
setCommentActionOrder
(
9000
)
->
setDescription
(
pht
(
'Choose subscribers.'
))
->
setTransactionType
(
$subscribers_type
)
->
setValue
(
$sub_phids
)
->
setViewer
(
$viewer
);
$subscriber_datasource
=
id
(
new
PhabricatorMetaMTAMailableDatasource
())
->
setViewer
(
$viewer
);
$edit_add
=
$subscribers_field
->
getConduitEditType
(
self
::
EDITKEY_ADD
)
->
setConduitDescription
(
pht
(
'Add subscribers.'
));
$edit_set
=
$subscribers_field
->
getConduitEditType
(
self
::
EDITKEY_SET
)
->
setConduitDescription
(
pht
(
'Set subscribers, overwriting current value.'
));
$edit_rem
=
$subscribers_field
->
getConduitEditType
(
self
::
EDITKEY_REMOVE
)
->
setConduitDescription
(
pht
(
'Remove subscribers.'
));
$subscribers_field
->
getBulkEditType
(
self
::
EDITKEY_ADD
)
->
setBulkEditLabel
(
pht
(
'Add subscribers'
))
->
setDatasource
(
$subscriber_datasource
);
$subscribers_field
->
getBulkEditType
(
self
::
EDITKEY_SET
)
->
setBulkEditLabel
(
pht
(
'Set subscribers to'
))
->
setDatasource
(
$subscriber_datasource
);
$subscribers_field
->
getBulkEditType
(
self
::
EDITKEY_REMOVE
)
->
setBulkEditLabel
(
pht
(
'Remove subscribers'
))
->
setDatasource
(
$subscriber_datasource
);
return
array
(
$subscribers_field
,
);
}
}
Event Timeline
Log In to Comment