mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-25 10:40:16 +01:00
Hide answer box if you asked the question in Ponder
Summary: Fixes T9241. Users have a tendancy to assume Ponder is a "forum", make replying to your own question take an additional click. Test Plan: View my own question, see notice, click open answer box, reply. Visit not my question, see box as normal. {F743412} Reviewers: epriestley Reviewed By: epriestley Subscribers: cspeckmim, Korvin Maniphest Tasks: T9241 Differential Revision: https://secure.phabricator.com/D13957
This commit is contained in:
parent
4b1815d6cc
commit
1edc64c869
1 changed files with 40 additions and 2 deletions
|
@ -34,13 +34,42 @@ final class PonderAddAnswerView extends AphrontView {
|
|||
$info_panel = null;
|
||||
if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) {
|
||||
$info_panel = id(new PHUIInfoView())
|
||||
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
||||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
||||
->appendChild(
|
||||
pht(
|
||||
'This question has been marked as closed,
|
||||
but you can still leave a new answer.'));
|
||||
}
|
||||
|
||||
$box_style = null;
|
||||
$own_question = null;
|
||||
$hide_action_id = celerity_generate_unique_node_id();
|
||||
$show_action_id = celerity_generate_unique_node_id();
|
||||
if ($question->getAuthorPHID() == $viewer->getPHID()) {
|
||||
$box_style = 'display: none;';
|
||||
$open_link = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'sigil' => 'reveal-content',
|
||||
'class' => 'mml',
|
||||
'id' => $hide_action_id,
|
||||
'href' => '#',
|
||||
'meta' => array(
|
||||
'showIDs' => array($show_action_id),
|
||||
'hideIDs' => array($hide_action_id),
|
||||
),
|
||||
),
|
||||
pht('Add an answer.'));
|
||||
$own_question = id(new PHUIInfoView())
|
||||
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
||||
->setID($hide_action_id)
|
||||
->appendChild(
|
||||
pht(
|
||||
'This is your own question. You are welcome to provide
|
||||
an answer if you have found a resolution.'))
|
||||
->appendChild($open_link);
|
||||
}
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Add Answer'));
|
||||
|
||||
|
@ -69,6 +98,15 @@ final class PonderAddAnswerView extends AphrontView {
|
|||
$box->setInfoView($info_panel);
|
||||
}
|
||||
|
||||
return $box;
|
||||
$box = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'style' => $box_style,
|
||||
'class' => 'mlt',
|
||||
'id' => $show_action_id,
|
||||
),
|
||||
$box);
|
||||
|
||||
return array($own_question, $box);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue