aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/UserStatus
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-02-10 17:28:05 +0100
committerJoas Schilling <coding@schilljs.com>2022-02-15 16:06:33 +0100
commitdeec4f31dbe02008207f9b8c21f0302af919c652 (patch)
treefeb86c775616aafb690bfd2d2b77d0d299f33c54 /lib/private/UserStatus
parent194338cca3823ec4e1f1f473e278bdb26fb229fa (diff)
downloadnextcloud-server-deec4f31dbe02008207f9b8c21f0302af919c652.tar.gz
nextcloud-server-deec4f31dbe02008207f9b8c21f0302af919c652.zip
Allow to revert the user status of multiple users in 3 queries instead of 3*n
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/UserStatus')
-rw-r--r--lib/private/UserStatus/ISettableProvider.php11
-rw-r--r--lib/private/UserStatus/Manager.php8
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/UserStatus/ISettableProvider.php b/lib/private/UserStatus/ISettableProvider.php
index fc0d502845e..88a107d1f86 100644
--- a/lib/private/UserStatus/ISettableProvider.php
+++ b/lib/private/UserStatus/ISettableProvider.php
@@ -52,4 +52,15 @@ interface ISettableProvider extends IProvider {
* @param string $status The expected current status.
*/
public function revertUserStatus(string $userId, string $messageId, string $status): void;
+
+ /**
+ * Revert an automatically set user status. For example after leaving a call,
+ * change back to the previously set status. If the user has already updated
+ * their status, this method does nothing.
+ *
+ * @param string[] $userIds The users for which we want to update the status.
+ * @param string $messageId The expected current messageId.
+ * @param string $status The expected current status.
+ */
+ public function revertMultipleUserStatus(array $userIds, string $messageId, string $status): void;
}
diff --git a/lib/private/UserStatus/Manager.php b/lib/private/UserStatus/Manager.php
index bca80bc5b03..c93795bea5b 100644
--- a/lib/private/UserStatus/Manager.php
+++ b/lib/private/UserStatus/Manager.php
@@ -121,4 +121,12 @@ class Manager implements IManager {
}
$this->provider->revertUserStatus($userId, $messageId, $status);
}
+
+ public function revertMultipleUserStatus(array $userIds, string $messageId, string $status): void {
+ $this->setupProvider();
+ if (!$this->provider || !($this->provider instanceof ISettableProvider)) {
+ return;
+ }
+ $this->provider->revertMultipleUserStatus($userIds, $messageId, $status);
+ }
}