Add IsExternal for external contact sources

Signed-off-by: Akhil <akhil@e.email>
This commit is contained in:
Akhil 2023-08-31 19:56:27 +05:30
parent 6f61b06bbb
commit 8a4eabe699
No known key found for this signature in database
GPG key ID: A8AB680DBB7F3D45
8 changed files with 25 additions and 1 deletions

View file

@ -4,7 +4,7 @@ import { ThemeStore } from 'Stores/Theme';
import { arePopupsVisible } from 'Knoin/Knoin';
export const AppUserStore = {
allowContacts: () => !!SettingsGet('contactsAllowed')
allowContacts: () => !!SettingsGet('contactsAllowed') && !!SettingsGet('contactsExternal')
};
addObservablesTo(AppUserStore, {

View file

@ -99,6 +99,11 @@ class KolabAddressBook implements \RainLoop\Providers\AddressBook\AddressBookInt
return true;
}
public function IsExternal(): bool
{
return false;
}
public function SetEmail(string $sEmail) : bool
{
return true;

View file

@ -33,6 +33,11 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
return true;
}
public function IsExternal(): bool
{
return true;
}
public function SetEmail(string $sEmail) : bool {
return true;
}

View file

@ -678,6 +678,7 @@ class Actions
'accountSignMe' => isset($_COOKIE[self::AUTH_SIGN_ME_TOKEN_KEY]),
'contactsAllowed' => $this->AddressBookProvider($oAccount)->IsActive(),
'contactsExternal' => $this->AddressBookProvider($oAccount)->IsExternal(),
'ViewHTML' => (bool) $oConfig->Get('defaults', 'view_html', true),
'ViewImages' => $oConfig->Get('defaults', 'view_images', 'ask'),

View file

@ -202,6 +202,7 @@ trait Accounts
'accountHash' => $oAccount->Hash(),
'mainEmail' => \RainLoop\Api::Actions()->getMainAccountFromToken()->Email(),
'contactsAllowed' => $this->AddressBookProvider($oAccount)->IsActive(),
'contactsExternal' => $this->AddressBookProvider($oAccount)->IsExternal(),
'HideUnsubscribed' => false,
'UseThreads' => (bool) $oConfig->Get('defaults', 'mail_use_threads', false),
'ReplySameFolder' => (bool) $oConfig->Get('defaults', 'mail_reply_same_folder', false),

View file

@ -25,6 +25,11 @@ class AddressBook extends AbstractProvider
return $this->oDriver && $this->oDriver->IsSupported();
}
public function IsExternal() : bool
{
return $this->IsActive() ? $this->oDriver->IsExternal() : false;
}
public function Sync() : bool
{
return $this->IsActive() ? $this->oDriver->Sync() : false;

View file

@ -6,6 +6,8 @@ interface AddressBookInterface
{
public function IsSupported() : bool;
public function IsExternal() : bool;
public function SetEmail(string $sEmail) : bool;
public function Sync() : bool;

View file

@ -76,6 +76,11 @@ class PdoAddressBook
return \is_array($aDrivers) && \in_array($this->settings->driver, $aDrivers);
}
public function IsExternal(): bool
{
return false;
}
public function SetEmail(string $sEmail) : bool
{
$this->iUserID = $this->getUserId($sEmail);