Page MenuHomePhabricator

D12042.diff
No OneTemporary

D12042.diff

diff --git a/src/applications/conpherence/controller/ConpherenceColumnViewController.php b/src/applications/conpherence/controller/ConpherenceColumnViewController.php
--- a/src/applications/conpherence/controller/ConpherenceColumnViewController.php
+++ b/src/applications/conpherence/controller/ConpherenceColumnViewController.php
@@ -25,6 +25,7 @@
}
$conpherence = null;
+ $should_404 = false;
if ($request->getInt('id')) {
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
@@ -32,6 +33,7 @@
->needTransactions(true)
->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT)
->executeOne();
+ $should_404 = true;
} else if ($latest_participant) {
$participant = head($latest_participant);
$conpherence = id(new ConpherenceThreadQuery())
@@ -40,31 +42,44 @@
->needTransactions(true)
->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT)
->executeOne();
+ $should_404 = true;
}
+ $durable_column = id(new ConpherenceDurableColumnView())
+ ->setUser($user)
+ ->setVisible(true);
if (!$conpherence) {
- return new Aphront404Response();
- }
- $this->setConpherence($conpherence);
+ if ($should_404) {
+ return new Aphront404Response();
+ }
- $participant = $conpherence->getParticipant($user->getPHID());
- $transactions = $conpherence->getTransactions();
- $latest_transaction = head($transactions);
- $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
- $participant->markUpToDate($conpherence, $latest_transaction);
- unset($write_guard);
+ $conpherence_id = null;
+ $conpherence_phid = null;
+ $latest_transaction_id = null;
- $durable_column = id(new ConpherenceDurableColumnView())
- ->setUser($user)
- ->setSelectedConpherence($conpherence)
- ->setConpherences($latest_conpherences)
- ->setStyle(null);
+ } else {
+ $this->setConpherence($conpherence);
+
+ $participant = $conpherence->getParticipant($user->getPHID());
+ $transactions = $conpherence->getTransactions();
+ $latest_transaction = head($transactions);
+ $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
+ $participant->markUpToDate($conpherence, $latest_transaction);
+ unset($write_guard);
+
+ $durable_column
+ ->setSelectedConpherence($conpherence)
+ ->setConpherences($latest_conpherences);
+ $conpherence_id = $conpherence->getID();
+ $conpherence_phid = $conpherence->getPHID();
+ $latest_transaction_id = $latest_transaction->getID();
+ }
$response = array(
'content' => hsprintf('%s', $durable_column),
- 'threadID' => $conpherence->getID(),
- 'threadPHID' => $conpherence->getPHID(),
- 'latestTransactionID' => $latest_transaction->getID(),);
+ 'threadID' => $conpherence_id,
+ 'threadPHID' => $conpherence_phid,
+ 'latestTransactionID' => $latest_transaction_id,);
return id(new AphrontAjaxResponse())->setContent($response);
}
diff --git a/src/applications/conpherence/view/ConpherenceDurableColumnView.php b/src/applications/conpherence/view/ConpherenceDurableColumnView.php
--- a/src/applications/conpherence/view/ConpherenceDurableColumnView.php
+++ b/src/applications/conpherence/view/ConpherenceDurableColumnView.php
@@ -193,7 +193,7 @@
if (!$conpherence) {
- $title = pht('Loading...');
+ $title = null;
$settings_button = null;
$settings_menu = null;
@@ -306,7 +306,24 @@
private function buildTransactions() {
$conpherence = $this->getSelectedConpherence();
if (!$conpherence) {
- return pht('Loading...');
+ if (!$this->getVisible()) {
+ return pht('Loading...');
+ }
+ return array(
+ phutil_tag(
+ 'div',
+ array(
+ 'class' => 'mmb',
+ ),
+ pht('You do not have any messages yet.')),
+ javelin_tag(
+ 'a',
+ array(
+ 'href' => '/conpherence/new/',
+ 'class' => 'button grey',
+ 'sigil' => 'workflow',
+ ),
+ pht('Send a Message')),);
}
$data = ConpherenceTransactionView::renderTransactions(
@@ -322,6 +339,10 @@
private function buildTextInput() {
$conpherence = $this->getSelectedConpherence();
+ if (!$conpherence) {
+ return null;
+ }
+
$textarea = javelin_tag(
'textarea',
array(
@@ -330,10 +351,6 @@
'sigil' => 'conpherence-durable-column-textarea',
'placeholder' => pht('Send a message...'),
));
- if (!$conpherence) {
- return $textarea;
- }
-
$id = $conpherence->getID();
return phabricator_form(
$this->getUser(),
@@ -358,6 +375,11 @@
}
private function buildSendButton() {
+ $conpherence = $this->getSelectedConpherence();
+ if (!$conpherence) {
+ return null;
+ }
+
return javelin_tag(
'button',
array(

File Metadata

Mime Type
text/plain
Expires
Mar 12 2025, 6:50 PM (5 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7592161
Default Alt Text
D12042.diff (4 KB)

Event Timeline