Skip to content

Commit

Permalink
feat: provide simple toggle to disable handler and tracking for inter… (
Browse files Browse the repository at this point in the history
#25)

* feat: provide simple toggle to disable handler and tracking for internal api calls

* Apply fixes from StyleCI

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
luceos and StyleCIBot committed Jul 13, 2022
1 parent 9be6d04 commit 6188e8f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Listeners/AddDiscussionViewHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class AddDiscussionViewHandler
* @var SettingsRepositoryInterface
*/
public $settings;
/**
* @var bool
* @info Allows disabling the handler ahead of any internal API calls.
*/
public static $enabled = true;

public function __construct(Dispatcher $bus, SettingsRepositoryInterface $settings)
{
Expand All @@ -41,6 +46,10 @@ public function __construct(Dispatcher $bus, SettingsRepositoryInterface $settin

public function __invoke(ShowDiscussionController $controller, &$data, ServerRequestInterface $request)
{
if (static::$enabled === false) {
return;
}

/**
* @var \Flarum\User\User
*/
Expand Down

0 comments on commit 6188e8f

Please sign in to comment.