Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCA\Talk\Collaboration\Resources\ConversationProvider;
use OCA\Talk\Collaboration\Resources\Listener as ResourceListener;
use OCA\Talk\Config;
use OCA\Talk\ConfigLexicon;
use OCA\Talk\Dashboard\TalkWidget;
use OCA\Talk\Deck\DeckPluginLoader;
use OCA\Talk\Events\AttendeeRemovedEvent;
Expand Down Expand Up @@ -183,6 +184,7 @@ public function register(IRegistrationContext $context): void {
$context->registerMiddleWare(InjectionMiddleware::class);
$context->registerMiddleWare(ParameterOutOfRangeMiddleware::class);
$context->registerCapability(Capabilities::class);
$context->registerConfigLexicon(ConfigLexicon::class);

// Listeners to load the UI and integrate it into other apps
$context->registerEventListener(AddContentSecurityPolicyEvent::class, CSPListener::class);
Expand Down
36 changes: 36 additions & 0 deletions lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Talk;

use OCA\Talk\Settings\UserPreference;
use OCP\Config\Lexicon\Entry;
use OCP\Config\Lexicon\ILexicon;
use OCP\Config\Lexicon\Strictness;
use OCP\Config\ValueType;

class ConfigLexicon implements ILexicon {
#[\Override]
public function getStrictness(): Strictness {
// Ignore for now as we only start
return Strictness::IGNORE;
}

#[\Override]
public function getAppConfigs(): array {
return [
];
}

#[\Override]
public function getUserConfigs(): array {
return [
new Entry(UserPreference::PLAY_SOUNDS, ValueType::BOOL, true),
];
}
}
2 changes: 2 additions & 0 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use OCP\AppFramework\Services\IInitialState;
use OCP\Collaboration\Reference\RenderReferenceEvent;
use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent;
use OCP\Config\IUserConfig;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\IRootFolder;
use OCP\HintException;
Expand Down Expand Up @@ -78,6 +79,7 @@ public function __construct(
private IThrottler $throttler,
Config $talkConfig,
IConfig $serverConfig,
protected IUserConfig $userConfig,
IGroupManager $groupManager,
) {
parent::__construct($appName, $request);
Expand Down
2 changes: 2 additions & 0 deletions lib/Files/TemplateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCA\Talk\TInitialState;
use OCP\App\IAppManager;
use OCP\AppFramework\Services\IInitialState;
use OCP\Config\IUserConfig;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Files\IRootFolder;
Expand Down Expand Up @@ -45,6 +46,7 @@ public function __construct(
IGroupManager $groupManager,
protected IRequest $request,
LoggerInterface $logger,
protected IUserConfig $userConfig,
) {
$this->initialState = $initialState;
$this->memcacheFactory = $memcacheFactory;
Expand Down
2 changes: 2 additions & 0 deletions lib/PublicShare/TemplateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCA\Talk\Config;
use OCA\Talk\TInitialState;
use OCP\AppFramework\Services\IInitialState;
use OCP\Config\IUserConfig;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Files\FileInfo;
Expand All @@ -40,6 +41,7 @@ public function __construct(
IConfig $serverConfig,
IGroupManager $groupManager,
LoggerInterface $logger,
protected IUserConfig $userConfig,
) {
$this->initialState = $initialState;
$this->talkConfig = $talkConfig;
Expand Down
2 changes: 2 additions & 0 deletions lib/PublicShareAuth/TemplateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCA\Talk\Config;
use OCA\Talk\TInitialState;
use OCP\AppFramework\Services\IInitialState;
use OCP\Config\IUserConfig;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\ICacheFactory;
Expand All @@ -37,6 +38,7 @@ public function __construct(
ICacheFactory $memcacheFactory,
Config $talkConfig,
IConfig $serverConfig,
protected IUserConfig $userConfig,
IGroupManager $groupManager,
LoggerInterface $logger,
) {
Expand Down
17 changes: 8 additions & 9 deletions lib/TInitialState.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
namespace OCA\Talk;

use OC\User\NoUserException;
use OCA\Talk\AppInfo\Application;
use OCA\Talk\Settings\UserPreference;
use OCP\App\IAppManager;
use OCP\AppFramework\Services\IInitialState;
use OCP\Config\IUserConfig;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
Expand All @@ -24,14 +26,11 @@
use Psr\Log\LoggerInterface;

trait TInitialState {
/** @var Config */
protected $talkConfig;
/** @var IConfig */
protected $serverConfig;
/** @var IInitialState */
protected $initialState;
/** @var ICacheFactory */
protected $memcacheFactory;
protected Config $talkConfig;
protected IConfig $serverConfig;
protected IUserConfig $userConfig;
protected IInitialState $initialState;
protected ICacheFactory $memcacheFactory;
protected IGroupManager $groupManager;
protected LoggerInterface $logger;

Expand Down Expand Up @@ -116,7 +115,7 @@ protected function publishInitialStateForUser(IUser $user, IRootFolder $rootFold

$this->initialState->provideInitialState(
'play_sounds',
$this->serverConfig->getUserValue($user->getUID(), 'spreed', UserPreference::PLAY_SOUNDS, 'yes') === 'yes'
$this->userConfig->getValueBool($user->getUID(), Application::APP_ID, UserPreference::PLAY_SOUNDS),
);

$this->initialState->provideInitialState(
Expand Down
Loading