diff options
author | Joas Schilling <coding@schilljs.com> | 2022-02-26 02:20:08 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-03-02 15:37:05 +0300 |
commit | d2e03f93f36f309be36cc3950b35c07a20fd8b70 (patch) | |
tree | c288d8b9d173c1776026ba4c62da00f877397daa /lib/Model | |
parent | 610b86b78c987d2bf91fe37b1b99660b8df49f56 (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>
Diffstat (limited to 'lib/Model')
-rw-r--r-- | lib/Model/SessionMapper.php | 12 |
1 files changed, 12 insertions, 0 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'], |