getRequest(); if (!$request->isFormPost()) { return new Aphront400Response(); } $revision_id = $request->getInt('revision_id'); $revision = id(new DifferentialRevision())->load($revision_id); if (!$revision) { return new Aphront400Response(); } $comment = $request->getStr('comment'); $action = $request->getStr('action'); $reviewers = $request->getArr('reviewers'); $ccs = $request->getArr('ccs'); $editor = new DifferentialCommentEditor( $revision, $request->getUser()->getPHID(), $action); $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_WEB, array( 'ip' => $request->getRemoteAddr(), )); $editor ->setMessage($comment) ->setContentSource($content_source) ->setAttachInlineComments(true) ->setAddCC($action != DifferentialAction::ACTION_RESIGN) ->setAddedReviewers($reviewers) ->setAddedCCs($ccs) ->save(); // TODO: Diff change detection? $draft = id(new PhabricatorDraft())->loadOneWhere( 'authorPHID = %s AND draftKey = %s', $request->getUser()->getPHID(), 'differential-comment-'.$revision->getID()); if ($draft) { $draft->delete(); } return id(new AphrontRedirectResponse()) ->setURI('/D'.$revision->getID()); } }