mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-01 01:18:22 +01:00
Update Calendar for handleRequest
Summary: Run through Calendar and update/cleanup processRequest Test Plan: New Event, Edit, etc. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D13747
This commit is contained in:
parent
917fa250d0
commit
2ff4601584
6 changed files with 30 additions and 55 deletions
|
@ -3,20 +3,14 @@
|
|||
final class PhabricatorCalendarEventCancelController
|
||||
extends PhabricatorCalendarController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = idx($data, 'id');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
$sequence = $request->getURIData('sequence');
|
||||
|
||||
$event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($user)
|
||||
->withIDs(array($this->id))
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
@ -26,7 +20,7 @@ final class PhabricatorCalendarEventCancelController
|
|||
|
||||
if ($sequence) {
|
||||
$parent_event = $event;
|
||||
$event = $parent_event->generateNthGhost($sequence, $user);
|
||||
$event = $parent_event->generateNthGhost($sequence, $viewer);
|
||||
$event->attachParentEvent($parent_event);
|
||||
}
|
||||
|
||||
|
@ -51,10 +45,10 @@ final class PhabricatorCalendarEventCancelController
|
|||
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
|
||||
} else if ($sequence) {
|
||||
$event = $this->createEventFromGhost(
|
||||
$user,
|
||||
$viewer,
|
||||
$event,
|
||||
$sequence);
|
||||
$event->applyViewerTimezone($user);
|
||||
$event->applyViewerTimezone($viewer);
|
||||
}
|
||||
|
||||
$xactions = array();
|
||||
|
@ -65,7 +59,7 @@ final class PhabricatorCalendarEventCancelController
|
|||
->setNewValue(!$is_cancelled);
|
||||
|
||||
$editor = id(new PhabricatorCalendarEventEditor())
|
||||
->setActor($user)
|
||||
->setActor($viewer)
|
||||
->setContentSourceFromRequest($request)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContinueOnMissingFields(true);
|
||||
|
|
|
@ -3,24 +3,20 @@
|
|||
final class PhabricatorCalendarEventCommentController
|
||||
extends PhabricatorCalendarController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = idx($data, 'id');
|
||||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
if (!$request->isFormPost()) {
|
||||
return new Aphront400Response();
|
||||
}
|
||||
|
||||
$user = $request->getUser();
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$is_preview = $request->isPreviewRequest();
|
||||
$draft = PhabricatorDraft::buildFromRequest($request);
|
||||
|
||||
$event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($user)
|
||||
->withIDs(array($this->id))
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$event) {
|
||||
return new Aphront404Response();
|
||||
|
@ -29,7 +25,7 @@ final class PhabricatorCalendarEventCommentController
|
|||
$index = $request->getURIData('sequence');
|
||||
if ($index && !$is_preview) {
|
||||
$result = $this->getEventAtIndexForGhostPHID(
|
||||
$user,
|
||||
$viewer,
|
||||
$event->getPHID(),
|
||||
$index);
|
||||
|
||||
|
@ -37,10 +33,10 @@ final class PhabricatorCalendarEventCommentController
|
|||
$event = $result;
|
||||
} else {
|
||||
$event = $this->createEventFromGhost(
|
||||
$user,
|
||||
$viewer,
|
||||
$event,
|
||||
$index);
|
||||
$event->applyViewerTimezone($user);
|
||||
$event->applyViewerTimezone($viewer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +50,7 @@ final class PhabricatorCalendarEventCommentController
|
|||
->setContent($request->getStr('comment')));
|
||||
|
||||
$editor = id(new PhabricatorCalendarEventEditor())
|
||||
->setActor($user)
|
||||
->setActor($viewer)
|
||||
->setContinueOnNoEffect($request->isContinueRequest())
|
||||
->setContentSourceFromRequest($request)
|
||||
->setIsPreview($is_preview);
|
||||
|
@ -73,7 +69,7 @@ final class PhabricatorCalendarEventCommentController
|
|||
|
||||
if ($request->isAjax() && $is_preview) {
|
||||
return id(new PhabricatorApplicationTransactionResponse())
|
||||
->setViewer($user)
|
||||
->setViewer($viewer)
|
||||
->setTransactions($xactions)
|
||||
->setIsPreview($is_preview);
|
||||
} else {
|
||||
|
|
|
@ -5,10 +5,6 @@ final class PhabricatorCalendarEventEditController
|
|||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = idx($data, 'id');
|
||||
}
|
||||
|
||||
public function isCreate() {
|
||||
return !$this->id;
|
||||
}
|
||||
|
@ -16,6 +12,8 @@ final class PhabricatorCalendarEventEditController
|
|||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$user_phid = $viewer->getPHID();
|
||||
$this->id = $request->getURIData('id');
|
||||
|
||||
$error_name = true;
|
||||
$error_recurrence_end_date = null;
|
||||
$error_start_date = true;
|
||||
|
|
|
@ -3,19 +3,14 @@
|
|||
final class PhabricatorCalendarEventEditIconController
|
||||
extends PhabricatorCalendarController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = idx($data, 'id');
|
||||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getUser();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
if ($this->id) {
|
||||
if ($id) {
|
||||
$event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
|
|
@ -3,14 +3,12 @@
|
|||
final class PhabricatorCalendarEventJoinController
|
||||
extends PhabricatorCalendarController {
|
||||
|
||||
private $id;
|
||||
|
||||
const ACTION_ACCEPT = 'accept';
|
||||
const ACTION_DECLINE = 'decline';
|
||||
const ACTION_JOIN = 'join';
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$this->id = $request->getURIData('id');
|
||||
$id = $request->getURIData('id');
|
||||
$action = $request->getURIData('action');
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
@ -20,7 +18,7 @@ final class PhabricatorCalendarEventJoinController
|
|||
|
||||
$event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
|
||||
if (!$event) {
|
||||
|
|
|
@ -3,26 +3,20 @@
|
|||
final class PhabricatorCalendarEventViewController
|
||||
extends PhabricatorCalendarController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
$sequence = $request->getURIData('sequence');
|
||||
|
||||
$timeline = null;
|
||||
|
||||
$event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$event) {
|
||||
return new Aphront404Response();
|
||||
|
|
Loading…
Add table
Reference in a new issue