Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix redundant bool conversion.
Use core config lexicon.
  • Loading branch information
antoonp committed Nov 20, 2025
commit 29792a66fbaba5c23c8799baf790e70a0088d3aa
8 changes: 4 additions & 4 deletions lib/Command/DisableOcmInvites.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace OCA\Contacts\Command;

use OC\Core\AppInfo\ConfigLexicon;
use OCP\IAppConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -26,15 +27,14 @@ protected function configure(): void {
}

protected function execute(InputInterface $input, OutputInterface $output): int {
$isAlreadyDisabled = $this->appConfig->getValueBool('contacts', 'ocm_invites_enabled') === false;

if ($isAlreadyDisabled) {
$isEnabled = $this->appConfig->getValueBool('contacts', 'ocm_invites_enabled');
if (!$isEnabled) {
$output->writeln('OCM Invites already disabled.');
return self::SUCCESS;
}

$this->appConfig->setValueBool('contacts', 'ocm_invites_enabled', false);
$this->appConfig->deleteKey('core', 'ocm_invite_accept_dialog');
$this->appConfig->deleteKey('core', ConfigLexicon::OCM_INVITE_ACCEPT_DIALOG);
$output->writeln('OCM Invites successfully disabled.');
return self::SUCCESS;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/Service/FederatedInvitesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public function __construct(
}

public function isOcmInvitesEnabled():bool {
$val = $this->appConfig->getValueBool(Application::APP_ID, 'ocm_invites_enabled', FederatedInvitesService::OCM_INVITES_ENABLED_BY_DEFAULT);
$boolval = (is_string($val) ? filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : (bool)$val);
return ($boolval === null ? false : $boolval);
return $this->appConfig->getValueBool(Application::APP_ID, 'ocm_invites_enabled', FederatedInvitesService::OCM_INVITES_ENABLED_BY_DEFAULT);
}

/**
Expand Down