mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +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() {
|
public function processRequest() {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
$before = $request->getStr('before');
|
$before = $request->getStr('before');
|
||||||
if ($before) {
|
if ($before) {
|
||||||
|
@ -17,7 +18,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
||||||
|
|
||||||
$path = $drequest->getPath();
|
$path = $drequest->getPath();
|
||||||
|
|
||||||
$preferences = $request->getUser()->loadPreferences();
|
$preferences = $viewer->loadPreferences();
|
||||||
|
|
||||||
$show_blame = $request->getBool(
|
$show_blame = $request->getBool(
|
||||||
'blame',
|
'blame',
|
||||||
|
@ -31,7 +32,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
||||||
true));
|
true));
|
||||||
|
|
||||||
$view = $request->getStr('view');
|
$view = $request->getStr('view');
|
||||||
if ($request->isFormPost() && $view != 'raw') {
|
if ($request->isFormPost() && $view != 'raw' && $viewer->isLoggedIn()) {
|
||||||
$preferences->setPreference(
|
$preferences->setPreference(
|
||||||
PhabricatorUserPreferences::PREFERENCE_DIFFUSION_BLAME,
|
PhabricatorUserPreferences::PREFERENCE_DIFFUSION_BLAME,
|
||||||
$show_blame);
|
$show_blame);
|
||||||
|
@ -354,7 +355,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
||||||
->setHref($base_uri->alter('blame', $blame_value))
|
->setHref($base_uri->alter('blame', $blame_value))
|
||||||
->setIcon($blame_icon)
|
->setIcon($blame_icon)
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setRenderAsForm(true));
|
->setRenderAsForm($viewer->isLoggedIn()));
|
||||||
|
|
||||||
if ($show_color) {
|
if ($show_color) {
|
||||||
$highlight_text = pht('Disable Highlighting');
|
$highlight_text = pht('Disable Highlighting');
|
||||||
|
@ -372,7 +373,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
||||||
->setHref($base_uri->alter('color', $highlight_value))
|
->setHref($base_uri->alter('color', $highlight_value))
|
||||||
->setIcon($highlight_icon)
|
->setIcon($highlight_icon)
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setRenderAsForm(true));
|
->setRenderAsForm($viewer->isLoggedIn()));
|
||||||
|
|
||||||
$href = null;
|
$href = null;
|
||||||
if ($this->getRequest()->getStr('lint') !== null) {
|
if ($this->getRequest()->getStr('lint') !== null) {
|
||||||
|
|
Loading…
Reference in a new issue