Call mailbluster helpers when registering / cancelling reg to conference

This commit is contained in:
Ziyi 2021-03-25 17:21:27 -07:00 committed by CactusPuppy
parent 560a3dbe70
commit efdf1f03df
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
2 changed files with 4 additions and 1 deletions

View file

@ -57,6 +57,8 @@ class ConferenceRegistrationsController < ApplicationController
sign_in(@registration.user) sign_in(@registration.user)
end end
MailblusterEditLeadJob.perform_later(@user, add_tags: ["snapcon-#{@conference.short_title}"])
if @conference.tickets.visible.any? && !current_user.supports?(@conference) if @conference.tickets.visible.any? && !current_user.supports?(@conference)
redirect_to conference_tickets_path(@conference.short_title), redirect_to conference_tickets_path(@conference.short_title),
notice: 'You are now registered and will be receiving E-Mail notifications.' notice: 'You are now registered and will be receiving E-Mail notifications.'
@ -87,6 +89,7 @@ class ConferenceRegistrationsController < ApplicationController
def destroy def destroy
if @registration.destroy if @registration.destroy
MailblusterEditLeadJob.perform_later(@user, remove_tags: ["snapcon-#{@conference.short_title}"])
redirect_to root_path, redirect_to root_path,
notice: "You are not registered for #{@conference.title} anymore!" notice: "You are not registered for #{@conference.title} anymore!"
else else

View file

@ -81,7 +81,7 @@ class User < ApplicationRecord
after_save :touch_events after_save :touch_events
after_create_commit :mailbluster_create_lead after_create_commit :mailbluster_create_lead
after_destory_commit :mailbluster_delete_lead after_destroy_commit :mailbluster_delete_lead
after_update_commit :mailbluster_update_email, if: :saved_change_to_email? after_update_commit :mailbluster_update_email, if: :saved_change_to_email?
# add scope # add scope