diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6fb7bef243b..560a5e25504 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -65,8 +65,7 @@ def create @user.build_discord_profile @user.credit_card_payment = params[:credit_card_payment] @user.uploaded_avatar = user_params[:avatar] - - ActiveSupport::Notifications.instrument('user.create', user: @user) + @user.unsubscribe_email_token = SecureRandom.urlsafe_base64 if @user.staff? || @user.trainee? create_free_user! diff --git a/app/models/sign_up_notifier.rb b/app/models/sign_up_notifier.rb deleted file mode 100644 index 64e8245cc5c..00000000000 --- a/app/models/sign_up_notifier.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class SignUpNotifier - def call(_name, _started_, _finished, _unique_id, payload) - user = payload[:user] - user.unsubscribe_email_token = SecureRandom.urlsafe_base64 - end -end diff --git a/config/initializers/active_support_notifications.rb b/config/initializers/active_support_notifications.rb index 8a2099d3d5b..d9d33711181 100644 --- a/config/initializers/active_support_notifications.rb +++ b/config/initializers/active_support_notifications.rb @@ -25,6 +25,8 @@ ActiveSupport::Notifications.subscribe('product.create', ProductNotifierForColleague.new) ActiveSupport::Notifications.subscribe('product.create', ProductNotifierForPracticeWatcher.new) ActiveSupport::Notifications.subscribe('came.inquiry', InquiryNotifier.new) + ActiveSupport::Notifications.subscribe('regular_event.update', RegularEventUpdateNotifier.new) + ActiveSupport::Notifications.subscribe('student_or_trainee.create', TimesChannelCreator.new) learning_status_updater = LearningStatusUpdater.new ActiveSupport::Notifications.subscribe('product.save', learning_status_updater) @@ -38,7 +40,4 @@ learning_cache_destroyer = LearningCacheDestroyer.new ActiveSupport::Notifications.subscribe('learning.create', learning_cache_destroyer) ActiveSupport::Notifications.subscribe('learning.destroy', learning_cache_destroyer) - ActiveSupport::Notifications.subscribe('student_or_trainee.create', TimesChannelCreator.new) - ActiveSupport::Notifications.subscribe('user.create', SignUpNotifier.new) - ActiveSupport::Notifications.subscribe('regular_event.update', RegularEventUpdateNotifier.new) end