make applicationTransactionsCommentView have a "Login to comment." button if user is not logged in

Summary: okay title. other apps can get this by implementing shouldAllowPublic and set(ting)RequestURI on TransactionsCommentView. note i put some css inline -- let me know if that belongs someplace else or needs better design.

Test Plan: viewed a mock logged out and saw new button. used new button and ended up on the mock logged in with a clean URI.

Reviewers: epriestley, chad

Reviewed By: chad

CC: aran, Korvin

Maniphest Tasks: T2653

Differential Revision: https://secure.phabricator.com/D5266
This commit is contained in:
Bob Trahan
2013-03-07 13:02:36 -08:00
parent e6c73a8396
commit e3181fcbe7
6 changed files with 75 additions and 13 deletions

View File

@@ -8,6 +8,10 @@ final class PholioMockViewController extends PholioController {
private $id;
private $imageID;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
$this->id = $data['id'];
$this->imageID = idx($data, 'imageID');
@@ -67,9 +71,11 @@ final class PholioMockViewController extends PholioController {
require_celerity_resource('pholio-css');
require_celerity_resource('pholio-inline-comments-css');
$output = new PholioMockImagesView();
$output->setMock($mock);
$output->setImageID($this->imageID);
$output = id(new PholioMockImagesView())
->setRequestURI($request->getRequestURI())
->setUser($user)
->setMock($mock)
->setImageID($this->imageID);
$xaction_view = id(new PhabricatorApplicationTransactionView())
->setUser($this->getRequest()->getUser())
@@ -201,7 +207,8 @@ final class PholioMockViewController extends PholioController {
->setUser($user)
->setDraft($draft)
->setSubmitButtonName($button_name)
->setAction($this->getApplicationURI('/comment/'.$mock->getID().'/'));
->setAction($this->getApplicationURI('/comment/'.$mock->getID().'/'))
->setRequestURI($this->getRequest()->getRequestURI());
return array(
$header,