mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 21:32:43 +01:00
Merge branch 'master' into redesign-2015
This commit is contained in:
commit
f7edabbc6a
4 changed files with 37 additions and 33 deletions
|
@ -61,7 +61,7 @@ final class PhabricatorCalendarApplication extends PhabricatorApplication {
|
|||
=> 'PhabricatorCalendarEventCancelController',
|
||||
'(?P<action>join|decline|accept)/(?P<id>[1-9]\d*)/'
|
||||
=> 'PhabricatorCalendarEventJoinController',
|
||||
'comment/(?P<id>[1-9]\d*)/'
|
||||
'comment/(?P<id>[1-9]\d*)/(?:(?P<sequence>\d+)/)?'
|
||||
=> 'PhabricatorCalendarEventCommentController',
|
||||
),
|
||||
),
|
||||
|
|
|
@ -11,12 +11,14 @@ final class PhabricatorCalendarEventCommentController
|
|||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$user = $request->getUser();
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
return new Aphront400Response();
|
||||
}
|
||||
|
||||
$user = $request->getUser();
|
||||
$is_preview = $request->isPreviewRequest();
|
||||
$draft = PhabricatorDraft::buildFromRequest($request);
|
||||
|
||||
$event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($user)
|
||||
->withIDs(array($this->id))
|
||||
|
@ -25,8 +27,23 @@ final class PhabricatorCalendarEventCommentController
|
|||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$is_preview = $request->isPreviewRequest();
|
||||
$draft = PhabricatorDraft::buildFromRequest($request);
|
||||
$index = $request->getURIData('sequence');
|
||||
if ($index && !$is_preview) {
|
||||
$result = $this->getEventAtIndexForGhostPHID(
|
||||
$user,
|
||||
$event->getPHID(),
|
||||
$index);
|
||||
|
||||
if ($result) {
|
||||
$event = $result;
|
||||
} else {
|
||||
$event = $this->createEventFromGhost(
|
||||
$user,
|
||||
$event,
|
||||
$index);
|
||||
$event->applyViewerTimezone($user);
|
||||
}
|
||||
}
|
||||
|
||||
$view_uri = '/'.$event->getMonogram();
|
||||
|
||||
|
|
|
@ -16,9 +16,10 @@ final class PhabricatorCalendarEventViewController
|
|||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
|
||||
$sequence = $request->getURIData('sequence');
|
||||
|
||||
$timeline = null;
|
||||
|
||||
$event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
|
@ -60,9 +61,11 @@ final class PhabricatorCalendarEventViewController
|
|||
$crumbs->addTextCrumb($title, '/E'.$event->getID());
|
||||
}
|
||||
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$event,
|
||||
new PhabricatorCalendarEventTransactionQuery());
|
||||
if (!$event->getIsGhostEvent()) {
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$event,
|
||||
new PhabricatorCalendarEventTransactionQuery());
|
||||
}
|
||||
|
||||
$header = $this->buildHeaderView($event);
|
||||
$actions = $this->buildActionView($event);
|
||||
|
@ -78,13 +81,19 @@ final class PhabricatorCalendarEventViewController
|
|||
? pht('Add Comment')
|
||||
: pht('Add To Plate');
|
||||
$draft = PhabricatorDraft::newFromUserAndKey($viewer, $event->getPHID());
|
||||
if ($sequence) {
|
||||
$comment_uri = $this->getApplicationURI(
|
||||
'/event/comment/'.$event->getID().'/'.$sequence.'/');
|
||||
} else {
|
||||
$comment_uri = $this->getApplicationURI(
|
||||
'/event/comment/'.$event->getID().'/');
|
||||
}
|
||||
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
|
||||
->setUser($viewer)
|
||||
->setObjectPHID($event->getPHID())
|
||||
->setDraft($draft)
|
||||
->setHeaderText($add_comment_header)
|
||||
->setAction(
|
||||
$this->getApplicationURI('/event/comment/'.$event->getID().'/'))
|
||||
->setAction($comment_uri)
|
||||
->setSubmitButtonName(pht('Add Comment'));
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
|
|
|
@ -256,7 +256,6 @@ abstract class PhabricatorPolicyAwareQuery extends PhabricatorOffsetPagedQuery {
|
|||
}
|
||||
|
||||
if ($visible) {
|
||||
$this->putObjectsInWorkspace($this->getWorkspaceMapForPage($visible));
|
||||
$visible = $this->didFilterPage($visible);
|
||||
}
|
||||
|
||||
|
@ -470,27 +469,6 @@ abstract class PhabricatorPolicyAwareQuery extends PhabricatorOffsetPagedQuery {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a result page to a `<phid, PhabricatorPolicyInterface>` map.
|
||||
*
|
||||
* @param list<PhabricatorPolicyInterface> Objects.
|
||||
* @return map<phid, PhabricatorPolicyInterface> Map of objects which can
|
||||
* be put into the workspace.
|
||||
* @task workspace
|
||||
*/
|
||||
protected function getWorkspaceMapForPage(array $results) {
|
||||
$map = array();
|
||||
foreach ($results as $result) {
|
||||
$phid = $result->getPHID();
|
||||
if ($phid !== null) {
|
||||
$map[$phid] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark PHIDs as in flight.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue