diff --git a/app/assets/images/mailer/batch/referral.png b/app/assets/images/mailer/batch/referral.png new file mode 100755 index 0000000000..8ac008ab7c Binary files /dev/null and b/app/assets/images/mailer/batch/referral.png differ diff --git a/app/jobs/batch/email_update_to_user_job.rb b/app/jobs/batch/email_update_to_user_job.rb new file mode 100644 index 0000000000..9519c9720c --- /dev/null +++ b/app/jobs/batch/email_update_to_user_job.rb @@ -0,0 +1,12 @@ +module Batch + class EmailUpdateToUserJob < ApplicationJob + queue_as :low + + def perform(publisher_id:) + publisher = Publisher.find(publisher_id) + return if publisher.suspended? + + BatchMailer.notification_for_kyc(publisher).deliver_now + end + end +end diff --git a/app/mailers/batch_mailer.rb b/app/mailers/batch_mailer.rb index cf9ec0b4f3..610d313edb 100644 --- a/app/mailers/batch_mailer.rb +++ b/app/mailers/batch_mailer.rb @@ -1,18 +1,11 @@ # Used for designating batch jobs, usually to all publishers - thus we should queue as low class BatchMailer < ApplicationMailer - def update_to_tos(publisher) + def notification_for_kyc(publisher) @publisher = publisher - mail( - to: @publisher.email || @publisher.pending_email, - subject: default_i18n_subject - ) - end + path = Rails.root.join("app/assets/images/mailer/batch/referral.png") + image_file_name = File.basename(path) + attachments.inline[image_file_name] = File.read(path) - def update_to_rates(publisher) - @publisher = publisher - mail( - to: @publisher.email || @publisher.pending_email, - subject: default_i18n_subject - ) + mail(to: @publisher.email || @publisher.pending_email, subject: default_i18n_subject) end end diff --git a/app/views/batch_mailer/notification_for_kyc.html.slim b/app/views/batch_mailer/notification_for_kyc.html.slim new file mode 100644 index 0000000000..272b833cab --- /dev/null +++ b/app/views/batch_mailer/notification_for_kyc.html.slim @@ -0,0 +1,26 @@ +p.salutation= t "publisher_mailer.shared.salutation", name: @publisher.name + +p We have some changes occuring on October 1st, 2019 that you should know about. +p + span 1. Did you know you can earn BAT by referring your audience and other users to install Brave? It’s true! Be sure to log into your creator dashboard to find your code. + = image_tag(attachments["referral.png"]&.url, alt: 'A picture showing how to access your referral link', style: "width:100%; height:auto; border:none;") +p + span September 30th, 2019 will be the last day for a user to install Brave and receive the old rate of $5 BAT equivalent. Afterward, there will be a new rate that depends upon the location of the installer. + a href="https://support.brave.com/hc/en-us/articles/360025284131"= " Check here for the updated rate card." + +p 2. For those of you who have been actively promoting Brave, we are introducing a promoter program that will help you manage referral codes and campaigns. The promoter program will be invite-only at launch, but we will be bringing in our most active promoters to preview the system over the next few weeks. + +p + span 3. Lastly, please take this quick survey and read the next paragraph! + a href="https://www.surveymonkey.com/r/HNFJKVV"= " https://www.surveymonkey.com/r/HNFJKVV" + +p + span If you visit our community or social media pages, you may have noticed that we’ve reached out regarding KYC and connecting your account with Uphold. Starting October 1st, 2019, + strong=" if you do not create and verify your account with Uphold including Uphold Verified Membership, you will not be able to receive direct tips from Brave user funds. " + span A user who attempts to tip a non-verified publisher will not be able to do so, and the BAT will not leave their wallet. We highly recommend that you log into your Creator dashboard and connect your Uphold account as soon as is possible. + +p + span If you have any questions, please join the discussion at + a href="https://community.brave.com/c/brave-rewards/publishers"= " https://community.brave.com/c/brave-rewards/publishers" + +p As always, thank you for coming on this journey with us! diff --git a/app/views/batch_mailer/update_to_rates.html.slim b/app/views/batch_mailer/update_to_rates.html.slim deleted file mode 100644 index 54fc3eca06..0000000000 --- a/app/views/batch_mailer/update_to_rates.html.slim +++ /dev/null @@ -1,84 +0,0 @@ -p.salutation= t "publisher_mailer.shared.salutation", name: @publisher.name - -p Thank you for using the Brave referral system. We have a pretty important change coming up and we wanted to give you advance notice. - -p The per user payout rate will be changing from $5 globally to variable rates depending upon the region of the user - -strong Why are we doing this? - -p - div When we launched the referral program, the goal was to discover which areas would we see the most growth and to test the viability of the referral program as a whole. Our level of zoom was pretty wide (Planet Earth) and the rate was $5 per user, globally. - div Since then, we have launched our Ads program and we want to shift our level of zoom to more regional efforts, with a specific focus on the areas where we can deliver ads. This is a straightforward business decision. - -br -strong When will this occur? -br -p - div We wanted to give you as much advance notice as possible, especially for those of you who are promoting Brave via ads. - br - div Here is the planned timeline - br - div - strong August - div - = "- Initial message (this email) explaining the rate change and timeline" - div - strong September - div - = "- Announcement posts and reminder email regarding the new rates." - div - = "- Rates change" - div - strong October - div - = "- Last payout of $5 referral" - div - strong November - div - = "- The referral dashboard will be updated to reflect the new rates." - div - = "- First rate card based payout" - - - -h3 Here are the rate changes which will be effective on December 1st payout, 2019 - - -p - div Each country is assigned to a tier, each tier has a flat rate. - div Tier 1 - $7.50 (BAT equivalent) - div Tier 2 - $6.50 (BAT equivalent) - div Tier 3 - $5.00 (BAT equivalent) - div Tier 4 - $2.00 (BAT equivalent) - div Tier 5 - $1.00 (BAT equivalent) - -br -div - strong Tier 1 Countries - div United States - -br -div - strong Tier 2 Countries - div Australia, Canada, France, Germany, Ireland, Japan, New Zealand, United Kingdom - -br -div - strong Tier 3 Countries - div Austria, Belgium, Denmark, Finland, Hong Kong, Israel, Italy, Luxembourg, Malta, Netherlands, Norway, Portugal, Republic of Korea, Singapore, Spain, Sweden, Switzerland, Taiwan, - -br -div - strong Tier 4 Countries - div Albania, Argentina, Armenia, Azerbaijan, Belarus, Belize, Bolivia, Bosnia and Herzegovina, Brazil, Bulgaria, Chile, Columbia, Costa Rica, Croatia, Czechia, Ecuador, El Salvador, Estonia, Georgia, Guatemala, Honduras, Hungary, Latvia, Lithuania, Macedonia, Mexico, Montenegro, Nicaragua, Panama, Paraguay, Peru, Poland, Republic of Moldova, Romania, Russia, Saudi Arabia, Serbia, Slovakia, Turkey, Ukraine, Uruguay - -br -div - strong Tier 5 Countries - div If a country has not been listed in any of the other tiers, it will be in Tier 5. - -p We will be communicating about the change as much as possible over the coming months. If you have questions, please do not hesitate to reach out. - -p Thank you for helping us to keep growing! - - diff --git a/app/views/batch_mailer/update_to_tos.html.slim b/app/views/batch_mailer/update_to_tos.html.slim deleted file mode 100644 index 5cb023d2b5..0000000000 --- a/app/views/batch_mailer/update_to_tos.html.slim +++ /dev/null @@ -1,3 +0,0 @@ -p.salutation= t "publisher_mailer.shared.salutation", name: @publisher.name - -p== t(".body") diff --git a/config/locales/en.yml b/config/locales/en.yml index 29960fec76..6c9dd26e88 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -207,75 +207,9 @@ en: Click the button below to log in to your Brave Rewards account. This email contains a private access link that can only be used once. button: Log in to Brave Rewards batch_mailer: - update_to_rates: - subject: Brave Referral Rate Changes - Please Read - update_to_tos: - subject: Updates to the Brave Rewards Terms of Service for Creators - body: > -

- We know it’s not glamorous or exciting, but we’ve made some changes to the Brave Rewards Terms of Service. We'd love for you to take a look so that you can see the whole updated document. But just to make things a little easier, here’s a quick summary of all the recent changes. -

- In June: - - - - - - - - - - - - - -
- We made it clear we would not send BAT belonging to Brave (including UGP grants and referral payments) to anyone who encourages or engages in violence. -
- We explained how UGP grants work in the terms for publishers, where it was previously only in the user terms. -
- We noted that we are the judge of what is and isn’t the prohibited conduct described in §8. -
-
- In April: - - - - - -
- We launched Brave Ads! Now there are terms for advertisers, and the terms for publishers reflects that. -
-
- In March: - - - - - - - - - - - - - -
- We made it possible for people aged 16 and up to use Brave Rewards with a parent’s permission. -
- We rewrote §4, which explains how contributions work. Contributions essentially didn’t change, we just described them better. -
- We also made some formatting changes which you might not notice, but we think makes the whole thing easier to read. -
+ notification_for_kyc: + subject: "Upcoming changes regarding referrals and Uphold Verified Membership" -

This is only a summary. It doesn’t describe everything that changed. You should read the actual real policy.

- -

- Thanks for being a Brave Rewards Creator, -
- The Brave Rewards Team -

publisher_mailer: shared: button_not_working: "If the button above doesn't work, paste this link into your web browser:" diff --git a/lib/tasks/email/kyc_and_referral_update.rake b/lib/tasks/email/kyc_and_referral_update.rake new file mode 100644 index 0000000000..63d9502c83 --- /dev/null +++ b/lib/tasks/email/kyc_and_referral_update.rake @@ -0,0 +1,30 @@ +namespace :email do + task :kyc_and_referral_update, [:id ] => :environment do |t, args| + + publisher = Publisher + if args[:id].present? + publisher = publisher.where("id >= ?", args[:id]) + end + + puts "Emailing #{publisher.count} users" + publisher.order(id: :asc).find_each.with_index do |user, index| + begin + next if user.email.blank? && user.pending_email.blank? + + Batch::EmailUpdateToUserJob.perform_later(publisher_id: user.id) + + print '.' if index % 1000 == 0 + rescue => ex + puts + puts "Rescued from exception: #{ex.message}" + puts "Could not send email to #{user.id} - Restart the job by running the following" + puts + puts " rake email:rate_changes[\"#{user.id}\"]" + break + end + end + + puts + puts "Done" + end +end diff --git a/test/mailers/previews/publisher_mailer_preview.rb b/test/mailers/previews/publisher_mailer_preview.rb index 2361aea61a..f38af14dcb 100644 --- a/test/mailers/previews/publisher_mailer_preview.rb +++ b/test/mailers/previews/publisher_mailer_preview.rb @@ -89,8 +89,8 @@ def update_to_tos BatchMailer.update_to_tos(Publisher.first) end - def update_to_rates - BatchMailer.update_to_rates(Publisher.first) + def kyc_and_referral_update + BatchMailer.notification_for_kyc(Publisher.first) end def submit_appeal