-
-
-
this.handleDataSelect(2)}
- style={{
- backgroundColor: "#9966FF",
- borderRadius: "50%",
- cursor: "pointer",
- height: "16px",
- marginRight: "4px",
- marginTop: "4px",
- opacity: confirmationsOpacity,
- width: "16px"
- }}
- />
-
- Confirmation
-
-
-
this.handleDataSelect(1)}
- style={{ display: "flex" }}
- >
-
-
- Installs
-
-
-
this.handleDataSelect(0)}
- style={{ display: "flex" }}
- >
-
-
- Downloads
-
-
-
-
-
- );
- }
-}
-
-function ReferralCodeSelect(props) {
- const dropdownOptions = props.referralCodes.map((referralCode, index) => (
-
- ));
- if (props.referralCodes.length > 0) {
- return (
-
- );
- } else {
- return
;
- }
-}
diff --git a/app/javascript/views/routes.ts b/app/javascript/views/routes.ts
index 97b21d2b26..c64ccee749 100644
--- a/app/javascript/views/routes.ts
+++ b/app/javascript/views/routes.ts
@@ -1,5 +1,12 @@
/* tslint:disable:object-literal-sort-keys */
export default {
+ admin: {
+ promo_registrations: {
+ show: {
+ path: "/publishers/{publisher_id}/promo_registrations/for_referral_code?referral_code={referral_code}"
+ }
+ }
+ },
payments: {
path: "/partners/payments",
invoices: {
@@ -18,8 +25,7 @@ export default {
publishers: {
promo_registrations: {
show: {
- path:
- "{id}/promo_registrations/for_referral_code?referral_code={referral_code}"
+ path: "{id}/promo_registrations/for_referral_code?referral_code={referral_code}"
}
}
}
diff --git a/app/jobs/promo/register_channel_for_promo_job.rb b/app/jobs/promo/register_channel_for_promo_job.rb
new file mode 100644
index 0000000000..0320bf7d1b
--- /dev/null
+++ b/app/jobs/promo/register_channel_for_promo_job.rb
@@ -0,0 +1,15 @@
+# Registers a single channel for a promo immediately after verification
+module Promo
+ class RegisterChannelForPromoJob < ApplicationJob
+ include PromosHelper
+ queue_as :default
+
+ def perform(channel:)
+ if Promo::PublisherChannelsRegistrar.new(publisher: channel.publisher).perform
+ PromoMailer.new_channel_registered_2018q1(channel.publisher, channel).deliver_later
+ else
+ Rails.logger.warn("Failed to register newly verified channel #{channel} with promo server")
+ end
+ end
+ end
+end
diff --git a/app/jobs/promo/register_publisher_for_promo_job.rb b/app/jobs/promo/register_publisher_for_promo_job.rb
new file mode 100644
index 0000000000..7545196dbd
--- /dev/null
+++ b/app/jobs/promo/register_publisher_for_promo_job.rb
@@ -0,0 +1,19 @@
+# Used to register a publisher with > 5 channels async
+module Promo
+ class RegisterPublisherForPromoJob < ApplicationJob
+ include PromosHelper
+ queue_as :default
+
+ def perform(publisher:)
+ return unless publisher.promo_enabled_2018q1
+ Rails.logger.info("Registering publisher #{publisher.id} for promo async.")
+
+ if Promo::PublisherChannelsRegistrar.new(publisher: publisher).perform
+ promo_enabled_channels = publisher.channels.joins(:promo_registration)
+ PromoMailer.promo_activated_2018q1_verified(publisher, promo_enabled_channels).deliver
+ else
+ Rails.logger.warn("Failed to register publisher #{publisher.id} with promo server async.")
+ end
+ end
+ end
+end
diff --git a/app/jobs/promo/update_status.rb b/app/jobs/promo/update_status.rb
new file mode 100644
index 0000000000..d7608d87db
--- /dev/null
+++ b/app/jobs/promo/update_status.rb
@@ -0,0 +1,22 @@
+# Registers a single channel for a promo immediately after verification
+module Promo
+ class UpdateStatus < ApplicationJob
+ queue_as :default
+
+ def perform(id:, status:)
+ client = Promo::Client.new
+
+ # Remove previous states, this prevents from any unique index constraints from being violated
+ states = client.owner_state.find(id: id)
+ states.each do |state|
+ client.owner_state.destroy(id: id, state: state)
+ end
+
+ if status == PublisherStatusUpdate::SUSPENDED
+ client.owner_state.create(id: id, state: Promo::Models::OwnerState::State::SUSPEND)
+ elsif status == PublisherStatusUpdate::ONLY_USER_FUNDS
+ client.owner_state.create(id: id, state: Promo::Models::OwnerState::State::NO_UGP)
+ end
+ end
+ end
+end
diff --git a/app/jobs/register_channel_for_promo_job.rb b/app/jobs/register_channel_for_promo_job.rb
deleted file mode 100644
index 9429929d8d..0000000000
--- a/app/jobs/register_channel_for_promo_job.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# Registers a single channel for a promo immediately after verification
-class RegisterChannelForPromoJob < ApplicationJob
- include PromosHelper
- queue_as :default
-
- def perform(channel:)
- if Promo::PublisherChannelsRegistrar.new(publisher: channel.publisher).perform
- PromoMailer.new_channel_registered_2018q1(channel.publisher, channel).deliver_later
- else
- Rails.logger.warn("Failed to register newly verified channel #{channel} with promo server")
- end
- end
-end
diff --git a/app/jobs/register_publisher_for_promo_job.rb b/app/jobs/register_publisher_for_promo_job.rb
deleted file mode 100644
index 2a21158f6f..0000000000
--- a/app/jobs/register_publisher_for_promo_job.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# Used to register a publisher with > 5 channels async
-class RegisterPublisherForPromoJob < ApplicationJob
- include PromosHelper
- queue_as :default
-
- def perform(publisher:)
- return unless publisher.promo_enabled_2018q1
- Rails.logger.info("Registering publisher #{publisher.id} for promo async.")
-
- if Promo::PublisherChannelsRegistrar.new(publisher: publisher).perform
- promo_enabled_channels = publisher.channels.joins(:promo_registration)
- PromoMailer.promo_activated_2018q1_verified(publisher, promo_enabled_channels).deliver
- else
- Rails.logger.warn("Failed to register publisher #{publisher.id} with promo server async.")
- end
- end
-end
diff --git a/app/models/channel.rb b/app/models/channel.rb
index 6d55b4a491..3f515cf540 100644
--- a/app/models/channel.rb
+++ b/app/models/channel.rb
@@ -373,7 +373,7 @@ def clear_verified_at_if_necessary
end
def register_channel_for_promo
- RegisterChannelForPromoJob.new.perform(channel: self)
+ Promo::RegisterChannelForPromoJob.new.perform(channel: self)
end
def notify_slack
diff --git a/app/models/json_builders/channels_json_builder_v2.rb b/app/models/json_builders/channels_json_builder_v2.rb
index 07f119b8d1..b0ffb987f1 100644
--- a/app/models/json_builders/channels_json_builder_v2.rb
+++ b/app/models/json_builders/channels_json_builder_v2.rb
@@ -57,7 +57,7 @@ def include_verified_channel(verified_channel)
verified_channel.details.channel_identifier,
true,
false,
- "00000000-0000-0000-0000-000000000000",
+ Rails.env.development? || Rails.env.staging? ? verified_channel.publisher.uphold_connection.address : "00000000-0000-0000-0000-000000000000",
site_banner_details(verified_channel),
])
end
diff --git a/app/models/publisher_status_update.rb b/app/models/publisher_status_update.rb
index 99646cbfc0..c9dd7bfccb 100644
--- a/app/models/publisher_status_update.rb
+++ b/app/models/publisher_status_update.rb
@@ -11,6 +11,8 @@ class PublisherStatusUpdate < ApplicationRecord
ALL_STATUSES = [CREATED, ONBOARDING, ACTIVE, SUSPENDED, LOCKED, NO_GRANTS, DELETED, HOLD, ONLY_USER_FUNDS].freeze
+ USER_SELECTABLE = [ACTIVE, SUSPENDED, NO_GRANTS, HOLD, ONLY_USER_FUNDS].freeze
+
DESCRIPTIONS = {
CREATED => "User has signed up but not signed in.",
ONBOARDING => "User has signed in but not completed entering their information",
@@ -30,6 +32,20 @@ class PublisherStatusUpdate < ApplicationRecord
validates :publisher_id, presence: true
+ # After a user creates a new status then we should check to see the previous staus and call backing server
+ after_create :update_services, if: :should_update?
+
+ # Queues a job to call the promo server to update the owner state for the publisher based on the status
+ #
+ # @return [nil]
+ def update_services
+ Promo::UpdateStatus.perform_later(id: publisher_id, status: status)
+ end
+
+ def should_update?
+ [ACTIVE, SUSPENDED, ONLY_USER_FUNDS].include?(status)
+ end
+
def to_s
status
end
diff --git a/app/services/base_api_client.rb b/app/services/base_api_client.rb
index 8260cf48da..41f6106116 100644
--- a/app/services/base_api_client.rb
+++ b/app/services/base_api_client.rb
@@ -1,4 +1,5 @@
class BaseApiClient < BaseService
+ private
# Make a GET request.
#
# path - [String] the path relative to the endpoint
@@ -47,13 +48,18 @@ def delete(path, options = {})
request(:delete, path, form: options)
end
- private
-
def api_base_uri
raise "specify me"
end
+ def perform_offline?
+ false
+ end
+
def request(method, path, payload = {})
+ # Mock out the request
+ return Struct.new(:body).new("{}") if perform_offline?
+
@connection.send(method) do |req|
req.url [api_base_uri, path].join('')
req.headers["Authorization"] = api_authorization_header
diff --git a/app/services/channels/contest_channel.rb b/app/services/channels/contest_channel.rb
index 56a2193db8..c888aeddc0 100644
--- a/app/services/channels/contest_channel.rb
+++ b/app/services/channels/contest_channel.rb
@@ -14,7 +14,7 @@ def perform
suspended: @channel.publisher.suspended?
)
- raise SuspendedPublisherError if @channel.publisher.suspended?
+ raise SuspendedPublisherError if @channel.publisher.suspended? || @channel.publisher.only_user_funds?
ActiveRecord::Base.transaction do
@contested_by.verified = false
diff --git a/app/services/payout_report_publisher_includer.rb b/app/services/payout_report_publisher_includer.rb
index 0ac9e5464a..86e0537a62 100644
--- a/app/services/payout_report_publisher_includer.rb
+++ b/app/services/payout_report_publisher_includer.rb
@@ -6,7 +6,7 @@ def initialize(payout_report:, publisher:, should_send_notifications:)
end
def perform
- return if !@publisher.has_verified_channel? || @publisher.locked? || @publisher.excluded_from_payout? || @publisher.no_grants? || @publisher.hold?
+ return if !@publisher.has_verified_channel? || @publisher.locked? || @publisher.excluded_from_payout? || @publisher.hold?
publisher_has_unsettled_balance = false
create_uphold_card_for_default_currency_if_needed
diff --git a/app/services/promo/client.rb b/app/services/promo/client.rb
index ac3a3df7bc..025b77a9ed 100644
--- a/app/services/promo/client.rb
+++ b/app/services/promo/client.rb
@@ -10,8 +10,8 @@ def owner_state
private
- def perform_offline
- true
+ def perform_offline?
+ Rails.application.secrets[:api_promo_base_uri].blank?
end
def api_base_uri
diff --git a/app/services/promo/models/owner_state.rb b/app/services/promo/models/owner_state.rb
index 5b90c9fc0a..1641b99fc2 100644
--- a/app/services/promo/models/owner_state.rb
+++ b/app/services/promo/models/owner_state.rb
@@ -45,7 +45,7 @@ def create(id:, state:)
# Removes the state for the specified owner
#
# @param [String] id The publisher id
- # @state [Promo::Models::OwnerState::State] state The state to remove from the owner.
+ # @param [Promo::Models::OwnerState::State] state The state to remove from the owner.
#
# @return [true] if destroy was a success
def destroy(id:, state:)
diff --git a/app/views/admin/publishers/publisher_status_updates/index.html.slim b/app/views/admin/publishers/publisher_status_updates/index.html.slim
index 063451178d..2856d6a8c7 100644
--- a/app/views/admin/publishers/publisher_status_updates/index.html.slim
+++ b/app/views/admin/publishers/publisher_status_updates/index.html.slim
@@ -2,52 +2,60 @@
h5.admin-header Change current status for #{@publisher.name}
-- if @publisher.suspended?
- .my-3
- p.alert.alert-warning
- = "If you are planning on unsuspending this user please provide evidence and justification for your actions. "
- br
- br
- = "If you believe this user is a potential outlier please contact the appropriate group and alert them."
-- else
- .my-3
- p.alert.alert-warning
- = "If you are planning on suspending this user please provide evidence and justification for your actions. This may come in the form of excel, git, or a reasonable explaination of the users misdeeds."
- br
- br
- = "Please view more information about the publisher guidelines here."
- br
- = link_to "https://community.brave.com/t/a-note-to-publishers/48733", "https://community.brave.com/t/a-note-to-publishers/48733"
-= form_for(@publisher, url: admin_publisher_publisher_status_updates_path(@publisher.id), method: :create) do |f|
- .form-group
- = label_tag(:status_label, "Status")
- = select_tag(:publisher_status, options_for_select(PublisherStatusUpdate::ALL_STATUSES, @publisher.last_status_update), class: "form-control")
+- if @publisher.only_user_funds?
+ p.alert.alert-warning
+ = "This user has been placed into an #{@publisher.last_status_update} status. Once a user has been placed into this status it is not possible to remove."
+ br
+ br
+ = "If you believe this was a mistake please contact the appropriate product owners and engage the engineering team."
- .form-group
- = label_tag(:note_label, "Include a note: ")
- = text_area_tag(:note, '', class: 'form-control', rows: 5, required: true)
- .form-group
- label
- = check_box_tag("send_email", true)
- = " Send email (suspended & hold only)"
- = f.submit("Update Status", class: 'btn btn-primary')
+- else
+ - if @publisher.suspended?
+ .my-3
+ p.alert.alert-warning
+ = "If you are planning on unsuspending this user please provide evidence and justification for your actions. "
+ br
+ br
+ = "If you believe this user is a potential outlier please contact the appropriate group and alert them."
+ - else
+ .my-3
+ p.alert.alert-warning
+ = "If you are planning on suspending this user please provide evidence and justification for your actions. This may come in the form of excel, git, or a reasonable explaination of the users misdeeds."
+ br
+ br
+ = "Please view more information about the publisher guidelines here."
+ br
+ = link_to "https://community.brave.com/t/a-note-to-publishers/48733", "https://community.brave.com/t/a-note-to-publishers/48733"
+ = form_for(@publisher, url: admin_publisher_publisher_status_updates_path(@publisher.id), method: :create) do |f|
+ .form-group
+ = label_tag(:status_label, "Status")
+ = select_tag(:publisher_status, options_for_select(PublisherStatusUpdate::USER_SELECTABLE, @publisher.last_status_update), class: "form-control")
+ .form-group
+ = label_tag(:note_label, "Include a note: ")
+ = text_area_tag(:note, '', class: 'form-control', rows: 5, required: true)
+ .form-group
+ label
+ = check_box_tag("send_email", true)
+ = " Send email (suspended & hold only)"
+ = f.submit("Update Status", class: 'btn btn-primary')
-.legend.my-5
- h2.mb-0 Legend
- table.table
- thead
- tr
- th Status
- th Description
- tbody
- - PublisherStatusUpdate::DESCRIPTIONS.each do |description|
+
+ .legend.my-5
+ h2.mb-0 Legend
+ table.table
+ thead
tr
- td
- span class=status_badge_class(description.first)
- = description.first
- td= description.second
+ th Status
+ th Description
+ tbody
+ - PublisherStatusUpdate::DESCRIPTIONS.each do |description|
+ tr
+ td
+ span class=status_badge_class(description.first)
+ = description.first
+ td= description.second
hr
diff --git a/app/views/admin/publishers/referrals/index.html.slim b/app/views/admin/publishers/referrals/index.html.slim
new file mode 100644
index 0000000000..6de1075c39
--- /dev/null
+++ b/app/views/admin/publishers/referrals/index.html.slim
@@ -0,0 +1,9 @@
+- if @publisher.promo_registrations.present?
+ = hidden_field_tag 'referrals-hidden-tags', @publisher.promo_registrations.has_stats.pluck(:referral_code).to_json
+ = hidden_field_tag 'publisher_id', @publisher.id
+.row
+ .col.bot-marg
+ .dashboard-panel--wrapper
+ #channel-referrals-stats-chart
+ canvas id="channel-referrals-stats-chart-canvas"
+= javascript_pack_tag 'views/admin/referrals/Referrals'
diff --git a/app/views/admin/publishers/show.html.slim b/app/views/admin/publishers/show.html.slim
index b0feb777f5..db0b44d123 100644
--- a/app/views/admin/publishers/show.html.slim
+++ b/app/views/admin/publishers/show.html.slim
@@ -74,6 +74,15 @@ hr
.db-info-row
.db-field = "Referral confirmations:"
.db-value = publisher_referral_totals(@publisher)[PromoRegistration::FINALIZED]
+ .db-info-row
+ .db-field
+ = "Referral owner status"
+ span data-tooltip="If the user is 'suspended' or 'no-ugp' this means their promos will redirect to the homepage"
+ = fa_icon 'question-circle', class: 'mx-1'
+ = ": "
+
+ .db-value= @referral_owner_status
+
#statement-section.split-row
h3.admin-header = "Statements"
.statement
diff --git a/app/views/admin/referrals/index.html.slim b/app/views/admin/referrals/index.html.slim
deleted file mode 100644
index eabf47a5e6..0000000000
--- a/app/views/admin/referrals/index.html.slim
+++ /dev/null
@@ -1 +0,0 @@
-= javascript_pack_tag 'views/referrals/Referrals'
\ No newline at end of file
diff --git a/app/views/admin/referrals/show.html.erb b/app/views/admin/referrals/show.html.erb
deleted file mode 100644
index ad772796b3..0000000000
--- a/app/views/admin/referrals/show.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<%= content_tag :div,
- id: "referrals_data",
- data: @data.to_json do %>
-<%= javascript_pack_tag 'views/admin/referrals/Referrals' %>
-<% end %>
\ No newline at end of file
diff --git a/app/views/admin/referrals/show.html.slim b/app/views/admin/referrals/show.html.slim
deleted file mode 100644
index 52f1aab114..0000000000
--- a/app/views/admin/referrals/show.html.slim
+++ /dev/null
@@ -1 +0,0 @@
-= javascript_pack_tag 'views/admin/referrals/Referrals'
\ No newline at end of file
diff --git a/app/views/publishers/_channel.html.slim b/app/views/publishers/_channel.html.slim
new file mode 100644
index 0000000000..85388b261f
--- /dev/null
+++ b/app/views/publishers/_channel.html.slim
@@ -0,0 +1,90 @@
+.row.channel-row id=("channel_row_#{channel.id}") data-remove-message=(t("shared.channel_removed"))
+ .col.mb-4
+ div class=("channel-panel channel-#{channel_verification_status(channel)}")
+ .channel-panel--intro
+ .channel-panel--intro-icon
+ img src=(channel_type_icon_url(channel)) width=16 height=16
+ .channel-panel--intro-body
+ = channel_type(channel).upcase
+ - if channel.verified?
+ - if current_publisher.promo_status(promo_running?) == :active && channel.promo_enabled? && !current_publisher.only_user_funds?
+ .channel--promo-info-container
+ = link_to("", tweet_url(channel.promo_registration.referral_code), target: :_blank, class: "promo-share-button promo-share-button-twitter")
+ = link_to("", facebook_url(channel.promo_registration.referral_code), target: :_blank, class: "promo-share-button promo-share-button-facebook")
+ .referral-link-url.promo-info-item
+ span= https_referral_url(channel.promo_registration.referral_code)
+ .referral-link-button.referral-link-button-desktop.promo-info-item
+ span= t("promo.shared.referral_link")
+ .referral-link-button.referral-link-button-mobile.promo-info-item.copy-button data-clipboard-text="#{https_referral_url(channel.promo_registration.referral_code)}"
+ span= t("promo.shared.referral_link")
+ .referral-link-copy-button.promo-info-item.copy-button data-clipboard-text="#{https_referral_url(channel.promo_registration.referral_code)}"
+ span= t("promo.shared.copy")
+ / Need to tell the users that it will take 48 hours for their verified channel to appear in the web browser
+ - if channel.created_at > 2.days.ago
+ .channel-info
+ .info-popup
+ .info--details
+ // JS will break if the next two elements aren't siblings
+ span.info--what-happened=t(".verification_status_title")
+ span.info--explanation
+ span.verification-failed-explanation--content
+ = t(".verification_status")
+ - else
+ .channel-status.float-right
+ .bat-channel
+ h4.bat-channel--amount id=("channel_amount_bat_#{channel.details.channel_identifier}")
+ = publisher_channel_bat_balance(current_publisher, channel.details.channel_identifier)
+ span.bat-channel--currency= " BAT"
+ .bat-channel--period
+ = t(".channel_balance_period")
+ .channel-summary
+ h3= channel.publication_title
+ .channel-details
+ .added-date
+ = t(".added", date: channel.created_at.to_date.iso8601)
+ span.separator
+ = ' | '
+ a.remove-channel href="#" data-channel-id=(channel.id)
+ = t(".remove_verified")
+ script type="text/html" data-js-channel-removal-confirmation-template=(channel.id)
+ = render "publishers/remove_channel_modal", channel: channel
+ = form_for(channel, html: {id: "remove_channel_#{channel.id}"}) do |f|
+ - elsif channel.verification_failed?
+ .channel-status.float-right
+ .verification-failed
+ .verification-failed--header
+ = t("helpers.channels.verification_failure")
+ .verification-failed--details
+ // JS will break if the next two elements aren't siblings
+ span.verification-failed--what-happened=t("helpers.channels.verification_failure_what_happened")
+ span.verification-failed--explanation
+ span.verification-failed-explanation--content
+ = channel_verification_details(channel).upcase_first
+ span.separator
+ = ' | '
+ a.remove-channel href="#" data-channel-id=(channel.id)
+ = t(".remove_verified")
+ script type="text/html" data-js-channel-removal-confirmation-template=(channel.id)
+ = render "publishers/remove_channel_modal", channel: channel
+ = form_for(channel, html: {id: "remove_channel_#{channel.id}"}) do |f|
+ = link_to(t(".try_again"), channel_next_step_path(channel), class: "btn btn-primary try-again")
+ - elsif channel.verification_pending?
+ .channel-status.float-right
+ = t("shared.channel_contested", time_until_transfer: time_until_transfer(channel))
+ - elsif channel.verification_awaiting_admin_approval?
+ .channel-status.float-right
+ = t("helpers.channels.verification_awaiting_admin_approval")
+ - else
+ .channel-status.float-right
+ = link_to(t(".lets_finish"), channel_next_step_path(channel), class: "btn btn-primary")
+ .channel-progress.float-right
+ .one-more-step= t(".one_more_step")
+ - unless channel.verified
+ .channel-summary
+ h3.unverified = channel.publication_title
+ - if channel.contested_by_channel
+ .channel-contested
+ p = t "shared.channel_contested_by", time_until_transfer: time_until_transfer(channel.contested_by_channel),
+ verified_by_email: channel.contested_by_channel.publisher.email
+ a.reject_transfer href=token_reject_transfer_url(channel, channel.contest_token)
+ = t ".reject_transfer"
diff --git a/app/views/publishers/_promo_panel.html.slim b/app/views/publishers/_promo_panel.html.slim
new file mode 100644
index 0000000000..48bfd879e7
--- /dev/null
+++ b/app/views/publishers/_promo_panel.html.slim
@@ -0,0 +1,45 @@
+.col-md.mb-4
+ .promo-panel
+ - if current_publisher.promo_status(promo_running?) == :inactive
+ .promo-panel-item.promo-panel-item-info
+ #promo-limited-time= t("promo.activate.sub_header_one")
+ h3#promo-header= t("promo.activate.header")
+ #promo-referring-fans= t("promo.activate.sub_header_two")
+ .promo-panel-item.promo-panel-item-button
+ = form_for current_publisher, { method: :get, url: promo_registrations_path } do |f|
+ = f.submit(t("promo.activate.button-dashboard").upcase, class: "btn btn-primary", id: "activate-promo-dashboard-button" )
+ - elsif current_publisher.only_user_funds?
+
+ .promo-panel-item.promo-panel-item-alert
+ #promo-panel-alert
+ == t("promo.dashboard.violation")
+
+ - elsif current_publisher.has_verified_channel?
+ - publisher_referral_totals = publisher_referral_totals(current_publisher)
+ .promo-flex-col
+ .promo-flex-row.promo-flex-row-main
+ .promo-flex-col.promo-panel-title
+ .promo-panel-title-item
+ =t("promo.dashboard.referral")
+ .promo-flex-row.promo-flex-row-sub
+ =t("promo.dashboard.check_statement")
+ .promo-flex-stats
+ .promo-flex-col.promo-flex-col-downloaded
+ .promo-panel-header title=t("promo.dashboard.tooltip.downloaded")
+ =t("promo.dashboard.downloaded").upcase
+ .promo-panel-number
+ = publisher_referral_totals[PromoRegistration::RETRIEVALS]
+ .promo-flex-col.promo-flex-col-installed
+ .promo-panel-header title=t("promo.dashboard.tooltip.installed")
+ =t("promo.dashboard.installed").upcase
+ .promo-panel-number
+ = publisher_referral_totals[PromoRegistration::FIRST_RUNS]
+ .promo-flex-col.promo-flex-col-confirmed
+ .promo-panel-header title=t("promo.dashboard.tooltip.confirmed")
+ =t("promo.dashboard.confirmed").upcase
+ .promo-panel-number
+ = publisher_referral_totals[PromoRegistration::FINALIZED]
+ - else
+ .promo-panel-item.promo-panel-item-alert
+ #promo-panel-alert
+ = t("promo.dashboard.add_channel")
diff --git a/app/views/publishers/home.html.slim b/app/views/publishers/home.html.slim
index 25cdae9474..25ecd4f4a7 100644
--- a/app/views/publishers/home.html.slim
+++ b/app/views/publishers/home.html.slim
@@ -37,7 +37,7 @@ script type="text/html" id="confirm_default_currency_modal_wrapper"
= image_tag("bat-logo@2x.png", class: "", width: 60, height: 60)
.amounts
h4.balance-header
- span = t ".balance_pending"
+ span = t(".balance_pending")
.bat
span.bat-amount#bat_amount = publisher_overall_bat_balance(current_publisher)
span.bat-code= " BAT"
@@ -46,51 +46,14 @@ script type="text/html" id="confirm_default_currency_modal_wrapper"
- if payout_in_progress?
.payout_in_progress
span
- i = t ".payout_in_progress"
+ i = t(".payout_in_progress")
- else
.next_deposit_date
- span = t ".next_deposit_date"
+ span = t(".next_deposit_date")
span = next_deposit_date
+
- if promo_running?
- .col-md.mb-4
- .promo-panel
- - if current_publisher.promo_status(promo_running?) == :inactive
- .promo-panel-item.promo-panel-item-info
- #promo-limited-time= t("promo.activate.sub_header_one")
- h3#promo-header= t("promo.activate.header")
- #promo-referring-fans= t("promo.activate.sub_header_two")
- .promo-panel-item.promo-panel-item-button
- = form_for current_publisher, { method: :get, url: promo_registrations_path } do |f|
- = f.submit(t("promo.activate.button-dashboard").upcase, class: "btn btn-primary", id: "activate-promo-dashboard-button" )
- - elsif current_publisher.has_verified_channel?
- - publisher_referral_totals = publisher_referral_totals(current_publisher)
- .promo-flex-col
- .promo-flex-row.promo-flex-row-main
- .promo-flex-col.promo-panel-title
- .promo-panel-title-item
- =t("promo.dashboard.referral")
- .promo-flex-row.promo-flex-row-sub
- =t("promo.dashboard.check_statement")
- .promo-flex-stats
- .promo-flex-col.promo-flex-col-downloaded
- .promo-panel-header title=t("promo.dashboard.tooltip.downloaded")
- =t("promo.dashboard.downloaded").upcase
- .promo-panel-number
- = publisher_referral_totals[PromoRegistration::RETRIEVALS]
- .promo-flex-col.promo-flex-col-installed
- .promo-panel-header title=t("promo.dashboard.tooltip.installed")
- =t("promo.dashboard.installed").upcase
- .promo-panel-number
- = publisher_referral_totals[PromoRegistration::FIRST_RUNS]
- .promo-flex-col.promo-flex-col-confirmed
- .promo-panel-header title=t("promo.dashboard.tooltip.confirmed")
- =t("promo.dashboard.confirmed").upcase
- .promo-panel-number
- = publisher_referral_totals[PromoRegistration::FINALIZED]
- - else
- .promo-panel-item.promo-panel-item-alert
- #promo-panel-alert
- = t("promo.dashboard.add_channel")
+ = render partial: 'promo_panel'
- elsif current_publisher.channels.empty?
.col-md.mb-4
.add-channel-cta
@@ -190,100 +153,11 @@ script type="text/html" id="confirm_default_currency_modal_wrapper"
/ Don't show if none of the promo registrations has a valid stat
- - if current_publisher.promo_registrations.present? && current_publisher.promo_registrations.has_stats.select { |promo_registration| promo_registration.stats_by_date.present? }.present?
+ - if !current_publisher.only_user_funds? && current_publisher.promo_registrations.present? && current_publisher.promo_registrations.has_stats.select { |promo_registration| promo_registration.stats_by_date.present? }.present?
= render "publishers/referral_charts", current_publisher: current_publisher
- current_publisher.channels.visible.each do |channel|
- .row.channel-row id=("channel_row_#{channel.id}") data-remove-message=(t("shared.channel_removed"))
- .col.mb-4
- div class=("channel-panel channel-#{channel_verification_status(channel)}")
- .channel-panel--intro
- .channel-panel--intro-icon
- img src=(channel_type_icon_url(channel)) width=16 height=16
- .channel-panel--intro-body
- = channel_type(channel).upcase
- - if channel.verified?
- - if current_publisher.promo_status(promo_running?) == :active && channel.promo_enabled? && !current_publisher.only_user_funds?
- .channel--promo-info-container
- = link_to("", tweet_url(channel.promo_registration.referral_code), target: :_blank, class: "promo-share-button promo-share-button-twitter")
- = link_to("", facebook_url(channel.promo_registration.referral_code), target: :_blank, class: "promo-share-button promo-share-button-facebook")
- .referral-link-url.promo-info-item
- span= https_referral_url(channel.promo_registration.referral_code)
- .referral-link-button.referral-link-button-desktop.promo-info-item
- span= t("promo.shared.referral_link")
- .referral-link-button.referral-link-button-mobile.promo-info-item.copy-button data-clipboard-text="#{https_referral_url(channel.promo_registration.referral_code)}"
- span= t("promo.shared.referral_link")
- .referral-link-copy-button.promo-info-item.copy-button data-clipboard-text="#{https_referral_url(channel.promo_registration.referral_code)}"
- span= t("promo.shared.copy")
- / Need to tell the users that it will take 48 hours for their verified channel to appear in the web browser
- - if channel.created_at > 2.days.ago
- .channel-info
- .info-popup
- .info--details
- // JS will break if the next two elements aren't siblings
- span.info--what-happened=t(".channel.verification_status_title")
- span.info--explanation
- span.verification-failed-explanation--content
- = t(".channel.verification_status")
- - else
- .channel-status.float-right
- .bat-channel
- h4.bat-channel--amount id=("channel_amount_bat_#{channel.details.channel_identifier}")
- = publisher_channel_bat_balance(current_publisher, channel.details.channel_identifier)
- span.bat-channel--currency= " BAT"
- .bat-channel--period
- = t(".channel_balance_period")
- .channel-summary
- h3= channel.publication_title
- .channel-details
- .added-date
- = t ".channel.added", date: channel.created_at.to_date.iso8601
- span.separator
- = ' | '
- a.remove-channel href="#" data-channel-id=(channel.id)
- = t ".channel.remove_verified"
- script type="text/html" data-js-channel-removal-confirmation-template=(channel.id)
- = render "publishers/remove_channel_modal", channel: channel
- = form_for(channel, html: {id: "remove_channel_#{channel.id}"}) do |f|
- - elsif channel.verification_failed?
- .channel-status.float-right
- .verification-failed
- .verification-failed--header
- = t("helpers.channels.verification_failure")
- .verification-failed--details
- // JS will break if the next two elements aren't siblings
- span.verification-failed--what-happened=t("helpers.channels.verification_failure_what_happened")
- span.verification-failed--explanation
- span.verification-failed-explanation--content
- = channel_verification_details(channel).upcase_first
- span.separator
- = ' | '
- a.remove-channel href="#" data-channel-id=(channel.id)
- = t ".channel.remove_verified"
- script type="text/html" data-js-channel-removal-confirmation-template=(channel.id)
- = render "publishers/remove_channel_modal", channel: channel
- = form_for(channel, html: {id: "remove_channel_#{channel.id}"}) do |f|
- = link_to(t(".channel.try_again"), channel_next_step_path(channel), class: "btn btn-primary try-again")
- - elsif channel.verification_pending?
- .channel-status.float-right
- = t("shared.channel_contested", time_until_transfer: time_until_transfer(channel))
- - elsif channel.verification_awaiting_admin_approval?
- .channel-status.float-right
- = t("helpers.channels.verification_awaiting_admin_approval")
- - else
- .channel-status.float-right
- = link_to(t(".channel.lets_finish"), channel_next_step_path(channel), class: "btn btn-primary")
- .channel-progress.float-right
- .one-more-step= t ".channel.one_more_step"
- - unless channel.verified
- .channel-summary
- h3.unverified = channel.publication_title
- - if channel.contested_by_channel
- .channel-contested
- p = t "shared.channel_contested_by", time_until_transfer: time_until_transfer(channel.contested_by_channel),
- verified_by_email: channel.contested_by_channel.publisher.email
- a.reject_transfer href=token_reject_transfer_url(channel, channel.contest_token)
- = t ".channel.reject_transfer"
+ = render partial: 'channel', locals: { channel: channel }
.row id="add_channel_placeholder"
.col.mb-4
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 7883359195..89bd9fbe70 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -68,7 +68,7 @@
config.assets.quiet = true
# Raises error for missing translations
- # config.action_view.raise_on_missing_translations = true
+ config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 03247cf504..3ce4fda90d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -534,14 +534,14 @@ en:
heading: Contact
edit: Edit Contact
update: Update
- channel:
- added: added %{date}
- remove_verified: Remove Channel
- one_more_step: One more step to complete...
- lets_finish: Let's Finish
- try_again: Try Again
- verification_status: Verification status will be displayed in the Brave browser within the next 24-48 hours
- verification_status_title: Verification Information
+ channel:
+ added: added %{date}
+ remove_verified: Remove Channel
+ one_more_step: One more step to complete...
+ lets_finish: Let's Finish
+ try_again: Try Again
+ verification_status: Verification status will be displayed in the Brave browser within the next 24-48 hours
+ verification_status_title: Verification Information
channel_balance_period: CURRENT PERIOD
omniauth_callbacks:
register_youtube_channel:
@@ -684,6 +684,7 @@ en:
confirmed: "confirmed"
active_referral: "active"
add_channel: "Add a web site or youtube channel below to get the promo link!"
+ violation: We regret to inform you that we've suspended your ability to participate in Brave Rewards Program due to violation of our
Terms of Service. However, you can still earn and redeem rewards from participating in our other programs.
referral: "Referral Promo Stats"
check_statement: "Check your statement for this period's payout."
tooltip:
diff --git a/config/routes.rb b/config/routes.rb
index afb2b5a34b..6c675fc0f3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -163,7 +163,6 @@
get :duplicates
end
end
-
resources :faq_categories, except: [:show]
resources :faqs, except: [:show]
resources :payout_reports, only: %i(index show create) do
@@ -184,11 +183,11 @@
get :cancel_two_factor_authentication_removal
end
resources :publisher_notes
- resources :reports
resources :publisher_status_updates, controller: 'publishers/publisher_status_updates'
+ resources :referrals, controller: 'publishers/referrals'
+ resources :reports
end
resources :channel_transfers
- resources :referrals
resources :payments
resources :channel_approvals
resources :security
diff --git a/test/controllers/admin/publishers/publisher_status_updates_controller_test.rb b/test/controllers/admin/publishers/publisher_status_updates_controller_test.rb
index 58e624fc7b..17b34fee86 100644
--- a/test/controllers/admin/publishers/publisher_status_updates_controller_test.rb
+++ b/test/controllers/admin/publishers/publisher_status_updates_controller_test.rb
@@ -50,7 +50,7 @@ class Admin::Publishers::PublisherStatusUpdatesControllerTest < ActionDispatch::
sign_in admin
publisher = publishers(:uphold_connected)
- assert_enqueued_jobs(1) do
+ assert_enqueued_jobs(2) do
post(
admin_publisher_publisher_status_updates_path(
publisher_id: publisher.id,
@@ -67,7 +67,7 @@ class Admin::Publishers::PublisherStatusUpdatesControllerTest < ActionDispatch::
admin = publishers(:admin)
sign_in admin
publisher = publishers(:uphold_connected)
- assert_enqueued_jobs(0) do
+ assert_enqueued_jobs(1) do
post(
admin_publisher_publisher_status_updates_path(
publisher_id: publisher.id,
diff --git a/test/features/site_channel_verification_test.rb b/test/features/site_channel_verification_test.rb
index fa6189b2fc..4008aa97c6 100644
--- a/test/features/site_channel_verification_test.rb
+++ b/test/features/site_channel_verification_test.rb
@@ -151,6 +151,6 @@ def stub_verification_public_file(channel, body: nil, status: 200)
visit verification_public_file_site_channel_path(channel)
click_link(I18n.t("site_channels.shared.finish_verification_later"))
- assert_content (I18n.t("publishers.home.channel.one_more_step"))
+ assert_content (I18n.t("publishers.channel.one_more_step"))
end
end
diff --git a/test/helpers/publishers_helper_test.rb b/test/helpers/publishers_helper_test.rb
index 644c9d8ae9..f55cec8b2a 100644
--- a/test/helpers/publishers_helper_test.rb
+++ b/test/helpers/publishers_helper_test.rb
@@ -45,6 +45,10 @@ def become_subclass
def partner?
false
end
+
+ def only_user_funds?
+ false
+ end
end
test "publisher_converted_overall_balance should return `CURRENCY unavailable` when no wallet is set" do
diff --git a/yarn.lock b/yarn.lock
index f13ffec108..d9c2b7772f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10758,3 +10758,4 @@ yargs@^7.0.0:
which-module "^1.0.0"
y18n "^3.2.1"
yargs-parser "^5.0.0"
+