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

AO3-6764 Add kudo mailer preview #4875

Merged
merged 6 commits into from
Aug 15, 2024

Conversation

Bilka2
Copy link
Contributor

@Bilka2 Bilka2 commented Jul 16, 2024

Issue

https://otwarchive.atlassian.net/browse/AO3-6764

Purpose

Add a preview for the kudo mailer. The amount of guest and user kudos is configurable with URL params.

Move the I18n.with_locale call so that the locale dropdown in the preview works (see #4292 for another PR that did this). Update the locale keys to get rid of the html_safe calls.

Testing Instructions

See Jira.

References

PR Limit: 6 out of 5
Using reviewer bonus:
#4720
#4736

Credit

Bilka (he/him)

guest_count = params[:guest_count] || 1
user_count = params[:user_count].to_i || 1
names = Array.new(user_count) { "User#{Faker::Alphanumeric.alpha(number: 8)}" }
hash = { "Work_#{work.id}": { guest_count:, names: } }
Copy link
Contributor Author

@Bilka2 Bilka2 Jul 16, 2024

Choose a reason for hiding this comment

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

This syntax is new to Ruby 3.1 and the rubocop annotation is a false positive. Adding a space would make a different cop complain. This cop accepts the formatting starting with rubocop 1.24.0, we are on 1.22.3.

spec/mailers/user_mailer_spec.rb Outdated Show resolved Hide resolved
reset_mailer
end

Then /^"([^\"]*)" should be emailed$/ do |user|
Given "a locale with translated emails" do
language = Language.find_or_create_by(short: "new", name: "New")
Copy link
Contributor Author

@Bilka2 Bilka2 Jul 16, 2024

Choose a reason for hiding this comment

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

This is a completely new language and locale to prevent the existing translations from interfering with the tests. Otherwise a test might break when a Phrase export changes a translation.

Copy link
Member

@brianjaustin brianjaustin left a comment

Choose a reason for hiding this comment

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

Thanks!

@brianjaustin brianjaustin merged commit 7970419 into otwcode:master Aug 15, 2024
28 of 29 checks passed
@Bilka2 Bilka2 deleted the AO3-6764-kudo-mailer-preview branch August 15, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants