Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/inquiries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create
result = valid_recaptcha?('inquiry')

if result && @inquiry.save
Newspaper.publish(:came_inquiry, { inquiry: @inquiry })
ActiveSupport::Notifications.instrument('came.inquiry', inquiry: @inquiry)
InquiryMailer.incoming(@inquiry).deliver_later
redirect_to new_inquiry_url, notice: 'お問い合わせを送信しました。'
else
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def update

def destroy
@work.destroy
Newspaper.publish(:work_destroy, { work: @work })
ActiveSupport::Notifications.instrument('work.destroy', work: @work)
redirect_to user_portfolio_url(@work.user), notice: 'ポートフォリオから作品を削除しました。'
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/inquiry_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class InquiryNotifier
NOTIFICATION_SENDER_NAME = 'pjord'

def call(payload)
def call(_name, _started, _finished, _unique_id, payload)
inquiry = payload[:inquiry]
return if inquiry.nil?

Expand Down
2 changes: 1 addition & 1 deletion app/models/report_notifier.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class ReportNotifier
def call(payload)
def call(_name, _started, _finished, _unique_id, payload)
report = payload[:report]
Cache.delete_unchecked_report_count

Expand Down
2 changes: 1 addition & 1 deletion app/models/work_notification_destroyer.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class WorkNotificationDestroyer
def call(payload)
def call(_name, _started, _finished, _unique_id, payload)
work = payload[:work]

Notification.where(link: "/works/#{work.id}").destroy_all
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/active_support_notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
ActiveSupport::Notifications.subscribe('regular_event.create', RegularEventOrganizerWatcher.new)
ActiveSupport::Notifications.subscribe('report.create', FirstReportNotifier.new)
ActiveSupport::Notifications.subscribe('report.update', FirstReportNotifier.new)
ActiveSupport::Notifications.subscribe('report.create', ReportNotifier.new)
ActiveSupport::Notifications.subscribe('report.update', ReportNotifier.new)
ActiveSupport::Notifications.subscribe('announcement.create', AnnouncementNotifier.new)
ActiveSupport::Notifications.subscribe('announcement.update', AnnouncementNotifier.new)
ActiveSupport::Notifications.subscribe('announcement.destroy', AnnouncementNotificationDestroyer.new)
ActiveSupport::Notifications.subscribe('article.create', ArticleNotifier.new)
ActiveSupport::Notifications.subscribe('article.destroy', ArticleNotificationDestroyer.new)
ActiveSupport::Notifications.subscribe('work.create', WorkNotifier.new)
ActiveSupport::Notifications.subscribe('work.destroy', WorkNotificationDestroyer.new)
ActiveSupport::Notifications.subscribe('product.create', ProductAuthorWatcher.new)
ActiveSupport::Notifications.subscribe('product.create', ProductNotifierForColleague.new)
ActiveSupport::Notifications.subscribe('product.create', ProductNotifierForPracticeWatcher.new)
ActiveSupport::Notifications.subscribe('came.inquiry', InquiryNotifier.new)
end
6 changes: 0 additions & 6 deletions config/initializers/newspaper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Newspaper.subscribe(:report_save, sad_streak_updater)
Newspaper.subscribe(:report_destroy, sad_streak_updater)

Newspaper.subscribe(:report_save, ReportNotifier.new)

learning_cache_destroyer = LearningCacheDestroyer.new
Newspaper.subscribe(:learning_create, learning_cache_destroyer)
Newspaper.subscribe(:learning_destroy, learning_cache_destroyer)
Expand Down Expand Up @@ -53,8 +51,4 @@
Newspaper.subscribe(:product_update, ProductUpdateNotifierForChecker.new)
Newspaper.subscribe(:came_comment, CommentNotifier.new)
Newspaper.subscribe(:came_comment_in_talk, CommentNotifierForAdmin.new)

Newspaper.subscribe(:work_destroy, WorkNotificationDestroyer.new)

Newspaper.subscribe(:came_inquiry, InquiryNotifier.new)
end