mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Add helper method on event object to determine if event is the parent of a recurrence.
Summary: Ref T8472, Add helper method on event object to determine if event is the parent of a recurrence. Test Plan: No user facing change. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T8472 Differential Revision: https://secure.phabricator.com/D13221
This commit is contained in:
parent
8915fd8be8
commit
7015520b93
3 changed files with 21 additions and 8 deletions
|
@ -42,8 +42,7 @@ final class PhabricatorCalendarEventCancelController
|
|||
|
||||
$is_cancelled = $event->getIsCancelled();
|
||||
$is_parent_cancelled = $event->getIsParentCancelled();
|
||||
$is_recurring = $event->getIsRecurring();
|
||||
$instance_of = $event->getInstanceOfEventPHID();
|
||||
$is_parent = $event->getIsRecurrenceParent();
|
||||
|
||||
$validation_exception = null;
|
||||
|
||||
|
@ -86,7 +85,7 @@ final class PhabricatorCalendarEventCancelController
|
|||
cancelled recurring event.');
|
||||
$cancel = pht('Cancel');
|
||||
$submit = null;
|
||||
} else if ($is_recurring && !$instance_of) {
|
||||
} else if ($is_parent) {
|
||||
$title = pht('Reinstate Recurrence');
|
||||
$paragraph = pht('Reinstate the entire series
|
||||
of recurring events?');
|
||||
|
@ -105,7 +104,7 @@ final class PhabricatorCalendarEventCancelController
|
|||
of a recurring event.');
|
||||
$cancel = pht('Don\'t Cancel Instance');
|
||||
$submit = pht('Cancel Instance');
|
||||
} else if ($is_recurring && !$instance_of) {
|
||||
} else if ($is_parent) {
|
||||
$title = pht('Cancel Recurrence');
|
||||
$paragraph = pht('Cancel the entire series
|
||||
of recurring events?');
|
||||
|
|
|
@ -164,10 +164,10 @@ final class PhabricatorCalendarEventViewController
|
|||
$index = $event->getSequenceIndex();
|
||||
$edit_label = pht('Edit This Instance');
|
||||
$edit_uri = "event/edit/{$id}/{$index}/";
|
||||
} else if ($event->getInstanceOfEventPHID() && !$event->getIsGhostEvent()) {
|
||||
} else if ($event->getIsRecurrenceException()) {
|
||||
$edit_label = pht('Edit This Instance');
|
||||
$edit_uri = "event/edit/{$id}/";
|
||||
} else if (!$event->getIsRecurring()) {
|
||||
} else if (!$event->getIsRecurrenceParent()) {
|
||||
$edit_label = pht('Edit');
|
||||
$edit_uri = "event/edit/{$id}/";
|
||||
}
|
||||
|
@ -208,12 +208,12 @@ final class PhabricatorCalendarEventViewController
|
|||
$reinstate_label = pht('Reinstate This Instance');
|
||||
$cancel_disabled = (!$can_edit || $can_reinstate);
|
||||
$cancel_uri = $this->getApplicationURI("event/cancel/{$id}/{$index}/");
|
||||
} else if ($event->getInstanceOfEventPHID()) {
|
||||
} else if ($event->getIsRecurrenceException()) {
|
||||
$can_reinstate = $event->getIsParentCancelled();
|
||||
$cancel_label = pht('Cancel This Instance');
|
||||
$reinstate_label = pht('Reinstate This Instance');
|
||||
$cancel_disabled = (!$can_edit || $can_reinstate);
|
||||
} else if ($event->getIsRecurring()) {
|
||||
} else if ($event->getIsRecurrenceParent()) {
|
||||
$cancel_label = pht('Cancel Recurrence');
|
||||
$reinstate_label = pht('Reinstate Recurrence');
|
||||
$cancel_disabled = !$can_edit;
|
||||
|
|
|
@ -347,6 +347,20 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
|
|||
return $this->isCancelled;
|
||||
}
|
||||
|
||||
public function getIsRecurrenceParent() {
|
||||
if ($this->isRecurring && !$this->instanceOfEventPHID) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getIsRecurrenceException() {
|
||||
if ($this->instanceOfEventPHID && !$this->isGhostEvent) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getIsParentCancelled() {
|
||||
if ($this->instanceOfEventPHID == null) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue