pass the site to the 'new sign up' notification

did committed Jun 20, 2017
commit b4a8c1050704a926f4005cd5741c5631b414bd5c
Showing 3 changed files with 5 additions and 4 deletions
locomotive/steam/services.rb b/lib/locomotive/steam/services.rb +1 -1
@@ @@ -123,7 +123,7 @@ module Locomotive
end
register :auth do
- Steam::AuthService.new(content_entry, email)
+ Steam::AuthService.new(current_site, content_entry, email)
end
register :cache do
locomotive/steam/services/auth_service.rb b/lib/locomotive/steam/services/auth_service.rb +2 -2
@@ @@ -6,7 +6,7 @@ module Locomotive
MIN_PASSWORD_LENGTH = 6
RESET_TOKEN_LIFETIME = 1 * 3600 # 6 hours in seconds
- attr_accessor_initialize :entries, :email_service
+ attr_accessor_initialize :site, :entries, :email_service
def find_authenticated_resource(type, id)
entries.find(type, id)
@@ @@ -19,7 +19,7 @@ module Locomotive
end
if entry.errors.empty?
- ActiveSupport::Notifications.instrument('steam.auth.signup', entry: entry)
+ ActiveSupport::Notifications.instrument('steam.auth.signup', site: site, entry: entry)
context[options.type.singularize] = entry
send_welcome_email(options, context)
spec/unit/services/auth_service_spec.rb +2 -1
@@ @@ -2,9 +2,10 @@ require 'spec_helper'
describe Locomotive::Steam::AuthService do
+ let(:site) { instance_double('CurrentSite') }
let(:entries) { instance_double('ContentService') }
let(:emails) { instance_double('EmailService') }
- let(:service) { described_class.new(entries, emails) }
+ let(:service) { described_class.new(site, entries, emails) }
let(:liquid_context) { {} }
let(:default_auth_options) { {