@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.

Conpherence - add support for users with no conpherences in durable column view

Summary: Ref T7014. This just makes it so there's almost no UI and a simple "You have no messages. <button>Send a message.</button>" UI

Test Plan: hacked the code such that should_404 and conpherence were false and null respectively. verified i got the right ui in the durable column. verified send a message button worked, ending up with me in main conpherence view on the right message

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7014

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

+60 -23
+32 -17
src/applications/conpherence/controller/ConpherenceColumnViewController.php
··· 25 25 } 26 26 27 27 $conpherence = null; 28 + $should_404 = false; 28 29 if ($request->getInt('id')) { 29 30 $conpherence = id(new ConpherenceThreadQuery()) 30 31 ->setViewer($user) ··· 32 33 ->needTransactions(true) 33 34 ->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT) 34 35 ->executeOne(); 36 + $should_404 = true; 35 37 } else if ($latest_participant) { 36 38 $participant = head($latest_participant); 37 39 $conpherence = id(new ConpherenceThreadQuery()) ··· 40 42 ->needTransactions(true) 41 43 ->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT) 42 44 ->executeOne(); 45 + $should_404 = true; 43 46 } 44 47 48 + $durable_column = id(new ConpherenceDurableColumnView()) 49 + ->setUser($user) 50 + ->setVisible(true); 45 51 if (!$conpherence) { 46 - return new Aphront404Response(); 47 - } 48 - $this->setConpherence($conpherence); 52 + if ($should_404) { 53 + return new Aphront404Response(); 54 + } 55 + 56 + $conpherence_id = null; 57 + $conpherence_phid = null; 58 + $latest_transaction_id = null; 59 + 60 + } else { 61 + $this->setConpherence($conpherence); 49 62 50 - $participant = $conpherence->getParticipant($user->getPHID()); 51 - $transactions = $conpherence->getTransactions(); 52 - $latest_transaction = head($transactions); 53 - $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites(); 54 - $participant->markUpToDate($conpherence, $latest_transaction); 55 - unset($write_guard); 63 + $participant = $conpherence->getParticipant($user->getPHID()); 64 + $transactions = $conpherence->getTransactions(); 65 + $latest_transaction = head($transactions); 66 + $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites(); 67 + $participant->markUpToDate($conpherence, $latest_transaction); 68 + unset($write_guard); 56 69 57 - $durable_column = id(new ConpherenceDurableColumnView()) 58 - ->setUser($user) 59 - ->setSelectedConpherence($conpherence) 60 - ->setConpherences($latest_conpherences) 61 - ->setStyle(null); 70 + $durable_column 71 + ->setSelectedConpherence($conpherence) 72 + ->setConpherences($latest_conpherences); 73 + $conpherence_id = $conpherence->getID(); 74 + $conpherence_phid = $conpherence->getPHID(); 75 + $latest_transaction_id = $latest_transaction->getID(); 76 + } 62 77 63 78 $response = array( 64 79 'content' => hsprintf('%s', $durable_column), 65 - 'threadID' => $conpherence->getID(), 66 - 'threadPHID' => $conpherence->getPHID(), 67 - 'latestTransactionID' => $latest_transaction->getID(),); 80 + 'threadID' => $conpherence_id, 81 + 'threadPHID' => $conpherence_phid, 82 + 'latestTransactionID' => $latest_transaction_id,); 68 83 69 84 return id(new AphrontAjaxResponse())->setContent($response); 70 85 }
+28 -6
src/applications/conpherence/view/ConpherenceDurableColumnView.php
··· 193 193 194 194 if (!$conpherence) { 195 195 196 - $title = pht('Loading...'); 196 + $title = null; 197 197 $settings_button = null; 198 198 $settings_menu = null; 199 199 ··· 306 306 private function buildTransactions() { 307 307 $conpherence = $this->getSelectedConpherence(); 308 308 if (!$conpherence) { 309 - return pht('Loading...'); 309 + if (!$this->getVisible()) { 310 + return pht('Loading...'); 311 + } 312 + return array( 313 + phutil_tag( 314 + 'div', 315 + array( 316 + 'class' => 'mmb', 317 + ), 318 + pht('You do not have any messages yet.')), 319 + javelin_tag( 320 + 'a', 321 + array( 322 + 'href' => '/conpherence/new/', 323 + 'class' => 'button grey', 324 + 'sigil' => 'workflow', 325 + ), 326 + pht('Send a Message')),); 310 327 } 311 328 312 329 $data = ConpherenceTransactionView::renderTransactions( ··· 322 339 323 340 private function buildTextInput() { 324 341 $conpherence = $this->getSelectedConpherence(); 342 + if (!$conpherence) { 343 + return null; 344 + } 345 + 325 346 $textarea = javelin_tag( 326 347 'textarea', 327 348 array( ··· 330 351 'sigil' => 'conpherence-durable-column-textarea', 331 352 'placeholder' => pht('Send a message...'), 332 353 )); 333 - if (!$conpherence) { 334 - return $textarea; 335 - } 336 - 337 354 $id = $conpherence->getID(); 338 355 return phabricator_form( 339 356 $this->getUser(), ··· 358 375 } 359 376 360 377 private function buildSendButton() { 378 + $conpherence = $this->getSelectedConpherence(); 379 + if (!$conpherence) { 380 + return null; 381 + } 382 + 361 383 return javelin_tag( 362 384 'button', 363 385 array(