Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Edens <petere@conceiva.com>2018-12-19 06:59:43 +0300
committerJoas Schilling <coding@schilljs.com>2019-02-26 12:15:30 +0300
commit4ca16cb2e6a6baef209e3c85d492d37fe9a48c3c (patch)
treee0f4b09865421a259e2abdba1e086e30d9676a1b /lib/Room.php
parent5489820cd34a4f25cb12fc16f189d8c7f2ce547a (diff)
Add reason for removing participant from room so that hook can determine if the user was removed by moderator.
Signed-off-by: Peter Edens <petere@conceiva.com>
Diffstat (limited to 'lib/Room.php')
-rw-r--r--lib/Room.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Room.php b/lib/Room.php
index 2aa9997f0..9d5b61d60 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -45,6 +45,9 @@ class Room {
public const GROUP_CALL = 2;
public const PUBLIC_CALL = 3;
+ public const PARTICIPANT_REMOVED = 'remove';
+ public const PARTICIPANT_LEFT = 'leave';
+
/** @var Manager */
private $manager;
/** @var IDBConnection */
@@ -516,8 +519,9 @@ class Room {
/**
* @param IUser $user
+ * @param string $reason
*/
- public function removeUser(IUser $user): void {
+ public function removeUser(IUser $user, string $reason): void {
try {
$participant = $this->getParticipant($user->getUID());
} catch (ParticipantNotFoundException $e) {
@@ -527,6 +531,7 @@ class Room {
$this->dispatcher->dispatch(self::class . '::preRemoveUser', new GenericEvent($this, [
'user' => $user,
'participant' => $participant,
+ 'reason' => $reason,
]));
$query = $this->db->getQueryBuilder();
@@ -538,15 +543,18 @@ class Room {
$this->dispatcher->dispatch(self::class . '::postRemoveUser', new GenericEvent($this, [
'user' => $user,
'participant' => $participant,
+ 'reason' => $reason,
]));
}
/**
* @param Participant $participant
+ * @param string $reason
*/
- public function removeParticipantBySession(Participant $participant): void {
+ public function removeParticipantBySession(Participant $participant, string $reason): void {
$this->dispatcher->dispatch(self::class . '::preRemoveBySession', new GenericEvent($this, [
'participant' => $participant,
+ 'reason' => $reason,
]));
$query = $this->db->getQueryBuilder();
@@ -557,6 +565,7 @@ class Room {
$this->dispatcher->dispatch(self::class . '::postRemoveBySession', new GenericEvent($this, [
'participant' => $participant,
+ 'reason' => $reason,
]));
}
@@ -577,7 +586,7 @@ class Room {
$this->dispatcher->dispatch(self::class . '::preJoinRoom', $event);
if ($event->hasArgument('cancel') && $event->getArgument('cancel') === true) {
- $this->removeUser($user);
+ $this->removeUser($user, self::PARTICIPANT_LEFT);
throw new UnauthorizedException('Participant is not allowed to join');
}