Skip to content

Commit f309960

Browse files
committed
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
1 parent 188c21a commit f309960

File tree

10 files changed

+58
-12
lines changed

10 files changed

+58
-12
lines changed

resources/celerity/map.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
4848
'rsrc/css/application/conpherence/durable-column.css' => '2e68a92f',
4949
'rsrc/css/application/conpherence/menu.css' => 'f389e048',
50-
'rsrc/css/application/conpherence/message-pane.css' => '3150e2a2',
50+
'rsrc/css/application/conpherence/message-pane.css' => '0e75feef',
5151
'rsrc/css/application/conpherence/notification.css' => 'd208f806',
5252
'rsrc/css/application/conpherence/transaction.css' => '885433f0',
5353
'rsrc/css/application/conpherence/update.css' => '1099a660',
@@ -514,7 +514,7 @@
514514
'config-welcome-css' => '6abd79be',
515515
'conpherence-durable-column-view' => '2e68a92f',
516516
'conpherence-menu-css' => 'f389e048',
517-
'conpherence-message-pane-css' => '3150e2a2',
517+
'conpherence-message-pane-css' => '0e75feef',
518518
'conpherence-notification-css' => 'd208f806',
519519
'conpherence-thread-manager' => '9e507b59',
520520
'conpherence-transaction-css' => '885433f0',

src/applications/conpherence/controller/ConpherenceListController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ private function determineMode() {
2525
return $mode;
2626
}
2727

28+
public function shouldAllowPublic() {
29+
return true;
30+
}
31+
2832
public function handleRequest(AphrontRequest $request) {
2933
$user = $request->getUser();
3034
$title = pht('Conpherence');

src/applications/conpherence/controller/ConpherenceNewController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ public function handleRequest(AphrontRequest $request) {
4242
}
4343
}
4444
} else {
45-
$uri = $this->getApplicationURI($conpherence->getID());
4645
return id(new AphrontRedirectResponse())
47-
->setURI($uri);
46+
->setURI('/'.$conpherence->getMonogram());
4847
}
4948
} else {
5049
$participant_prefill = $request->getStr('participant');

src/applications/conpherence/controller/ConpherenceNewRoomController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ public function handleRequest(AphrontRequest $request) {
3636
->setActor($user)
3737
->applyTransactions($conpherence, $xactions);
3838

39-
$uri = $this->getApplicationURI($conpherence->getID());
4039
return id(new AphrontRedirectResponse())
41-
->setURI($uri);
40+
->setURI('/'.$conpherence->getMonogram());
4241
} catch (PhabricatorApplicationTransactionValidationException $ex) {
4342
$validation_exception = $ex;
4443

src/applications/conpherence/controller/ConpherenceRoomListController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
final class ConpherenceRoomListController extends ConpherenceController {
44

5+
public function shouldAllowPublic() {
6+
return true;
7+
}
8+
59
public function handleRequest(AphrontRequest $request) {
610
$user = $request->getUser();
711

src/applications/conpherence/controller/ConpherenceUpdateController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public function handleRequest(AphrontRequest $request) {
251251
case 'redirect':
252252
default:
253253
return id(new AphrontRedirectResponse())
254-
->setURI($this->getApplicationURI($conpherence->getID().'/'));
254+
->setURI('/'.$conpherence->getMonogram());
255255
break;
256256
}
257257
}

src/applications/conpherence/controller/ConpherenceViewController.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ final class ConpherenceViewController extends
55

66
const OLDER_FETCH_LIMIT = 5;
77

8+
public function shouldAllowPublic() {
9+
return true;
10+
}
11+
812
public function handleRequest(AphrontRequest $request) {
913
$user = $request->getUser();
1014

@@ -138,7 +142,7 @@ private function renderFormContent() {
138142
$conpherence,
139143
PhabricatorPolicyCapability::CAN_JOIN);
140144
$participating = $conpherence->getParticipantIfExists($user->getPHID());
141-
if (!$can_join && !$participating) {
145+
if (!$can_join && !$participating && $user->isLoggedIn()) {
142146
return null;
143147
}
144148
$draft = PhabricatorDraft::newFromUserAndKey(
@@ -147,20 +151,31 @@ private function renderFormContent() {
147151
if ($participating) {
148152
$action = ConpherenceUpdateActions::MESSAGE;
149153
$button_text = pht('Send');
150-
} else {
154+
} else if ($user->isLoggedIn()) {
151155
$action = ConpherenceUpdateActions::JOIN_ROOM;
152156
$button_text = pht('Join');
157+
} else {
158+
// user not logged in so give them a login button.
159+
$login_href = id(new PhutilURI('/auth/start/'))
160+
->setQueryParam('next', '/'.$conpherence->getMonogram());
161+
return id(new PHUIFormLayoutView())
162+
->addClass('login-to-participate')
163+
->appendChild(
164+
id(new PHUIButtonView())
165+
->setTag('a')
166+
->setText(pht('Login to Participate'))
167+
->setHref((string)$login_href));
153168
}
154169
$update_uri = $this->getApplicationURI('update/'.$conpherence->getID().'/');
155170

156171
$this->initBehavior('conpherence-pontificate');
157172

158173
$form =
159174
id(new AphrontFormView())
175+
->setUser($user)
160176
->setAction($update_uri)
161177
->addSigil('conpherence-pontificate')
162178
->setWorkflow(true)
163-
->setUser($user)
164179
->addHiddenInput('action', $action)
165180
->appendChild(
166181
id(new PhabricatorRemarkupControl())

src/applications/conpherence/controller/ConpherenceWidgetController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ public function getUserPreferences() {
1313
return $this->userPreferences;
1414
}
1515

16+
public function shouldAllowPublic() {
17+
return true;
18+
}
19+
1620
public function handleRequest(AphrontRequest $request) {
1721
$request = $this->getRequest();
1822
$user = $request->getUser();
@@ -26,6 +30,9 @@ public function handleRequest(AphrontRequest $request) {
2630
->withIDs(array($conpherence_id))
2731
->needWidgetData(true)
2832
->executeOne();
33+
if (!$conpherence) {
34+
return new Aphront404Response();
35+
}
2936
$this->setConpherence($conpherence);
3037

3138
$this->setUserPreferences($user->loadPreferences());
@@ -138,8 +145,11 @@ private function renderSettingsWidgetPaneContent() {
138145
PhabricatorPolicyCapability::CAN_JOIN);
139146
if ($can_join) {
140147
$text = pht('Settings are available after joining the room.');
141-
} else {
148+
} else if ($viewer->isLoggedIn()) {
142149
$text = pht('Settings not applicable to rooms you can not join.');
150+
} else {
151+
$text = pht(
152+
'Settings are available after logging in and joining the room.');
143153
}
144154
return phutil_tag(
145155
'div',

src/view/form/PHUIFormLayoutView.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
*/
88
final class PHUIFormLayoutView extends AphrontView {
99

10+
private $classes = array();
1011
private $fullWidth;
1112

1213
public function setFullWidth($width) {
1314
$this->fullWidth = $width;
1415
return $this;
1516
}
1617

18+
public function addClass($class) {
19+
$this->classes[] = $class;
20+
return $this;
21+
}
22+
1723
public function appendInstructions($text) {
1824
return $this->appendChild(
1925
phutil_tag(
@@ -38,7 +44,8 @@ public function appendRemarkupInstructions($remarkup) {
3844
}
3945

4046
public function render() {
41-
$classes = array('phui-form-view');
47+
$classes = $this->classes;
48+
$classes[] = 'phui-form-view';
4249

4350
if ($this->fullWidth) {
4451
$classes[] = 'phui-form-full-width';

webroot/rsrc/css/application/conpherence/message-pane.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@
113113
right: 241px;
114114
}
115115

116+
.conpherence-message-pane .phui-form-view.login-to-participate {
117+
height: 28px;
118+
}
119+
120+
.conpherence-message-pane .login-to-participate a.button {
121+
float: right;
122+
}
123+
116124
.conpherence-message-pane .aphront-form-control-submit button,
117125
.conpherence-message-pane .aphront-form-control-submit a.button {
118126
margin-top: 6px;

0 commit comments

Comments
 (0)