1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 20:10:55 +01:00

Show "Login to Answer" in Ponder if viewer is logged out

Summary: Fixes T9278. Logged out viewers shouldn't see a form field to answer, just a login button.

Test Plan: Log out, go to question, click Login to Answer, login, get redirected back.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9278

Differential Revision: https://secure.phabricator.com/D14012
This commit is contained in:
Chad Little 2015-08-31 09:14:11 -07:00
parent bcc5e55af2
commit 506168c307

View file

@ -90,6 +90,18 @@ final class PonderAddAnswerView extends AphrontView {
id(new AphrontFormSubmitControl())
->setValue(pht('Add Answer')));
if (!$viewer->isLoggedIn()) {
$login_href = id(new PhutilURI('/auth/start/'))
->setQueryParam('next', '/Q'.$question->getID());
$form = id(new PHUIFormLayoutView())
->addClass('login-to-participate')
->appendChild(
id(new PHUIButtonView())
->setTag('a')
->setText(pht('Login to Answer'))
->setHref((string)$login_href));
}
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->appendChild($form);