Skip to content

Commit

Permalink
Send out referral and identity update (#2247)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cory McDonald authored Sep 23, 2019
1 parent 9f6b5f6 commit e764140
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 169 deletions.
Binary file added app/assets/images/mailer/batch/referral.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions app/jobs/batch/email_update_to_user_job.rb
Original file line number Diff line number Diff line change
@@ -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
17 changes: 5 additions & 12 deletions app/mailers/batch_mailer.rb
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions app/views/batch_mailer/notification_for_kyc.html.slim
Original file line number Diff line number Diff line change
@@ -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!
84 changes: 0 additions & 84 deletions app/views/batch_mailer/update_to_rates.html.slim

This file was deleted.

3 changes: 0 additions & 3 deletions app/views/batch_mailer/update_to_tos.html.slim

This file was deleted.

70 changes: 2 additions & 68 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
<p>
We know it’s not glamorous or exciting, but we’ve made some changes to the <a href="https://basicattentiontoken.org/publisher-terms-of-service/">Brave Rewards Terms of Service.</a> 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.
</p>
In June:
<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td style="vertical-align:top;">&ndash;</td>
<td>
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.
</td>
</tr>
<tr>
<td style="vertical-align:top;">&ndash;</td>
<td>
We explained how UGP grants work in the terms for publishers, where it was previously only in the user terms.
</td>
</tr>
<tr>
<td style="vertical-align:top;">&ndash;</td>
<td>
We noted that we are the judge of what is and isn’t the prohibited conduct described in §8.
</td>
</tr>
</table>
<br/>
In April:
<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td style="vertical-align:top;">&ndash;</td>
<td>
We launched Brave Ads! Now there are terms for advertisers, and the terms for publishers reflects that.
</td>
</tr>
</table>
<br/>
In March:
<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td style="vertical-align:top;">&ndash;</td>
<td>
We made it possible for people aged 16 and up to use Brave Rewards with a parent’s permission.
</td>
</tr>
<tr>
<td style="vertical-align:top;">&ndash;</td>
<td>
We rewrote §4, which explains how contributions work. Contributions essentially didn’t change, we just described them better.
</td>
</tr>
<tr>
<td style="vertical-align:top;">&ndash;</td>
<td>
We also made some formatting changes which you might not notice, but we think makes the whole thing easier to read.
</td>
</tr>
</table>
notification_for_kyc:
subject: "Upcoming changes regarding referrals and Uphold Verified Membership"

<p>This is only a summary. It doesn’t describe everything that changed. You should read the <a href="https://basicattentiontoken.org/publisher-terms-of-service/">actual real policy.</a></p>
<p>
Thanks for being a Brave Rewards Creator,
<br/>
The Brave Rewards Team
</p>
publisher_mailer:
shared:
button_not_working: "If the button above doesn't work, paste this link into your web browser:"
Expand Down
30 changes: 30 additions & 0 deletions lib/tasks/email/kyc_and_referral_update.rake
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions test/mailers/previews/publisher_mailer_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e764140

Please sign in to comment.