mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Fix Diffusion blame/highlight for logged-out users
Summary: Fixes T5199. We try to save these options in user preferences, but logged-out users don't have preferences. Instead, just use GET links for logged-out users. Test Plan: - As a logged-out user, toggled blame and highlight on and off. - As a logged-in user, toggled blame and highlight on and off. Reviewers: btrahan, vrana Reviewed By: vrana Subscribers: epriestley Maniphest Tasks: T5199 Differential Revision: https://secure.phabricator.com/D9310
This commit is contained in:
parent
71d2b0868b
commit
2aef04a78a
1 changed files with 5 additions and 4 deletions
|
@ -9,6 +9,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
|||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$viewer = $request->getUser();
|
||||
|
||||
$before = $request->getStr('before');
|
||||
if ($before) {
|
||||
|
@ -17,7 +18,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
|||
|
||||
$path = $drequest->getPath();
|
||||
|
||||
$preferences = $request->getUser()->loadPreferences();
|
||||
$preferences = $viewer->loadPreferences();
|
||||
|
||||
$show_blame = $request->getBool(
|
||||
'blame',
|
||||
|
@ -31,7 +32,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
|||
true));
|
||||
|
||||
$view = $request->getStr('view');
|
||||
if ($request->isFormPost() && $view != 'raw') {
|
||||
if ($request->isFormPost() && $view != 'raw' && $viewer->isLoggedIn()) {
|
||||
$preferences->setPreference(
|
||||
PhabricatorUserPreferences::PREFERENCE_DIFFUSION_BLAME,
|
||||
$show_blame);
|
||||
|
@ -354,7 +355,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
|||
->setHref($base_uri->alter('blame', $blame_value))
|
||||
->setIcon($blame_icon)
|
||||
->setUser($viewer)
|
||||
->setRenderAsForm(true));
|
||||
->setRenderAsForm($viewer->isLoggedIn()));
|
||||
|
||||
if ($show_color) {
|
||||
$highlight_text = pht('Disable Highlighting');
|
||||
|
@ -372,7 +373,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
|||
->setHref($base_uri->alter('color', $highlight_value))
|
||||
->setIcon($highlight_icon)
|
||||
->setUser($viewer)
|
||||
->setRenderAsForm(true));
|
||||
->setRenderAsForm($viewer->isLoggedIn()));
|
||||
|
||||
$href = null;
|
||||
if ($this->getRequest()->getStr('lint') !== null) {
|
||||
|
|
Loading…
Reference in a new issue