Skip to content

Fix newsletters unwanted CSS and 404 page on preview#9635

Merged
alecslupu merged 15 commits intodecidim:developfrom
mainio:fix/8690
Feb 7, 2023
Merged

Fix newsletters unwanted CSS and 404 page on preview#9635
alecslupu merged 15 commits intodecidim:developfrom
mainio:fix/8690

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

🎩 What? Why?

When using the image with button text and the organization has a primary color defined, the "view on web" template currently shows the CSS as plain text at the beginning of the message.

This is a persistent issue that has been fixed a couple of times before in different situations, see the related issues.

Another issue this fixes is the 404 links in the newsletter previews.

📌 Related Issues

Testing

  • Configure a primary color for the organization
  • Make sure at least one user is subscribed to the newsletters
  • Create a new newsletter using the "image with button" template
  • In the preview section, try clicking the "see on web" or "unsubscribe" links, they now point to # which means they open the same page (I found this better than disabling the links as these links are coming from the translations and I did not want to add any JS to the newsletter template views)
  • Send it
  • From the email, click the "View on web" link
  • See that the extra CSS is no longer shown as plain text and the button is in correct color

@andreslucena
Copy link
Copy Markdown
Member

Let's retake this PR @ahukkanen, can you merge with develop 🙏🏽 ? Thanks

@ahukkanen
Copy link
Copy Markdown
Contributor Author

Done @andreslucena

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Related to the preview links, I think we should also fix the links to the organization page (root path/homepage) that are in the header and footer, as now they're buggy:

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Unwanted CSS

Confirmed locally. Great fix and finally a spec for this one 👏🏽 👏🏽

404 page on preview

Related to the preview links, I think we should also fix the links to the organization page (root path/homepage) that are in the header and footer, as now they're buggy:

  1. By default, on development, they're pointing to http://localhost, and as we're actually by default serving the development web server at http://localhost:3000, this gives a 503 error

  2. If I change it to http://localhost:3000, then the homepage opens in the iframe

You can see both of these behaviors with the video:

newsletter-logo_footer-homepage.mp4

--

We could skip these and also the "notifications" settings link, but I'd prefer to have all the fixes in the same PR so its easier to backport. What do you think?

@ahukkanen
Copy link
Copy Markdown
Contributor Author

Both link URLs are now fixed in the latest commits during the preview.

@andreslucena andreslucena self-assigned this Dec 21, 2022
@ahukkanen ahukkanen requested a review from alecslupu January 31, 2023 19:09
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

Hello @ahukkanen ,
While reviewing this, i have noticed, that the sent newsletter has the wrong url on the organization links.

Testing the NewsletterTe...

Can’t see this email correctly? View it on the website 
( http://alec****u.g*.ro:3000/newsletters/6 ).

Hand-Barton 
( http://alec****u.g*.ro/?utm_source=alec****u.g*.ro&utm_campaign=6 )


Testing the NewsletterTesting the NewsletterTesting
the NewsletterTesting the NewsletterTesting the NewsletterTesting
the NewsletterTesting the NewsletterTesting the NewsletterTesting
the NewsletterTesting the NewsletterTesting the NewsletterTesting
the NewsletterTesting the NewsletterTesting the NewsletterTesting
the Newsletter

This is also valid for the footer organization link.

I could not verify the fix for : #8727, as the not sent newsletter is still being redirected 404 by

raise ActionController::RoutingError, "Not Found" unless newsletter.sent?

Regarding The CSS line, I can confirm is being correctly rendered.

<style>
table.button table td {
 background: #ef604d !important
}
</style>

The requested changes are referring to organization url .
I can also confirm that if the instance has the following

  config.action_mailer.default_url_options = { port: 3300 }
  config.action_controller.default_url_options = { port: 3300 }

All the links are being generated as it should.

Thanks

@ahukkanen
Copy link
Copy Markdown
Contributor Author

@alecslupu Those issues should be fixed by the latest commits.

@ahukkanen ahukkanen requested a review from alecslupu February 4, 2023 09:21
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

The preview issues are fixed now.

@alecslupu alecslupu self-requested a review February 6, 2023 08:08
alecslupu
alecslupu previously approved these changes Feb 6, 2023
@ahukkanen ahukkanen requested a review from alecslupu February 7, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: admin module: core type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

404 error when clicking on the web version of a not sent newsletter Unwanted css line on website version of newsletter

3 participants