Skip to content
Closed
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
fix(systemtags): Provide initial state for admin restriction setting
The “Restrict tag creation and editing to administrators” switch in the SystemTags

admin settings was not reflecting the correct database value on page load.

This happened because no initial state was being provided.

Fix

This change ensures the correct initial state is set by:

- Injecting IAppConfig and IInitialState dependencies.

- Following the same initial state provisioning pattern used by other admin settings in Nextcloud.

Signed-off-by: nfebe <[email protected]>

[skip ci]
  • Loading branch information
nfebe authored and backportbot[bot] committed Oct 15, 2025
commit 172c810c3e34753ab712463c400af5a5707365ac
9 changes: 9 additions & 0 deletions apps/systemtags/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@
*/
namespace OCA\SystemTags\Settings;

use OCA\SystemTags\AppInfo\Application;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IAppConfig;
use OCP\Settings\ISettings;

class Admin implements ISettings {

public function __construct(
private IAppConfig $appConfig,
private IInitialState $initialStateService,
) {
}

/**
* @return TemplateResponse
*/
Expand Down
14 changes: 13 additions & 1 deletion apps/systemtags/tests/Settings/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@

use OCA\SystemTags\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IAppConfig;
use Test\TestCase;

class AdminTest extends TestCase {
/** @var Admin */
private $admin;
/** @var IAppConfig|\PHPUnit\Framework\MockObject\MockObject */
private $appConfig;
/** @var IInitialState|\PHPUnit\Framework\MockObject\MockObject */
private $initialState;

protected function setUp(): void {
parent::setUp();

$this->admin = new Admin();
$this->appConfig = $this->createMock(IAppConfig::class);
$this->initialState = $this->createMock(IInitialState::class);

$this->admin = new Admin(
$this->appConfig,
$this->initialState
);
}

public function testGetForm() {
Expand Down