1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Conpherence - allow for public rooms to really work

Summary: Fixes T8102. This makes public rooms actually work. Also lets users see the search listings page so they can wander into all public rooms without logging in.

Test Plan: As logged out user, visited ZXX and ZYY. ZXX was public, so I could see it and had a little "Login to Participate" button in the bottom. ZYY was not public so I was prompted to login. Back on ZXX I clicked the Conpherence crumb and got a sensible UI where most links prompted me to login. CLicked "search" and saw listings for all public rooms.

Reviewers: epriestley, chad

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8102

Differential Revision: https://secure.phabricator.com/D12778
This commit is contained in:
Bob Trahan 2015-05-08 14:59:11 -07:00
parent 188c21ae08
commit f309960a2d
10 changed files with 58 additions and 12 deletions

View file

@ -47,7 +47,7 @@ return array(
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
'rsrc/css/application/conpherence/durable-column.css' => '2e68a92f', 'rsrc/css/application/conpherence/durable-column.css' => '2e68a92f',
'rsrc/css/application/conpherence/menu.css' => 'f389e048', 'rsrc/css/application/conpherence/menu.css' => 'f389e048',
'rsrc/css/application/conpherence/message-pane.css' => '3150e2a2', 'rsrc/css/application/conpherence/message-pane.css' => '0e75feef',
'rsrc/css/application/conpherence/notification.css' => 'd208f806', 'rsrc/css/application/conpherence/notification.css' => 'd208f806',
'rsrc/css/application/conpherence/transaction.css' => '885433f0', 'rsrc/css/application/conpherence/transaction.css' => '885433f0',
'rsrc/css/application/conpherence/update.css' => '1099a660', 'rsrc/css/application/conpherence/update.css' => '1099a660',
@ -514,7 +514,7 @@ return array(
'config-welcome-css' => '6abd79be', 'config-welcome-css' => '6abd79be',
'conpherence-durable-column-view' => '2e68a92f', 'conpherence-durable-column-view' => '2e68a92f',
'conpherence-menu-css' => 'f389e048', 'conpherence-menu-css' => 'f389e048',
'conpherence-message-pane-css' => '3150e2a2', 'conpherence-message-pane-css' => '0e75feef',
'conpherence-notification-css' => 'd208f806', 'conpherence-notification-css' => 'd208f806',
'conpherence-thread-manager' => '9e507b59', 'conpherence-thread-manager' => '9e507b59',
'conpherence-transaction-css' => '885433f0', 'conpherence-transaction-css' => '885433f0',

View file

@ -25,6 +25,10 @@ final class ConpherenceListController extends ConpherenceController {
return $mode; return $mode;
} }
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$user = $request->getUser(); $user = $request->getUser();
$title = pht('Conpherence'); $title = pht('Conpherence');

View file

@ -42,9 +42,8 @@ final class ConpherenceNewController extends ConpherenceController {
} }
} }
} else { } else {
$uri = $this->getApplicationURI($conpherence->getID());
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($uri); ->setURI('/'.$conpherence->getMonogram());
} }
} else { } else {
$participant_prefill = $request->getStr('participant'); $participant_prefill = $request->getStr('participant');

View file

@ -36,9 +36,8 @@ final class ConpherenceNewRoomController extends ConpherenceController {
->setActor($user) ->setActor($user)
->applyTransactions($conpherence, $xactions); ->applyTransactions($conpherence, $xactions);
$uri = $this->getApplicationURI($conpherence->getID());
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($uri); ->setURI('/'.$conpherence->getMonogram());
} catch (PhabricatorApplicationTransactionValidationException $ex) { } catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex; $validation_exception = $ex;

View file

@ -2,6 +2,10 @@
final class ConpherenceRoomListController extends ConpherenceController { final class ConpherenceRoomListController extends ConpherenceController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$user = $request->getUser(); $user = $request->getUser();

View file

@ -251,7 +251,7 @@ final class ConpherenceUpdateController
case 'redirect': case 'redirect':
default: default:
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($this->getApplicationURI($conpherence->getID().'/')); ->setURI('/'.$conpherence->getMonogram());
break; break;
} }
} }

View file

@ -5,6 +5,10 @@ final class ConpherenceViewController extends
const OLDER_FETCH_LIMIT = 5; const OLDER_FETCH_LIMIT = 5;
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$user = $request->getUser(); $user = $request->getUser();
@ -138,7 +142,7 @@ final class ConpherenceViewController extends
$conpherence, $conpherence,
PhabricatorPolicyCapability::CAN_JOIN); PhabricatorPolicyCapability::CAN_JOIN);
$participating = $conpherence->getParticipantIfExists($user->getPHID()); $participating = $conpherence->getParticipantIfExists($user->getPHID());
if (!$can_join && !$participating) { if (!$can_join && !$participating && $user->isLoggedIn()) {
return null; return null;
} }
$draft = PhabricatorDraft::newFromUserAndKey( $draft = PhabricatorDraft::newFromUserAndKey(
@ -147,9 +151,20 @@ final class ConpherenceViewController extends
if ($participating) { if ($participating) {
$action = ConpherenceUpdateActions::MESSAGE; $action = ConpherenceUpdateActions::MESSAGE;
$button_text = pht('Send'); $button_text = pht('Send');
} else { } else if ($user->isLoggedIn()) {
$action = ConpherenceUpdateActions::JOIN_ROOM; $action = ConpherenceUpdateActions::JOIN_ROOM;
$button_text = pht('Join'); $button_text = pht('Join');
} else {
// user not logged in so give them a login button.
$login_href = id(new PhutilURI('/auth/start/'))
->setQueryParam('next', '/'.$conpherence->getMonogram());
return id(new PHUIFormLayoutView())
->addClass('login-to-participate')
->appendChild(
id(new PHUIButtonView())
->setTag('a')
->setText(pht('Login to Participate'))
->setHref((string)$login_href));
} }
$update_uri = $this->getApplicationURI('update/'.$conpherence->getID().'/'); $update_uri = $this->getApplicationURI('update/'.$conpherence->getID().'/');
@ -157,10 +172,10 @@ final class ConpherenceViewController extends
$form = $form =
id(new AphrontFormView()) id(new AphrontFormView())
->setUser($user)
->setAction($update_uri) ->setAction($update_uri)
->addSigil('conpherence-pontificate') ->addSigil('conpherence-pontificate')
->setWorkflow(true) ->setWorkflow(true)
->setUser($user)
->addHiddenInput('action', $action) ->addHiddenInput('action', $action)
->appendChild( ->appendChild(
id(new PhabricatorRemarkupControl()) id(new PhabricatorRemarkupControl())

View file

@ -13,6 +13,10 @@ final class ConpherenceWidgetController extends ConpherenceController {
return $this->userPreferences; return $this->userPreferences;
} }
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest(); $request = $this->getRequest();
$user = $request->getUser(); $user = $request->getUser();
@ -26,6 +30,9 @@ final class ConpherenceWidgetController extends ConpherenceController {
->withIDs(array($conpherence_id)) ->withIDs(array($conpherence_id))
->needWidgetData(true) ->needWidgetData(true)
->executeOne(); ->executeOne();
if (!$conpherence) {
return new Aphront404Response();
}
$this->setConpherence($conpherence); $this->setConpherence($conpherence);
$this->setUserPreferences($user->loadPreferences()); $this->setUserPreferences($user->loadPreferences());
@ -138,8 +145,11 @@ final class ConpherenceWidgetController extends ConpherenceController {
PhabricatorPolicyCapability::CAN_JOIN); PhabricatorPolicyCapability::CAN_JOIN);
if ($can_join) { if ($can_join) {
$text = pht('Settings are available after joining the room.'); $text = pht('Settings are available after joining the room.');
} else { } else if ($viewer->isLoggedIn()) {
$text = pht('Settings not applicable to rooms you can not join.'); $text = pht('Settings not applicable to rooms you can not join.');
} else {
$text = pht(
'Settings are available after logging in and joining the room.');
} }
return phutil_tag( return phutil_tag(
'div', 'div',

View file

@ -7,6 +7,7 @@
*/ */
final class PHUIFormLayoutView extends AphrontView { final class PHUIFormLayoutView extends AphrontView {
private $classes = array();
private $fullWidth; private $fullWidth;
public function setFullWidth($width) { public function setFullWidth($width) {
@ -14,6 +15,11 @@ final class PHUIFormLayoutView extends AphrontView {
return $this; return $this;
} }
public function addClass($class) {
$this->classes[] = $class;
return $this;
}
public function appendInstructions($text) { public function appendInstructions($text) {
return $this->appendChild( return $this->appendChild(
phutil_tag( phutil_tag(
@ -38,7 +44,8 @@ final class PHUIFormLayoutView extends AphrontView {
} }
public function render() { public function render() {
$classes = array('phui-form-view'); $classes = $this->classes;
$classes[] = 'phui-form-view';
if ($this->fullWidth) { if ($this->fullWidth) {
$classes[] = 'phui-form-full-width'; $classes[] = 'phui-form-full-width';

View file

@ -113,6 +113,14 @@
right: 241px; right: 241px;
} }
.conpherence-message-pane .phui-form-view.login-to-participate {
height: 28px;
}
.conpherence-message-pane .login-to-participate a.button {
float: right;
}
.conpherence-message-pane .aphront-form-control-submit button, .conpherence-message-pane .aphront-form-control-submit button,
.conpherence-message-pane .aphront-form-control-submit a.button { .conpherence-message-pane .aphront-form-control-submit a.button {
margin-top: 6px; margin-top: 6px;