-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11615 from nextcloud/bugfix/noid/only-register-fi…
…lter-when-allowed fix(search): Only register search filter when allowed to use Talk
- Loading branch information
Showing
1 changed file
with
9 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
/** | ||
* @copyright Copyright (c) 2024 Fon E. Noel NFEBE <[email protected]> | ||
* | ||
* @author Fon E. Noel NFEBE <[email protected]> | ||
* @author Joas Schilling <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -23,10 +26,11 @@ | |
|
||
namespace OCA\Talk\Search; | ||
|
||
use OCA\Talk\Config; | ||
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; | ||
use OCP\EventDispatcher\Event; | ||
use OCP\EventDispatcher\IEventListener; | ||
use OCP\IRequest; | ||
use OCP\IUserSession; | ||
use OCP\Util; | ||
|
||
/** | ||
|
@@ -35,7 +39,8 @@ | |
class UnifiedSearchFilterPlugin implements IEventListener { | ||
|
||
public function __construct( | ||
private IRequest $request, | ||
protected Config $talkConfig, | ||
protected IUserSession $userSession, | ||
) { | ||
} | ||
|
||
|
@@ -44,7 +49,8 @@ public function handle(Event $event): void { | |
return; | ||
} | ||
|
||
if (!$event->isLoggedIn()) { | ||
$currentUser = $this->userSession->getUser(); | ||
if ($currentUser === null || $this->talkConfig->isDisabledForUser($currentUser)) { | ||
return; | ||
} | ||
|
||
|