0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-15 15:32:56 +08:00
discourse/app/jobs/concerns/skippable.rb
Jarek Radosz 71834c898f
DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-06 16:11:01 +02:00

26 lines
641 B
Ruby
Vendored

# frozen_string_literal: true
module Skippable
extend ActiveSupport::Concern
def create_skipped_email_log(email_type:, to_address:, user_id:, post_id:, reason_type:)
attributes = {
email_type: email_type,
to_address: to_address,
user_id: user_id,
post_id: post_id,
reason_type: reason_type,
}
if reason_type == SkippedEmailLog.reason_types[:exceeded_emails_limit]
exists =
SkippedEmailLog.exists?(
{ created_at: (Time.zone.now.all_day) }.merge!(attributes.except(:post_id)),
)
return if exists
end
SkippedEmailLog.create!(attributes)
end
end