Closed (fixed)
Project:
Burndown
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
14 Jul 2026 at 18:35 UTC
Updated:
23 Jul 2026 at 20:14 UTC
Jump to comment: Most recent
When you edit a Task, there is a link that says "Watch this task" but clicking it does not seem to do anything. Going to the api endpoint it is calling results in this error
The website encountered an unexpected error. Try again later.
Error: Using $this when not in object context in Drupal\burndown\Controller\TaskController::addToWatchlist() (line 293 of modules/contrib/burndown/src/Controller/TaskController.php).
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}() (Line: 634)
Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jeremylichtman commentedThe offending code (also pertains to https://www.drupal.org/project/burndown/issues/3610984) is in TaskController around line 286:
Firstly, I have no idea why $this is present. We need to load the current user properly, and test whether it is the same user as the id being added to the watchlist.
Secondly, we probably need to add a role for whether somebody can add a different user to the watchlist.
Do you want to address, or should I?
Comment #3
jeremylichtman commentedComment #4
jeremylichtman commentedAdded a MR with fixes for the add/remove watchlist endpoints, as well as adding two permissions for those actions (i.e. instead of checking for admin).
https://git.drupalcode.org/project/burndown/-/merge_requests/41
Not sure if that's the only thing wrong here, but it's a start...
Comment #5
swirtI added some comments to the MR but they are not showing up here because the MR is not on an issue fork. I'll take a crack at getting the constructor in place.
Comment #7
swirtI was wrong, it was not the missing constructor, that is handled correctly by creating the instance. It was that the two static methods did not need to be static. I also cleaned up the perms to handle several perms that allow editing or creating tasks.
Comment #8
jeremylichtman commentedThe methods are called statically from burndown.routing.yml. Not sure if that will cause issues.
Otherwise your MR is an improvement on what I threw together.
Comment #9
swirtRouting is misleading because the class and method looks static with the :: but drupal fully loads the class before calling it. The route works fine being non-static.
Comment #10
jeremylichtman commentedReleased on 1.0.67.
Comment #12
swirt