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

Fix an issue with `darkconsole.always-on` and logged-out users

Summary:
Fixes T3796. When this got split out into tabs, the data endpoints were accidentally locked down. Open them up again if the setting is on.

Also, when you open/close the console we try to save the preference. Just no-op if you're logged out. Previously, you'd see the requests in DarkConsole since they failed.

Test Plan: Enabled `darkconsole.always-on` and toggled the console on and off as a logged-out user. Disabled the preference and verified it was no longer accessible.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3796

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

+15 -2
+11 -2
src/aphront/console/DarkConsoleController.php
··· 8 8 protected $op; 9 9 protected $data; 10 10 11 + public function shouldRequireLogin() { 12 + return !PhabricatorEnv::getEnvConfig('darkconsole.always-on'); 13 + } 14 + 11 15 public function processRequest() { 12 16 $request = $this->getRequest(); 13 17 $user = $request->getUser(); 18 + $response = id(new AphrontAjaxResponse())->setDisableConsole(true); 19 + 20 + if (!$user->isLoggedIn()) { 21 + return $response; 22 + } 14 23 15 24 $visible = $request->getStr('visible'); 16 25 if (strlen($visible)) { 17 26 $user->setConsoleVisible((int)$visible); 18 27 $user->save(); 19 - return id(new AphrontAjaxResponse())->setDisableConsole(true); 28 + return $response; 20 29 } 21 30 22 31 $tab = $request->getStr('tab'); 23 32 if (strlen($tab)) { 24 33 $user->setConsoleTab($tab); 25 34 $user->save(); 26 - return id(new AphrontAjaxResponse())->setDisableConsole(true); 35 + return $response; 27 36 } 28 37 29 38 return new Aphront404Response();
+4
src/aphront/console/DarkConsoleDataController.php
··· 7 7 8 8 private $key; 9 9 10 + public function shouldRequireLogin() { 11 + return !PhabricatorEnv::getEnvConfig('darkconsole.always-on'); 12 + } 13 + 10 14 public function willProcessRequest(array $data) { 11 15 $this->key = $data['key']; 12 16 }