From 506168c3073c283a6c54813a37849ac32153e555 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 31 Aug 2015 09:14:11 -0700 Subject: [PATCH] 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 --- src/applications/ponder/view/PonderAddAnswerView.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/applications/ponder/view/PonderAddAnswerView.php b/src/applications/ponder/view/PonderAddAnswerView.php index 5d3be0460d..0c2e013051 100644 --- a/src/applications/ponder/view/PonderAddAnswerView.php +++ b/src/applications/ponder/view/PonderAddAnswerView.php @@ -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);