-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feature: mail provider backend #45383
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@@ -431,6 +435,13 @@ | |||
$taskProcessingTaskTypeClass | |||
); | |||
} | |||
|
|||
public function registerMailProvider(string $mailProviderClass): void { |
Check failure
Code scanning / Psalm
ParamNameMismatch Error
@@ -968,4 +985,11 @@ | |||
public function getTaskProcessingTaskTypes(): array { | |||
return $this->taskProcessingTaskTypes; | |||
} | |||
|
|||
/** | |||
* @return ServiceRegistration<IMailProviders>[] |
Check failure
Code scanning / Psalm
UndefinedDocblockClass Error
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Psalm found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
TODO: Separate attachment handling for local files (saved on the system) and streamed files (generate in memory) |
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
// load mail provider manager | ||
$mailManager = \OC::$server->get(\OC\Mail\Provider\Manager::class); | ||
// retrieve all services | ||
$mailService = $mailManager->findServiceByAddress($this->userSession->getUser()->getUID(), $sender); |
Check notice
Code scanning / Psalm
PossiblyNullReference Note
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
$services[$entry->id()] = $entry->listServices($uid); | ||
} | ||
// return collection | ||
return $services; |
Check failure
Code scanning / Psalm
InvalidReturnStatement Error
// retrieve all services | ||
$mailService = $mailManager->findServiceByAddress($this->userSession->getUser()->getUID(), $sender); | ||
// evaluate if a mail service was found and has sending capabilities | ||
if ($mailService !== null && $mailService->capable('MessageSend')) { |
Check notice
Code scanning / Psalm
RiskyTruthyFalsyComparison Note
apps/theming/lib/ThemingDefaults.php
Outdated
if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) { | ||
return BackgroundService::DEFAULT_COLOR; | ||
// try admin color | ||
$defaultColor = $this->config->getAppValue(Application::APP_ID, 'primary_color', ''); |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
apps/theming/lib/ThemingDefaults.php
Outdated
@@ -366,7 +379,7 @@ | |||
$variables['image-login-background'] = "url('".$this->imageManager->getImageUrl('background')."')"; | |||
$variables['image-login-plain'] = 'false'; | |||
|
|||
if ($this->config->getAppValue('theming', 'color', '') !== '') { | |||
if ($this->config->getAppValue('theming', 'primary_color', '') !== '') { |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
} | ||
|
||
public function setDefaultBackground(): void { | ||
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'background_image'); | ||
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'background_color'); | ||
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'primary_color'); |
Check notice
Code scanning / Psalm
PossiblyNullArgument Note
apps/theming/lib/ThemingDefaults.php
Outdated
* Default background color only taking admin setting into account | ||
*/ | ||
public function getDefaultColorBackground(): string { | ||
$defaultColor = $this->config->getAppValue(Application::APP_ID, 'background_color', ''); |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
apps/theming/lib/ImageManager.php
Outdated
@@ -77,7 +79,11 @@ | |||
case 'favicon': | |||
return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter; | |||
case 'background': | |||
return $this->urlGenerator->linkTo(Application::APP_ID, 'img/background/' . BackgroundService::DEFAULT_BACKGROUND_IMAGE); | |||
// Removing the background defines its mime as 'backgroundColor' | |||
$mimeSetting = $this->config->getAppValue('theming', 'backgroundMime', ''); |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
/** URL of admin configured background image */ | ||
'backgroundImage' => $this->themingDefaults->getBackground(), | ||
/** `backgroundColor` if disabled, mime type if defined and empty by default */ | ||
'backgroundMime' => $this->config->getAppValue('theming', 'backgroundMime', ''), |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
apps/theming/lib/ThemingDefaults.php
Outdated
// If a background image is set we revert to the mean image color | ||
if ($this->imageManager->hasImage('background')) { | ||
$file = $this->imageManager->getImage('background'); | ||
$returnValue = $this->backgroundService->setGlobalBackground($file->read()) ?? ''; |
Check notice
Code scanning / Psalm
PossiblyFalseArgument Note
if ($handle && $image->loadFromFileHandle($handle) !== false) { | ||
$meanColor = $this->calculateMeanColor($image); | ||
if ($meanColor !== false) { | ||
$this->config->setAppValue(Application::APP_ID, 'background_color', $meanColor); |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
apps/theming/lib/ImageManager.php
Outdated
imagedestroy($outputImage); | ||
} | ||
} catch (\Exception $e) { | ||
if (isset($outputImage) && is_resource($outputImage) || $outputImage instanceof \GdImage) { |
Check notice
Code scanning / Psalm
PossiblyUndefinedVariable Note
b1b1fe5
to
2187c7c
Compare
TODO: unit tests |
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Summary
Initial Mail Provider Implementation
TODO