chore: Removed redundant reference_id checks

Signed-off-by: skalidindi53 <s.teja2004@gmail.com>
This commit is contained in:
skalidindi53 2024-06-11 10:36:09 -05:00
parent 7874470b97
commit b5ab57ef11
5 changed files with 1 additions and 71 deletions

View file

@ -60,7 +60,6 @@
<background-jobs>
<job>OCA\Talk\BackgroundJob\CheckHostedSignalingServer</job>
<job>OCA\Talk\BackgroundJob\CheckMatterbridges</job>
<job>OCA\Talk\BackgroundJob\CheckReferenceIdColumn</job>
<job>OCA\Talk\BackgroundJob\CheckTurnCertificate</job>
<job>OCA\Talk\BackgroundJob\ExpireChatMessages</job>
<job>OCA\Talk\BackgroundJob\ExpireSignalingMessage</job>

View file

@ -1,59 +0,0 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Talk\BackgroundJob;
use OC\DB\ConnectionAdapter;
use OC\DB\SchemaWrapper;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\IDBConnection;
/**
* Class CheckReferenceIdColumn
*
* @package OCA\Talk\BackgroundJob
*/
class CheckReferenceIdColumn extends TimedJob {
/** @var IDBConnection|ConnectionAdapter */
protected $connection;
/**
* @param ITimeFactory $timeFactory
* @param IJobList $jobList
* @param IConfig $serverConfig
* @param IDBConnection $connection
*/
public function __construct(
ITimeFactory $timeFactory,
protected IJobList $jobList,
protected IConfig $serverConfig,
IDBConnection $connection,
) {
parent::__construct($timeFactory);
$this->connection = $connection;
// Every hour
$this->setInterval(3600);
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
}
protected function run($argument): void {
$schema = new SchemaWrapper($this->connection->getInner());
if ($schema->hasTable('comments')) {
$table = $schema->getTable('comments');
if ($table->hasColumn('reference_id')) {
$this->serverConfig->setAppValue('spreed', 'has_reference_id', 'yes');
$this->jobList->remove(self::class);
}
}
}
}

View file

@ -99,6 +99,7 @@ class Capabilities implements IPublicCapability {
'chat-read-last',
'federation-v1',
'ban-v1',
'chat-reference-id',
];
public const LOCAL_FEATURES = [
@ -218,7 +219,6 @@ class Capabilities implements IPublicCapability {
'version' => $this->appManager->getAppVersion('spreed'),
];
if ($this->serverConfig->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron') {
$capabilities['features'][] = 'message-expiration';
}
@ -247,10 +247,6 @@ class Capabilities implements IPublicCapability {
$capabilities['config']['signaling']['hello-v2-token-key'] = $pubKey;
}
if ($this->serverConfig->getAppValue('spreed', 'has_reference_id', 'no') === 'yes') {
$capabilities['features'][] = 'chat-reference-id';
}
/** @var ?string[] $predefinedBackgrounds */
$predefinedBackgrounds = null;
$cachedPredefinedBackgrounds = $this->talkCache->get('predefined_backgrounds');

View file

@ -234,7 +234,6 @@ class CapabilitiesTest extends TestCase {
Capabilities::FEATURES, [
'message-expiration',
'reactions',
'chat-reference-id',
]
),
'features-local' => Capabilities::LOCAL_FEATURES,

View file

@ -6,11 +6,6 @@
<code><![CDATA[BeforeTemplateRenderedEvent]]></code>
</UndefinedClass>
</file>
<file src="lib/BackgroundJob/CheckReferenceIdColumn.php">
<UndefinedClass>
<code><![CDATA[SchemaWrapper]]></code>
</UndefinedClass>
</file>
<file src="lib/Chat/ChatManager.php">
<UndefinedClass>
<code><![CDATA[NullCache]]></code>