From 42d7b5330e38d35eaeb6e63a09a78ec375703517 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+github@gmail.com>
Date: Thu, 14 Oct 2021 08:49:17 +0200
Subject: [PATCH] fix consultation navigation handling, fixes #288

---
 app/controllers/consultation/consultation_controller.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/controllers/consultation/consultation_controller.php b/app/controllers/consultation/consultation_controller.php
index 5d3f20ab0b9..c69ab16584b 100644
--- a/app/controllers/consultation/consultation_controller.php
+++ b/app/controllers/consultation/consultation_controller.php
@@ -12,7 +12,13 @@ abstract class ConsultationController extends AuthenticatedController
     {
         parent::before_filter($action, $args);
 
-        $this->range = Context::get() ?: User::findByUsername(Request::username('username', $GLOBALS['user']->username));
+        if (Request::submitted('username')) {
+            $this->range = User::findByUsername(Request::username('username'));
+        } elseif (Request::submitted('cid')) {
+            $this->range = Context::get();
+        } else {
+            $this->range = $GLOBALS['user']->getAuthenticatedUser();
+        }
 
         if ($this->range instanceof User) {
             URLHelper::addLinkParam('username', $this->range->username);
-- 
GitLab