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

Separate Email Logo #26871

Closed
wants to merge 3 commits into from
Closed

Conversation

brueckner
Copy link

@brueckner brueckner commented May 4, 2021

This PR adds the ability to upload a separate logo for notification emails.

Screenshot - Google Chrome Canary - 2021-05-04 at 15-11

I basically copied most of the funtionality from the 'logo' upload field and added a fallback check in apps/theming/lib/ThemingDefaults.php. If no email logo is provided, the default logo will be used and if that's not present either, the default nextcloud logo will be used.

Related Issues:

Kind of related:

Signed-off-by: Johannes Brückner <johannes@dotplex.com>
@brueckner
Copy link
Author

Hi! Did anyone get a chance to take a look at it yet?

@szaimen szaimen added the 3. to review Waiting for reviews label May 11, 2021
@ChristophWurst ChristophWurst requested review from skjnldsv, julien-nc, artonge and ArtificialOwl and removed request for ChristophWurst May 18, 2021 06:49
@brueckner
Copy link
Author

I noticed that I didn't properly link to the issues I mentioned above. I fixed all of them and would still love to get some feedback. 🙄

Comment on lines 246 to 255
if (!$logoExists) {
try {
$logoKey = 'logo';
$logo = $this->config->getAppValue('theming', $logoKey . 'Mime', '');
$this->imageManager->getImage($logoKey, $useSvg);
$logoExists = true;
} catch (\Exception $e) {
$logoExists = false;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more comments on the code please? :)
Maybe something like

Fallback to logo if there is no emailLogo registered

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new refactor based on @juliushaertl suggestion to extract it into a new getEmailLogo function greatly simplified the code, aligning it with the original getLogo function, so I think no additional comments are needed there. You're right though, I should've added some comments in this case. 👌

Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but don't hesitate to comment the code a bit further, it makes it easier to get the context at glance

Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd generally be ok with adding a setting for this, but I'd pull in @jancborchardt here for some additional checking. 😉

@@ -223,8 +223,10 @@ public function getColorPrimary() {
* @param bool $useSvg Whether to point to the SVG image or a fallback
* @return string
*/
public function getLogo($useSvg = true): string {
$logo = $this->config->getAppValue('theming', 'logoMime', '');
public function getLogo($useSvg = true, $emailLogo = false): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned with just adding another argument here so since this is a totally different logo file that can be uploaded I'd rather go with a separate method also in OCP\Defaults like getMailLogo.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That a very good point, thanks for bringing it up! I was actually thinking about that at first, but was afraid to get complains with regards to code duplication. However, having done the refactor now it feels much, much better and is totally worth a little duplication imho. Especially with regards to your other comment about the SVG - the new getEmailLogo doesn't have to be concerned with SVGs now. I'm just not sure how to restrict the email logo upload field to certain mime-types... 🤔 Any idea?

@@ -86,6 +86,7 @@ public function getImageUrl(string $key, bool $useSvg = true): string {

switch ($key) {
case 'logo':
case 'emailLogo':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since svg is causing issues with email it would make sense to not allow to upload it then for an email logo:

https://github.com/nextcloud/server/pull/26871/files#diff-b9d526f6249d406c08009d9de5802b5637194bb66ec759df798dd397f9a422beR222-R225

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you're absolutely right! The refactored version (see my other comment below) has no support for an SVG version.

@jancborchardt
Copy link
Member

I'd generally be ok with adding a setting for this, but I'd pull in @jancborchardt here for some additional checking. 😉

@brueckner @juliushaertl is it not possible to fix the SVG-to-PNG generation?

As usual having a setting means that every single person has to set this, whereas if we would fix the generator, that'd be a whole lot of work saved for our end users.

@brueckner
Copy link
Author

brueckner commented May 31, 2021

I'd generally be ok with adding a setting for this, but I'd pull in @jancborchardt here for some additional checking. 😉

@brueckner @juliushaertl is it not possible to fix the SVG-to-PNG generation?

As usual having a setting means that every single person has to set this, whereas if we would fix the generator, that'd be a whole lot of work saved for our end users.

It's not (only) about the blurry appearance of the logo, as some users have described in other issues. It's much more about that fact that you might want to have a completly different logo for your emails that suits the styling of the mails sent out by Nextcloud. The idea is to use the regular logo by default, so people don't have to use the setting at all, but this is part of a theming app that is supposed to offer customization, so offering some additional customization options won't hurt anyone I suppose. ;)

Sidenote: the current (refactored) verison does not fall back to the regular site logo (yet). I wanted to wait for some feedback on it before going the extra mile.

@szaimen szaimen added this to the Nextcloud 23 milestone Jun 23, 2021
@szaimen
Copy link
Contributor

szaimen commented Jun 23, 2021

@jancborchardt so how to proceed with this then?

@szaimen
Copy link
Contributor

szaimen commented Sep 13, 2021

/rebase

@juliusknorr
Copy link
Member

Having different logos might also be interesting here in cases where the small rendering of the email logo does not work well with the one that is supposed at the login page. The header logo can already be set separately but the one on used the login page might be considered for larger use and have detail that don't work well on the small size of the mail.

@skjnldsv skjnldsv mentioned this pull request Oct 13, 2021
@skjnldsv skjnldsv modified the milestones: Nextcloud 23, Nextcloud 24 Oct 22, 2021
@skjnldsv
Copy link
Member

What's the status here?

@juliusknorr
Copy link
Member

Needs some decision if we want this in with an extra setting.

@franciscomfcmaia
Copy link

Needs some decision if we want this in with an extra setting.

but it seems like there isn't a solution for email logos using an SVG custom logo?

the SVG conversion is broken especially in snap (I respect the safety concerns regarding imagick)

@kowalski7cc

This comment has been minimized.

@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 30, 2021
@skjnldsv skjnldsv mentioned this pull request Mar 24, 2022
@blizzz blizzz mentioned this pull request Mar 31, 2022
This was referenced Apr 7, 2022
@blizzz blizzz modified the milestones: Nextcloud 24, Nextcloud 25 Apr 21, 2022
@M3taKn1ght
Copy link

What is the current Status?

This was referenced Aug 12, 2022
This was referenced Aug 24, 2022
This was referenced Sep 6, 2022
@skjnldsv skjnldsv mentioned this pull request Sep 15, 2022
This was referenced Sep 20, 2022
@blizzz blizzz modified the milestones: Nextcloud 25, Nextcloud 26 Sep 22, 2022
@ChristophWurst ChristophWurst added 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 2. developing Work in progress labels Oct 17, 2022
@ChristophWurst ChristophWurst removed this from the Nextcloud 26 milestone Oct 17, 2022
@skjnldsv skjnldsv added 2. developing Work in progress and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Feb 21, 2024
@skjnldsv
Copy link
Member

As this sounds like a nice feature, the requests for this are quite low. Currently there a no plans to implement such a feature. Thus I will close this ticket for now.

Thanks for the interest in Nextcloud and the effort put into this! 🙇

@skjnldsv skjnldsv closed this Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants