2011-04-14 00:15:48 +02:00
|
|
|
<?php
|
|
|
|
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 23:01:03 +01:00
|
|
|
final class PhabricatorFileImageMacro extends PhabricatorFileDAO
|
2013-02-17 15:37:09 +01:00
|
|
|
implements
|
|
|
|
PhabricatorSubscribableInterface,
|
Adding some filters and queries to Macro application
Summary:
Fixes T2778
Introduces `PhabricatorMacroQuery`, which should consolidate all queries regarding macros
Adds `PolicyInterface` to `PhabricatorImageMacro`, as else the query would fail (we should consider adding it to the ApplicationTransaction instead, if that was ever planned)
Adds `Active Macros` filter, making it the default
Adds `My Macros` filter. You may ask why it overwrites `$authors`. Well, I did not want the page jump to the conclusion that it is a search result. It //is// one more or less, but the filter would jump to `seach` instead of `my`. If you want `My Macros` removed, tell me. It is useful only to heavy-macro-uploaders-and-users though. Five or six people in `http://secure.phabricator.(org|com)`, and an estimated dozen and a half at bigger installs.
Test Plan: created multiple macros from multiple authors, disabled them at will. browsed around, verified that Macros only appeared in the right filters and that nothing else broke.
Reviewers: epriestley, chad, btrahan
CC: aran, Korvin
Maniphest Tasks: T2778
Differential Revision: https://secure.phabricator.com/D5409
2013-03-22 17:46:21 +01:00
|
|
|
PhabricatorApplicationTransactionInterface,
|
|
|
|
PhabricatorPolicyInterface {
|
2011-04-14 00:15:48 +02:00
|
|
|
|
2013-05-30 00:05:44 +02:00
|
|
|
protected $authorPHID;
|
2011-04-14 00:15:48 +02:00
|
|
|
protected $filePHID;
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 23:01:03 +01:00
|
|
|
protected $phid;
|
2011-04-14 00:15:48 +02:00
|
|
|
protected $name;
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 23:01:03 +01:00
|
|
|
protected $isDisabled = 0;
|
2011-04-14 00:15:48 +02:00
|
|
|
|
Adding some filters and queries to Macro application
Summary:
Fixes T2778
Introduces `PhabricatorMacroQuery`, which should consolidate all queries regarding macros
Adds `PolicyInterface` to `PhabricatorImageMacro`, as else the query would fail (we should consider adding it to the ApplicationTransaction instead, if that was ever planned)
Adds `Active Macros` filter, making it the default
Adds `My Macros` filter. You may ask why it overwrites `$authors`. Well, I did not want the page jump to the conclusion that it is a search result. It //is// one more or less, but the filter would jump to `seach` instead of `my`. If you want `My Macros` removed, tell me. It is useful only to heavy-macro-uploaders-and-users though. Five or six people in `http://secure.phabricator.(org|com)`, and an estimated dozen and a half at bigger installs.
Test Plan: created multiple macros from multiple authors, disabled them at will. browsed around, verified that Macros only appeared in the right filters and that nothing else broke.
Reviewers: epriestley, chad, btrahan
CC: aran, Korvin
Maniphest Tasks: T2778
Differential Revision: https://secure.phabricator.com/D5409
2013-03-22 17:46:21 +01:00
|
|
|
private $file;
|
|
|
|
|
|
|
|
public function attachFile(PhabricatorFile $file) {
|
|
|
|
$this->file = $file;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFile() {
|
|
|
|
if (!$this->file) {
|
|
|
|
throw new Exception("Attach a file with attachFile() first!");
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->file;
|
|
|
|
}
|
|
|
|
|
2011-04-14 00:15:48 +02:00
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 23:01:03 +01:00
|
|
|
self::CONFIG_AUX_PHID => true,
|
2011-04-14 00:15:48 +02:00
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 23:01:03 +01:00
|
|
|
public function generatePHID() {
|
|
|
|
return PhabricatorPHID::generateNewPHID(
|
2013-07-24 23:06:10 +02:00
|
|
|
PhabricatorMacroPHIDTypeMacro::TYPECONST);
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 23:01:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isAutomaticallySubscribed($phid) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-02-17 15:37:09 +01:00
|
|
|
public function getApplicationTransactionEditor() {
|
|
|
|
return new PhabricatorMacroEditor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionObject() {
|
|
|
|
return new PhabricatorMacroTransaction();
|
|
|
|
}
|
|
|
|
|
Adding some filters and queries to Macro application
Summary:
Fixes T2778
Introduces `PhabricatorMacroQuery`, which should consolidate all queries regarding macros
Adds `PolicyInterface` to `PhabricatorImageMacro`, as else the query would fail (we should consider adding it to the ApplicationTransaction instead, if that was ever planned)
Adds `Active Macros` filter, making it the default
Adds `My Macros` filter. You may ask why it overwrites `$authors`. Well, I did not want the page jump to the conclusion that it is a search result. It //is// one more or less, but the filter would jump to `seach` instead of `my`. If you want `My Macros` removed, tell me. It is useful only to heavy-macro-uploaders-and-users though. Five or six people in `http://secure.phabricator.(org|com)`, and an estimated dozen and a half at bigger installs.
Test Plan: created multiple macros from multiple authors, disabled them at will. browsed around, verified that Macros only appeared in the right filters and that nothing else broke.
Reviewers: epriestley, chad, btrahan
CC: aran, Korvin
Maniphest Tasks: T2778
Differential Revision: https://secure.phabricator.com/D5409
2013-03-22 17:46:21 +01:00
|
|
|
public function getCapabilities() {
|
|
|
|
return array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
|
|
|
return PhabricatorPolicies::POLICY_USER;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-04-14 00:15:48 +02:00
|
|
|
}
|
|
|
|
|