UPSTREAM BASELINE: nextcloud/spreed v22.0.12 (без изменений)
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06). Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\TalkWebhookDemo\Model;
|
||||
|
||||
class Bot {
|
||||
public const SUPPORTED_LANGUAGES = [
|
||||
'en',
|
||||
//'de',
|
||||
//'es',
|
||||
//'fr',
|
||||
//'ar',
|
||||
//'pt_BR',
|
||||
//'tr',
|
||||
//'zh_CN',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\TalkWebhookDemo\Model;
|
||||
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
|
||||
/**
|
||||
* @method void setServer(string $server)
|
||||
* @method string getServer()
|
||||
* @method void setToken(string $token)
|
||||
* @method string getToken()
|
||||
* @method void setType(string $type)
|
||||
* @method string getType()
|
||||
* @method void setDetails(?string $details)
|
||||
* @method string|null getDetails()
|
||||
*/
|
||||
class LogEntry extends Entity {
|
||||
public const TYPE_ATTENDEE = 'attendee';
|
||||
public const TYPE_START = 'start';
|
||||
public const TYPE_ELEVATOR = 'elevator';
|
||||
public const TYPE_TODO = 'todo';
|
||||
public const TYPE_SOLVED = 'solved';
|
||||
public const TYPE_NOTE = 'note';
|
||||
public const TYPE_REPORT = 'report';
|
||||
public const TYPE_DECISION = 'decision';
|
||||
public const TYPE_AGENDA = 'agenda';
|
||||
|
||||
/** @var string */
|
||||
protected $server;
|
||||
|
||||
/** @var string */
|
||||
protected $token;
|
||||
|
||||
/** @var string */
|
||||
protected $type;
|
||||
|
||||
/** @var ?string */
|
||||
protected $details;
|
||||
|
||||
public function __construct() {
|
||||
$this->addType('server', 'string');
|
||||
$this->addType('token', 'string');
|
||||
$this->addType('type', 'string');
|
||||
$this->addType('details', 'string');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\TalkWebhookDemo\Model;
|
||||
|
||||
use OCP\AppFramework\Db\QBMapper;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IDBConnection;
|
||||
|
||||
/**
|
||||
* @method LogEntry mapRowToEntity(array $row)
|
||||
* @method LogEntry findEntity(IQueryBuilder $query)
|
||||
* @method list<LogEntry> findEntities(IQueryBuilder $query)
|
||||
* @template-extends QBMapper<LogEntry>
|
||||
*/
|
||||
class LogEntryMapper extends QBMapper {
|
||||
public function __construct(IDBConnection $db) {
|
||||
parent::__construct($db, 'twd_log_entries', LogEntry::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LogEntry[]
|
||||
*/
|
||||
public function findByConversation(string $server, string $token): array {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select('*')
|
||||
->from($this->getTableName())
|
||||
->where($query->expr()->eq('server', $query->createNamedParameter($server)))
|
||||
->andWhere($query->expr()->eq('token', $query->createNamedParameter($token)));
|
||||
return $this->findEntities($query);
|
||||
}
|
||||
|
||||
public function hasActiveCall(string $server, string $token): bool {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select($query->expr()->literal(1))
|
||||
->from($this->getTableName())
|
||||
->where($query->expr()->eq('server', $query->createNamedParameter($server)))
|
||||
->andWhere($query->expr()->eq('token', $query->createNamedParameter($token)))
|
||||
->andWhere($query->expr()->eq('type', $query->createNamedParameter(LogEntry::TYPE_ATTENDEE)))
|
||||
->setMaxResults(1);
|
||||
$result = $query->executeQuery();
|
||||
$hasAttendee = (bool)$result->fetchOne();
|
||||
$result->closeCursor();
|
||||
|
||||
return $hasAttendee;
|
||||
}
|
||||
|
||||
public function deleteByConversation(string $server, string $token): void {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete($this->getTableName())
|
||||
->where($query->expr()->eq('server', $query->createNamedParameter($server)))
|
||||
->andWhere($query->expr()->eq('token', $query->createNamedParameter($token)));
|
||||
$query->executeStatement();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user