Learning path subscription email fix - #1150
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the learning path subscription email functionality that was causing a ActionView::Template::Error in production. The fix ensures proper template rendering and improves email link styling.
- Replaced dynamic partial rendering with conditional logic to avoid template errors for learning paths
- Added conditional checks to prevent collection-related functionality from appearing in learning path emails
- Restored underline styling to email links for better usability
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/mailers/subscription_mailer.rb | Updates subject line to use localized resource names instead of hardcoded types |
| app/views/subscription_mailer/digest.html.erb | Replaces dynamic partial rendering with conditional logic and adds type checks for collections |
| app/views/subscription_mailer/digest.text.erb | Adds type check to prevent collection functionality for non-supported types |
| app/views/subscription_mailer/_resources.html.erb | Removes text-decoration:none and adds conditional check for description method |
| app/views/subscription_mailer/_events.html.erb | Removes text-decoration:none to restore underlines on links |
| test/mailers/subscription_mailer_test.rb | Adds comprehensive test for learning path digest email functionality |
| test/mailers/previews/subscription_mailer_preview.rb | Adds preview method for learning path digest emails |
| test/fixtures/subscriptions.yml | Adds test fixture for learning path subscriptions |
| test/controllers/subscriptions_controller_test.rb | Updates test to use dynamic count instead of hardcoded value |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <%= link_to(result.title, result, style: 'color: #f57d20; font-weight: bold; text-decoration: none') %><br/> | ||
| <%= truncate(result.description, length: 120, separator: ' ') %><br/><br/> | ||
| <%= link_to(result.title, result, style: 'color: #f57d20; font-weight: bold;') %><br/> | ||
| <% if result.respond_to?(:description) %> |
There was a problem hiding this comment.
Using respond_to? for feature detection is fragile and can hide real issues. Consider using a more explicit check like result.is_a?(Material) or checking if the result has a description attribute directly with result.try(:description) if using Rails.
Suggested change
| <% if result.respond_to?(:description) %> | |
| <% if result.try(:description) %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
ActionView::Template::Errortrying to render the email template when sending a user a digest email for a learning path subscription.Motivation and context
Error reported via Sentry in production.
Checklist
to license it to the TeSS codebase under the
BSD license.