зеркало из https://github.com/nextcloud/spreed.git
Util is a bad name and static is awkward
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
1ce7b38edd
Коммит
f93c8e582f
|
@ -35,7 +35,7 @@
|
|||
|
||||
$manager = \OC::$server->getNotificationManager();
|
||||
$manager->registerNotifier(function() {
|
||||
return \OC::$server->query('OCA\Spreed\Notification\Notifier');
|
||||
return \OC::$server->query(\OCA\Spreed\Notification\Notifier::class);
|
||||
}, function() {
|
||||
$l = \OC::$server->getL10N('spreed');
|
||||
|
||||
|
@ -46,5 +46,6 @@ $manager->registerNotifier(function() {
|
|||
});
|
||||
|
||||
\OC::$server->getUserManager()->listen('\OC\User', 'postDelete', function ($user) {
|
||||
\OCA\Spreed\Util::deleteUser($user);
|
||||
$listener = \OC::$server->query(\OCA\Spreed\HookListener::class);
|
||||
$listener->deleteUser($user);
|
||||
});
|
||||
|
|
|
@ -23,15 +23,23 @@ namespace OCA\Spreed;
|
|||
|
||||
use OCP\IUser;
|
||||
|
||||
class Util {
|
||||
class HookListener {
|
||||
|
||||
/** @var Manager */
|
||||
protected $manager;
|
||||
|
||||
/**
|
||||
* @param Manager $manager
|
||||
*/
|
||||
public function __construct(Manager $manager) {
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IUser $user
|
||||
*/
|
||||
public static function deleteUser(IUser $user) {
|
||||
/** @var Manager $manager */
|
||||
$manager = \OC::$server->query(Manager::class);
|
||||
$rooms = $manager->getRoomsForParticipant($user->getUID());
|
||||
public function deleteUser(IUser $user) {
|
||||
$rooms = $this->manager->getRoomsForParticipant($user->getUID());
|
||||
|
||||
foreach ($rooms as $room) {
|
||||
if ($room->getType() === Room::ONE_TO_ONE_CALL || $room->getNumberOfParticipants() === 1) {
|
Загрузка…
Ссылка в новой задаче