mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +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:
parent
bcc5e55af2
commit
506168c307
1 changed files with 12 additions and 0 deletions
|
@ -90,6 +90,18 @@ final class PonderAddAnswerView extends AphrontView {
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->setValue(pht('Add Answer')));
|
->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())
|
$box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->appendChild($form);
|
->appendChild($form);
|
||||||
|
|
Loading…
Reference in a new issue