Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15518457
D13818.id33368.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13818.id33368.diff
View Options
diff --git a/resources/sql/autopatches/20150806.ponder.policy.1.sql b/resources/sql/autopatches/20150806.ponder.policy.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150806.ponder.policy.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_ponder.ponder_answer
+ ADD editPolicy VARBINARY(64) NOT NULL;
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3388,6 +3388,7 @@
'PonderAddAnswerView' => 'applications/ponder/view/PonderAddAnswerView.php',
'PonderAnswer' => 'applications/ponder/storage/PonderAnswer.php',
'PonderAnswerCommentController' => 'applications/ponder/controller/PonderAnswerCommentController.php',
+ 'PonderAnswerDefaultEditCapability' => 'applications/ponder/capability/PonderAnswerDefaultEditCapability.php',
'PonderAnswerEditController' => 'applications/ponder/controller/PonderAnswerEditController.php',
'PonderAnswerEditor' => 'applications/ponder/editor/PonderAnswerEditor.php',
'PonderAnswerHasVotingUserEdgeType' => 'applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php',
@@ -7576,6 +7577,7 @@
'PhabricatorDestructibleInterface',
),
'PonderAnswerCommentController' => 'PonderController',
+ 'PonderAnswerDefaultEditCapability' => 'PhabricatorPolicyCapability',
'PonderAnswerEditController' => 'PonderController',
'PonderAnswerEditor' => 'PonderEditor',
'PonderAnswerHasVotingUserEdgeType' => 'PhabricatorEdgeType',
diff --git a/src/applications/ponder/application/PhabricatorPonderApplication.php b/src/applications/ponder/application/PhabricatorPonderApplication.php
--- a/src/applications/ponder/application/PhabricatorPonderApplication.php
+++ b/src/applications/ponder/application/PhabricatorPonderApplication.php
@@ -101,6 +101,11 @@
'template' => PonderQuestionPHIDType::TYPECONST,
'capability' => PhabricatorPolicyCapability::CAN_EDIT,
),
+ PonderAnswerDefaultEditCapability::CAPABILITY => array(
+ 'default' => PhabricatorPolicies::POLICY_ADMIN,
+ 'template' => PonderAnswerPHIDType::TYPECONST,
+ 'capability' => PhabricatorPolicyCapability::CAN_EDIT,
+ ),
);
}
diff --git a/src/applications/ponder/capability/PonderAnswerDefaultEditCapability.php b/src/applications/ponder/capability/PonderAnswerDefaultEditCapability.php
new file mode 100644
--- /dev/null
+++ b/src/applications/ponder/capability/PonderAnswerDefaultEditCapability.php
@@ -0,0 +1,12 @@
+<?php
+
+final class PonderAnswerDefaultEditCapability
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'ponder.answer.default.edit';
+
+ public function getCapabilityName() {
+ return pht('Default Answer Edit Policy');
+ }
+
+}
diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php
--- a/src/applications/ponder/storage/PonderAnswer.php
+++ b/src/applications/ponder/storage/PonderAnswer.php
@@ -19,6 +19,7 @@
protected $content;
protected $contentSource;
protected $mailKey;
+ protected $editPolicy;
protected $voteCount;
private $vote;
@@ -198,8 +199,7 @@
case PhabricatorPolicyCapability::CAN_VIEW:
return $this->getQuestion()->getPolicy($capability);
case PhabricatorPolicyCapability::CAN_EDIT:
- return PhabricatorPolicies::POLICY_NOONE;
- }
+ return $this->getEditPolicy(); }
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 20, 1:37 PM (4 d, 16 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7800152
Default Alt Text
D13818.id33368.diff (3 KB)
Attached To
Mode
D13818: Add a default moderation policy to Ponder
Attached
Detach File
Event Timeline
Log In to Comment