Skip to content

Commit

Permalink
DiscordNotifierをNotificationFacadeのhibernatedから分離
Browse files Browse the repository at this point in the history
1. 分離せずにNotificationFacade経由で呼び出すと同じ通知が複数回discordに飛ぶため
  • Loading branch information
keiz1213 committed Sep 12, 2022
1 parent f2998ca commit cc888f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/controllers/hibernation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def create
if @hibernation.save
update_hibernated_at!
destroy_subscription!
notify_to_chat
notify_to_mentors_and_admins
logout
redirect_to hibernation_path
Expand Down Expand Up @@ -46,4 +47,8 @@ def notify_to_mentors_and_admins
NotificationFacade.hibernated(current_user, admin_or_mentor)
end
end

def notify_to_chat
DiscordNotifier.with(sender: current_user).hibernated.notify_now
end
end
1 change: 0 additions & 1 deletion app/models/notification_facade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def self.graduated(sender, receiver)

def self.hibernated(sender, receiver)
ActivityNotifier.with(sender: sender, receiver: receiver).hibernated.notify_now
DiscordNotifier.with(sender: sender, receiver: receiver).hibernated.notify_now
return unless receiver.mail_notification?

NotificationMailer.with(
Expand Down

0 comments on commit cc888f7

Please sign in to comment.