@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Clean up some Ponder language

Summary:
Ref T9099.

- Remove unused function
- Fix celerity resource include
- Add a note when an answer's been closed
- Clean up architecture a little
- Add a better notice when you've already answered.

Test Plan: Test with and without answers, with answering, with being closed.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9099

Differential Revision: https://secure.phabricator.com/D13875

+35 -60
+1 -1
src/applications/ponder/constants/PonderQuestionStatus.php
··· 41 41 self::STATUS_OPEN => 42 42 pht('This question is open for answers.'), 43 43 self::STATUS_CLOSED_RESOLVED => 44 - pht('This question has been resolved.'), 44 + pht('This question has been answered or resolved.'), 45 45 self::STATUS_CLOSED_OBSOLETE => 46 46 pht('This question is no longer valid or out of date.'), 47 47 self::STATUS_CLOSED_DUPLICATE =>
+4 -58
src/applications/ponder/controller/PonderQuestionViewController.php
··· 18 18 19 19 $answers = $this->buildAnswers($question->getAnswers()); 20 20 21 - $authors = mpull($question->getAnswers(), null, 'getAuthorPHID'); 22 - if (isset($authors[$viewer->getPHID()])) { 23 - $answer_add_panel = id(new PHUIInfoView()) 24 - ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) 25 - ->appendChild( 26 - pht( 27 - 'You have already answered this question. You can not answer '. 28 - 'twice, but you can edit your existing answer.')); 29 - } else { 30 - $answer_add_panel = new PonderAddAnswerView(); 31 - $answer_add_panel 32 - ->setQuestion($question) 33 - ->setUser($viewer) 34 - ->setActionURI('/ponder/answer/add/'); 35 - } 21 + $answer_add_panel = id(new PonderAddAnswerView()) 22 + ->setQuestion($question) 23 + ->setUser($viewer) 24 + ->setActionURI('/ponder/answer/add/'); 36 25 37 26 $header = new PHUIHeaderView(); 38 27 $header->setHeader($question->getTitle()); ··· 243 232 } 244 233 245 234 return $view; 246 - } 247 - 248 - private function wrapComments($n, $stuff) { 249 - if ($n == 0) { 250 - $text = pht('Add a Comment'); 251 - } else { 252 - $text = pht('Show %s Comments', new PhutilNumber($n)); 253 - } 254 - 255 - $show_id = celerity_generate_unique_node_id(); 256 - $hide_id = celerity_generate_unique_node_id(); 257 - 258 - Javelin::initBehavior('phabricator-reveal-content'); 259 - require_celerity_resource('ponder-view-css'); 260 - 261 - $show = phutil_tag( 262 - 'div', 263 - array( 264 - 'id' => $show_id, 265 - 'class' => 'ponder-show-comments', 266 - ), 267 - javelin_tag( 268 - 'a', 269 - array( 270 - 'href' => '#', 271 - 'sigil' => 'reveal-content', 272 - 'meta' => array( 273 - 'showIDs' => array($hide_id), 274 - 'hideIDs' => array($show_id), 275 - ), 276 - ), 277 - $text)); 278 - 279 - $hide = phutil_tag( 280 - 'div', 281 - array( 282 - 'class' => 'ponder-comments-view', 283 - 'id' => $hide_id, 284 - 'style' => 'display: none', 285 - ), 286 - $stuff); 287 - 288 - return array($show, $hide); 289 235 } 290 236 291 237 private function buildSidebar(PonderQuestion $question) {
+29 -1
src/applications/ponder/view/PonderAddAnswerView.php
··· 18 18 19 19 public function render() { 20 20 $question = $this->question; 21 + $viewer = $this->user; 22 + 23 + $authors = mpull($question->getAnswers(), null, 'getAuthorPHID'); 24 + if (isset($authors[$viewer->getPHID()])) { 25 + return id(new PHUIInfoView()) 26 + ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) 27 + ->setTitle(pht('Already Answered')) 28 + ->appendChild( 29 + pht( 30 + 'You have already answered this question. You can not answer '. 31 + 'twice, but you can edit your existing answer.')); 32 + } 33 + 34 + $info_panel = null; 35 + if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) { 36 + $info_panel = id(new PHUIInfoView()) 37 + ->setSeverity(PHUIInfoView::SEVERITY_WARNING) 38 + ->appendChild( 39 + pht( 40 + 'This question has been marked as closed, 41 + but you can still leave a new answer.')); 42 + } 21 43 22 44 $header = id(new PHUIHeaderView()) 23 45 ->setHeader(pht('Add Answer')); ··· 39 61 id(new AphrontFormSubmitControl()) 40 62 ->setValue(pht('Add Answer'))); 41 63 42 - return id(new PHUIObjectBoxView()) 64 + $box = id(new PHUIObjectBoxView()) 43 65 ->setHeader($header) 44 66 ->appendChild($form); 67 + 68 + if ($info_panel) { 69 + $box->setInfoView($info_panel); 70 + } 71 + 72 + return $box; 45 73 } 46 74 }
+1
src/applications/ponder/view/PonderFooterView.php
··· 28 28 } 29 29 30 30 protected function getTagContent() { 31 + require_celerity_resource('ponder-view-css'); 31 32 Javelin::initBehavior('phabricator-reveal-content'); 32 33 33 34 $hide_action_id = celerity_generate_unique_node_id();