1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Fix an issue with editing application default policies in Calendar

Summary: Ref T11816. We're running this code on empty events which haven't been initialized and don't have a source attached -- just use a more explanatory check which doesn't need anything attached.

Test Plan: Edited default Calendar policies.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11816

Differential Revision: https://secure.phabricator.com/D16803
This commit is contained in:
epriestley 2016-11-04 16:38:14 -07:00
parent e337029769
commit 90fb8a1516

View file

@ -1169,7 +1169,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
case PhabricatorPolicyCapability::CAN_VIEW: case PhabricatorPolicyCapability::CAN_VIEW:
return $this->getViewPolicy(); return $this->getViewPolicy();
case PhabricatorPolicyCapability::CAN_EDIT: case PhabricatorPolicyCapability::CAN_EDIT:
if ($this->getImportSource()) { if ($this->isImportedEvent()) {
return PhabricatorPolicies::POLICY_NOONE; return PhabricatorPolicies::POLICY_NOONE;
} else { } else {
return $this->getEditPolicy(); return $this->getEditPolicy();
@ -1178,7 +1178,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
} }
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
if ($this->getImportSource()) { if ($this->isImportedEvent()) {
return false; return false;
} }
@ -1204,7 +1204,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
} }
public function describeAutomaticCapability($capability) { public function describeAutomaticCapability($capability) {
if ($this->getImportSource()) { if ($this->isImportedEvent()) {
return pht( return pht(
'Events imported from external sources can not be edited in '. 'Events imported from external sources can not be edited in '.
'Phabricator.'); 'Phabricator.');