Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh/deprecations/next #3747

Merged
merged 3 commits into from
Oct 9, 2024
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
4 changes: 2 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Group\Events\GroupDeletedEvent;
use OCP\IConfig;
use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\IUserManager;
use OCP\User\Events\UserDeletedEvent;
Expand Down Expand Up @@ -143,7 +143,7 @@ private function registerServices(IRegistrationContext $context): void {

$context->registerService(AppSettings::class, function (ContainerInterface $c): AppSettings {
return new AppSettings(
$c->get(IConfig::class),
$c->get(IAppConfig::class),
$c->get(UserSession::class),
);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Poll.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public function setUserId(string $userId): void {
}

public function getGroupShares(): array {
if (!empty($this->groupShares)) {
if ($this->groupShares !== null && $this->groupShares !== '') {
// explode with separator and remove empty elements
return array_filter(explode(PollMapper::CONCAT_SEPARATOR, PollMapper::CONCAT_SEPARATOR . $this->groupShares));
}
Expand Down
7 changes: 5 additions & 2 deletions lib/Db/Preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* @method void setUserId(string $value)
* @method string getTimestamp()
* @method void setTimestamp(int $value)
* @method string getPreferences()
* @method void setPreferences(string $value)
*/
class Preferences extends Entity implements JsonSerializable {
Expand Down Expand Up @@ -52,8 +51,12 @@ public function __construct() {
$this->setPreferences(json_encode(self::DEFAULT));
}

public function getPreferences(): string {
return $this->preferences ?? '';
}

public function getPreferences_decoded(): mixed {
return json_decode($this->getPreferences() ?? '');
return json_decode($this->getPreferences());
}

public function getCheckCalendarsHoursBefore(): int {
Expand Down
3 changes: 3 additions & 0 deletions lib/Filter/ActivityFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use OCP\IL10N;
use OCP\IURLGenerator;

/**
* @psalm-suppress UnusedClass
*/
class ActivityFilter implements \OCP\Activity\IFilter {
private $l10n;
private $urlGenerator;
Expand Down
2 changes: 1 addition & 1 deletion lib/Model/Group/Circle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use OCA\Polls\Model\UserBase;

/**
* @psam-supress
* @psalm-suppress UnusedClass
*/
class Circle extends UserBase {
public const TYPE = 'circle';
Expand Down
8 changes: 7 additions & 1 deletion lib/Model/Group/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace OCA\Polls\Model\Group;

use OCA\Polls\Exceptions\NotFoundException;
use OCA\Polls\Helper\Container;
use OCA\Polls\Model\User\User;
use OCA\Polls\Model\UserBase;
Expand All @@ -30,7 +31,12 @@ public function __construct(
}

private function setUp(): void {
$this->group = $this->groupManager->get($this->id);
$foundGroup = $this->groupManager->get($this->id);
if ($foundGroup === null) {
throw new NotFoundException('Group not found');
}

$this->group = $foundGroup;
$this->displayName = $this->group->getDisplayName();
}

Expand Down
9 changes: 6 additions & 3 deletions lib/Model/Mail/MailBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use OCA\Polls\Helper\Container;
use OCA\Polls\Model\Settings\AppSettings;
use OCA\Polls\Model\UserBase;
use OCP\IAppConfig;
use OCP\IL10N;
use OCP\L10N\IFactory;
use OCP\Mail\IEMailTemplate;
Expand All @@ -31,6 +32,7 @@ abstract class MailBase {
/** @var string */
protected const TEMPLATE_CLASS = AppConstants::APP_ID . '.Mail';

protected IAppConfig $appConfig;
protected AppSettings $appSettings;
protected IEmailTemplate $emailTemplate;
protected IL10N $l10n;
Expand All @@ -55,6 +57,7 @@ public function __construct(
* setUp
*/
private function setUp(): void {
$this->appConfig = Container::queryClass(IAppConfig::class);
$this->appSettings = Container::queryClass(AppSettings::class);
$this->logger = Container::queryClass(LoggerInterface::class);
$this->mailer = Container::queryClass(IMailer::class);
Expand Down Expand Up @@ -115,12 +118,12 @@ private function getEmailTemplate() : IEMailTemplate {

// add footer
$footerText = $this->getFooter();
if ($this->appSettings->getBooleanSetting(AppSettings::SETTING_LEGAL_TERMS_IN_EMAIL)) {
if ($this->appConfig->getValueString(AppConstants::APP_ID, AppSettings::SETTING_LEGAL_TERMS_IN_EMAIL)) {
$footerText = $footerText . '<br>' . $this->getLegalLinks();
}

if ($this->appSettings->getStringSetting(AppSettings::SETTING_DISCLAIMER)) {
$footerText = $footerText . '<br>' . $this->getParsedMarkDown($this->appSettings->getStringSetting(AppSettings::SETTING_DISCLAIMER));
if ($this->appConfig->getValueString(AppConstants::APP_ID, AppSettings::SETTING_DISCLAIMER)) {
$footerText = $footerText . '<br>' . $this->getParsedMarkDown($this->appConfig->getValueString(AppConstants::APP_ID, AppSettings::SETTING_DISCLAIMER));
}

$this->emailTemplate->addFooter($footerText);
Expand Down
77 changes: 35 additions & 42 deletions lib/Model/Settings/AppSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use OCA\Polls\AppConstants;
use OCA\Polls\Model\Group\Group;
use OCA\Polls\UserSession;
use OCP\IConfig;
// use OCP\AppFramework\Services\IAppConfig;
use OCP\IAppConfig;

class AppSettings implements JsonSerializable {
public const SETTING_ALLOW_PUBLIC_SHARES = 'allowPublicShares';
Expand Down Expand Up @@ -47,27 +48,37 @@ class AppSettings implements JsonSerializable {
public const SETTING_UPDATE_TYPE_DEFAULT = self::SETTING_UPDATE_TYPE_NO_POLLING;

public function __construct(
private IConfig $config,
private IAppConfig $appConfig,
private UserSession $userSession,
) {
}


private function checkSettingType(string $key, int $type): bool {
return $this->appConfig->getValueType(AppConstants::APP_ID, $key) === $type;
}

// Getters
// generic Setters
public function getBooleanSetting(string $key, bool $default = true): bool {
return $this->stringToBool($this->config->getAppValue(AppConstants::APP_ID, $key), $default);
if ($this->checkSettingType($key, IAppConfig::VALUE_BOOL)) {
return $this->appConfig->getValueBool(AppConstants::APP_ID, $key);
}
return $this->stringToBool($this->appConfig->getValueString(AppConstants::APP_ID, $key), $default);
}

public function getGroupSetting(string $key): array {
return $this->stringToArray($this->config->getAppValue(AppConstants::APP_ID, $key));
}

public function getStringSetting(string $key, string $default = ''): string {
return $this->config->getAppValue(AppConstants::APP_ID, $key) ?: $default;
if ($this->checkSettingType($key, IAppConfig::VALUE_ARRAY)) {
return $this->appConfig->getValueArray(AppConstants::APP_ID, $key, []);
}
return $this->stringToArray($this->appConfig->getValueString(AppConstants::APP_ID, $key));
}

public function getIntegerSetting(string $key, int $default = 0): int {
return $this->stringToInteger($this->config->getAppValue(AppConstants::APP_ID, $key), $default);
if ($this->checkSettingType($key, IAppConfig::VALUE_INT)) {
return $this->appConfig->getValueInt(AppConstants::APP_ID, $key, $default);
}
return $this->stringToInteger($this->appConfig->getValueString(AppConstants::APP_ID, $key), $default);
}

// Checks
Expand Down Expand Up @@ -133,25 +144,27 @@ public function getComboAllowed(): bool {
}

public function getUsePrivacyUrl(): string {
if ($this->config->getAppValue(AppConstants::APP_ID, self::SETTING_PRIVACY_URL)) {
return $this->config->getAppValue(AppConstants::APP_ID, self::SETTING_PRIVACY_URL);
$ownSetting = $this->appConfig->getValueString(AppConstants::APP_ID, self::SETTING_PRIVACY_URL);
if ($ownSetting === '') {
return $ownSetting;
}
return $this->config->getAppValue('theming', 'privacyUrl');
return $this->appConfig->getValueString('theming', 'privacyUrl');
}

public function getUseImprintUrl(): string {
if ($this->config->getAppValue(AppConstants::APP_ID, self::SETTING_IMPRINT_URL)) {
return $this->config->getAppValue(AppConstants::APP_ID, self::SETTING_IMPRINT_URL);
$ownSetting = $this->appConfig->getValueString(AppConstants::APP_ID, self::SETTING_IMPRINT_URL);
if ($ownSetting === '') {
return $ownSetting;
}
return $this->config->getAppValue('theming', 'imprintUrl');
return $this->appConfig->getValueString('theming', 'imprintUrl');
}

public function getAutoarchiveOffset(): int {
return $this->getIntegerSetting(self::SETTING_AUTO_ARCHIVE_OFFSET, self::SETTING_AUTO_ARCHIVE_OFFSET_DEFAULT);
}

public function getUpdateType(): string {
return $this->getStringSetting(self::SETTING_UPDATE_TYPE, self::SETTING_UPDATE_TYPE_DEFAULT);
return $this->appConfig->getValueString(AppConstants::APP_ID, self::SETTING_UPDATE_TYPE, self::SETTING_UPDATE_TYPE_DEFAULT);
}

public function getShowLogin(): bool {
Expand All @@ -165,20 +178,6 @@ public function getLoadPollsInNavigation(): bool {
return $this->getBooleanSetting(self::SETTING_LOAD_POLLS_IN_NAVIGATION);
}

// Setters
// generic setters
public function setBooleanSetting(string $key, bool $value): void {
$this->config->setAppValue(AppConstants::APP_ID, $key, $this->boolToString($value));
}

public function setGroupSetting(string $key, array $value): void {
$this->config->setAppValue(AppConstants::APP_ID, $key, json_encode($value));
}

public function setStringSetting(string $key, string $value): void {
$this->config->setAppValue(AppConstants::APP_ID, $key, $value);
}

/**
* @return array
*
Expand Down Expand Up @@ -236,14 +235,15 @@ public function jsonSerialize(): array {
self::SETTING_COMBO_GROUPS => $comboGroups,
self::SETTING_AUTO_ARCHIVE => $this->getBooleanSetting(self::SETTING_AUTO_ARCHIVE),
self::SETTING_AUTO_ARCHIVE_OFFSET => $this->getAutoarchiveOffset(),
self::SETTING_DISCLAIMER => $this->getStringSetting(self::SETTING_DISCLAIMER),
self::SETTING_IMPRINT_URL => $this->getStringSetting(self::SETTING_IMPRINT_URL),
self::SETTING_PRIVACY_URL => $this->getStringSetting(self::SETTING_PRIVACY_URL),
self::SETTING_DISCLAIMER => $this->appConfig->getValueString(AppConstants::APP_ID, self::SETTING_DISCLAIMER),
self::SETTING_IMPRINT_URL => $this->appConfig->getValueString(AppConstants::APP_ID, self::SETTING_IMPRINT_URL),
self::SETTING_PRIVACY_URL => $this->appConfig->getValueString(AppConstants::APP_ID, self::SETTING_PRIVACY_URL),
self::SETTING_UPDATE_TYPE => $this->getUpdateType(),
'storedKeys' => $this->appConfig->getKeys(AppConstants::APP_ID),
'usePrivacyUrl' => $this->getUsePrivacyUrl(),
'useImprintUrl' => $this->getUseImprintUrl(),
'defaultPrivacyUrl' => $this->config->getAppValue('theming', 'privacyUrl'),
'defaultImprintUrl' => $this->config->getAppValue('theming', 'imprintUrl'),
'defaultPrivacyUrl' => $this->appConfig->getValueString('theming', 'privacyUrl'),
'defaultImprintUrl' => $this->appConfig->getValueString('theming', 'imprintUrl'),
];
}

Expand Down Expand Up @@ -277,11 +277,4 @@ private function stringToBool(string $value, bool $default): bool {
default => $default,
};
}

private function boolToString(?bool $value): string {
if ($value) {
return 'yes';
}
return 'no';
}
}
2 changes: 1 addition & 1 deletion lib/Model/UserBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public static function search(string $query = ''): array {
$types[] = IShare::TYPE_CIRCLE;
}

[$result, $more] = Container::queryClass(ISearch::class)->search($query, $types, false, 200, 0);
[$result] = Container::queryClass(ISearch::class)->search($query, $types, false, 200, 0);

foreach (($result['users'] ?? []) as $item) {
$items[] = new User($item['value']['shareWith']);
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function extractEmailAddressAndName($eMailString): array {
preg_match(self::REGEX_PARSE_MAIL_AND_NAME, $eMailString, $matches);

// Check if the found element is a valid email address
$emailAddress = !empty($matches[1]) ? trim($matches[1]) : null;
$emailAddress = boolval($matches[1]) ? trim($matches[1]) : null;

if ($emailAddress !== null && filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
// Extract the name based on the input string
Expand Down
50 changes: 27 additions & 23 deletions lib/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

namespace OCA\Polls\Service;

use OCA\Polls\AppConstants;
use OCA\Polls\Model\Settings\AppSettings;
use OCP\IAppConfig;

class SettingsService {

Expand All @@ -17,6 +19,7 @@ class SettingsService {
*/
public function __construct(
private AppSettings $appSettings,
private IAppConfig $appConfig,
) {
}

Expand All @@ -31,29 +34,30 @@ public function getAppSettings(): AppSettings {
* Write app settings
*/
public function writeAppSettings(array $settingsArray): void {
$this->appSettings->setBooleanSetting(AppSettings::SETTING_SHOW_MAIL_ADDRESSES, $settingsArray[AppSettings::SETTING_SHOW_MAIL_ADDRESSES]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_ALLOW_PUBLIC_SHARES, $settingsArray[AppSettings::SETTING_ALLOW_PUBLIC_SHARES]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_ALLOW_COMBO, $settingsArray[AppSettings::SETTING_ALLOW_COMBO]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_ALLOW_ALL_ACCESS, $settingsArray[AppSettings::SETTING_ALLOW_ALL_ACCESS]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_ALLOW_POLL_CREATION, $settingsArray[AppSettings::SETTING_ALLOW_POLL_CREATION]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_ALLOW_POLL_DOWNLOAD, $settingsArray[AppSettings::SETTING_ALLOW_POLL_DOWNLOAD]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_AUTO_ARCHIVE, $settingsArray[AppSettings::SETTING_AUTO_ARCHIVE]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_SHOW_LOGIN, $settingsArray[AppSettings::SETTING_SHOW_LOGIN]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_USE_ACTIVITY, $settingsArray[AppSettings::SETTING_USE_ACTIVITY]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_LEGAL_TERMS_IN_EMAIL, $settingsArray[AppSettings::SETTING_LEGAL_TERMS_IN_EMAIL]);
$this->appSettings->setBooleanSetting(AppSettings::SETTING_LOAD_POLLS_IN_NAVIGATION, $settingsArray[AppSettings::SETTING_LOAD_POLLS_IN_NAVIGATION]);

$this->appSettings->setGroupSetting(AppSettings::SETTING_SHOW_MAIL_ADDRESSES_GROUPS, array_column($settingsArray[AppSettings::SETTING_SHOW_MAIL_ADDRESSES_GROUPS], 'id'));
$this->appSettings->setGroupSetting(AppSettings::SETTING_ALL_ACCESS_GROUPS, array_column($settingsArray[AppSettings::SETTING_ALL_ACCESS_GROUPS], 'id'));
$this->appSettings->setGroupSetting(AppSettings::SETTING_PUBLIC_SHARES_GROUPS, array_column($settingsArray[AppSettings::SETTING_PUBLIC_SHARES_GROUPS], 'id'));
$this->appSettings->setGroupSetting(AppSettings::SETTING_COMBO_GROUPS, array_column($settingsArray[AppSettings::SETTING_COMBO_GROUPS], 'id'));
$this->appSettings->setGroupSetting(AppSettings::SETTING_POLL_CREATION_GROUPS, array_column($settingsArray[AppSettings::SETTING_POLL_CREATION_GROUPS], 'id'));
$this->appSettings->setGroupSetting(AppSettings::SETTING_POLL_DOWNLOAD_GROUPS, array_column($settingsArray[AppSettings::SETTING_POLL_DOWNLOAD_GROUPS], 'id'));
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_SHOW_MAIL_ADDRESSES, $settingsArray[AppSettings::SETTING_SHOW_MAIL_ADDRESSES]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_ALLOW_PUBLIC_SHARES, $settingsArray[AppSettings::SETTING_ALLOW_PUBLIC_SHARES]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_ALLOW_COMBO, $settingsArray[AppSettings::SETTING_ALLOW_COMBO]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_ALLOW_ALL_ACCESS, $settingsArray[AppSettings::SETTING_ALLOW_ALL_ACCESS]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_ALLOW_POLL_CREATION, $settingsArray[AppSettings::SETTING_ALLOW_POLL_CREATION]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_ALLOW_POLL_DOWNLOAD, $settingsArray[AppSettings::SETTING_ALLOW_POLL_DOWNLOAD]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_AUTO_ARCHIVE, $settingsArray[AppSettings::SETTING_AUTO_ARCHIVE]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_SHOW_LOGIN, $settingsArray[AppSettings::SETTING_SHOW_LOGIN]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_USE_ACTIVITY, $settingsArray[AppSettings::SETTING_USE_ACTIVITY]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_LEGAL_TERMS_IN_EMAIL, $settingsArray[AppSettings::SETTING_LEGAL_TERMS_IN_EMAIL]);
$this->appConfig->setValueBool(AppConstants::APP_ID, AppSettings::SETTING_LOAD_POLLS_IN_NAVIGATION, $settingsArray[AppSettings::SETTING_LOAD_POLLS_IN_NAVIGATION]);

$this->appConfig->setValueArray(AppConstants::APP_ID, AppSettings::SETTING_SHOW_MAIL_ADDRESSES_GROUPS, array_column($settingsArray[AppSettings::SETTING_SHOW_MAIL_ADDRESSES_GROUPS], 'id'));
$this->appConfig->setValueArray(AppConstants::APP_ID, AppSettings::SETTING_ALL_ACCESS_GROUPS, array_column($settingsArray[AppSettings::SETTING_ALL_ACCESS_GROUPS], 'id'));
$this->appConfig->setValueArray(AppConstants::APP_ID, AppSettings::SETTING_PUBLIC_SHARES_GROUPS, array_column($settingsArray[AppSettings::SETTING_PUBLIC_SHARES_GROUPS], 'id'));
$this->appConfig->setValueArray(AppConstants::APP_ID, AppSettings::SETTING_COMBO_GROUPS, array_column($settingsArray[AppSettings::SETTING_COMBO_GROUPS], 'id'));
$this->appConfig->setValueArray(AppConstants::APP_ID, AppSettings::SETTING_POLL_CREATION_GROUPS, array_column($settingsArray[AppSettings::SETTING_POLL_CREATION_GROUPS], 'id'));
$this->appConfig->setValueArray(AppConstants::APP_ID, AppSettings::SETTING_POLL_DOWNLOAD_GROUPS, array_column($settingsArray[AppSettings::SETTING_POLL_DOWNLOAD_GROUPS], 'id'));

$this->appSettings->setStringSetting(AppSettings::SETTING_AUTO_ARCHIVE_OFFSET, strval($settingsArray[AppSettings::SETTING_AUTO_ARCHIVE_OFFSET]));
$this->appSettings->setStringSetting(AppSettings::SETTING_UPDATE_TYPE, $settingsArray[AppSettings::SETTING_UPDATE_TYPE]);
$this->appSettings->setStringSetting(AppSettings::SETTING_PRIVACY_URL, $settingsArray[AppSettings::SETTING_PRIVACY_URL]);
$this->appSettings->setStringSetting(AppSettings::SETTING_IMPRINT_URL, $settingsArray[AppSettings::SETTING_IMPRINT_URL]);
$this->appSettings->setStringSetting(AppSettings::SETTING_DISCLAIMER, $settingsArray[AppSettings::SETTING_DISCLAIMER]);
$this->appConfig->setValueInt(AppConstants::APP_ID, AppSettings::SETTING_AUTO_ARCHIVE_OFFSET, $settingsArray[AppSettings::SETTING_AUTO_ARCHIVE_OFFSET]);

$this->appConfig->setValueString(AppConstants::APP_ID, AppSettings::SETTING_UPDATE_TYPE, $settingsArray[AppSettings::SETTING_UPDATE_TYPE]);
$this->appConfig->setValueString(AppConstants::APP_ID, AppSettings::SETTING_PRIVACY_URL, $settingsArray[AppSettings::SETTING_PRIVACY_URL]);
$this->appConfig->setValueString(AppConstants::APP_ID, AppSettings::SETTING_IMPRINT_URL, $settingsArray[AppSettings::SETTING_IMPRINT_URL]);
$this->appConfig->setValueString(AppConstants::APP_ID, AppSettings::SETTING_DISCLAIMER, $settingsArray[AppSettings::SETTING_DISCLAIMER]);
}
}
6 changes: 3 additions & 3 deletions lib/Service/ShareService.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ private function convertPersonalPublicShareToExternalShare(
$this->share->setDisplayName($displayName ?? $this->share->getDisplayName());
$this->share->setTimeZoneName($timeZone ?? $this->share->getTimeZoneName());
$this->share->setLanguage($language ?? $this->share->getLanguage());
if ($emailAddress && $emailAddress !== $this->share->getEmailAddress()) {

if ($emailAddress !== null && $emailAddress !== '' && $emailAddress !== $this->share->getEmailAddress()) {
// reset invitation sent, if email address is changed
$this->share->setInvitationSent(0);
}

$this->share->setEmailAddress($emailAddress ?? $this->share->getEmailAddress());


// convert to type external
$this->share->setType(Share::TYPE_EXTERNAL);

Expand Down
3 changes: 3 additions & 0 deletions lib/Settings/ActivityVote.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace OCA\Polls\Settings;

/**
* @psalm-suppress UnusedClass
*/
class ActivityVote extends ActivitySettings {
public function getIdentifier() : string {
return 'vote_set';
Expand Down
Loading