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:
authorJoas Schilling <coding@schilljs.com>2022-02-26 02:20:08 +0300
committerJoas Schilling <coding@schilljs.com>2022-03-02 15:37:05 +0300
commitd2e03f93f36f309be36cc3950b35c07a20fd8b70 (patch)
treec288d8b9d173c1776026ba4c62da00f877397daa
parent610b86b78c987d2bf91fe37b1b99660b8df49f56 (diff)
Reset all in_call flags in one gobugfix/noid/reset-in_call-flag-in-one-query
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/Model/SessionMapper.php12
-rw-r--r--lib/Service/ParticipantService.php6
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/Model/SessionMapper.php b/lib/Model/SessionMapper.php
index 1b747eace..79798b7bc 100644
--- a/lib/Model/SessionMapper.php
+++ b/lib/Model/SessionMapper.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
+use OCA\Talk\Participant;
use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
@@ -90,6 +91,17 @@ class SessionMapper extends QBMapper {
return $delete->executeStatement();
}
+ /**
+ * @param string[] $sessionIds
+ */
+ public function resetInCallByIds(array $sessionIds): void {
+ $update = $this->db->getQueryBuilder();
+ $update->update($this->getTableName())
+ ->set('in_call', $update->createNamedParameter(Participant::FLAG_DISCONNECTED, IQueryBuilder::PARAM_INT))
+ ->where($update->expr()->in('session_id', $update->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)));
+ $update->executeStatement();
+ }
+
public function createSessionFromRow(array $row): Session {
return $this->mapRowToEntity([
'id' => $row['s_id'],
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php
index 24f8e4a3a..960330cee 100644
--- a/lib/Service/ParticipantService.php
+++ b/lib/Service/ParticipantService.php
@@ -924,6 +924,8 @@ class ParticipantService {
$this->changeInCall($room, $participant, Participant::FLAG_DISCONNECTED, true);
}
+ $this->sessionMapper->resetInCallByIds($changedSessionIds);
+
$event->setSessionIds($changedSessionIds);
$event->setUserIds($changedUserIds);
@@ -957,7 +959,9 @@ class ParticipantService {
}
$session->setInCall($flags);
- $this->sessionMapper->update($session);
+ if (!$endCallForEveryone) {
+ $this->sessionMapper->update($session);
+ }
if ($flags !== Participant::FLAG_DISCONNECTED) {
$attendee = $participant->getAttendee();