blob: 1d0a6eb254a0ea0076b7a4204504a423a0ae5af7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# frozen_string_literal: true
module Members
class ExpiringEmailNotificationWorker # rubocop:disable Scalability/CronWorkerContext
include ApplicationWorker
data_consistency :always # rubocop:disable SidekiqLoadBalancing/WorkerDataConsistency
feature_category :system_access
urgency :low
idempotent!
def perform(member_id)
notification_service = NotificationService.new
member = ::Member.find_by_id(member_id)
return unless member
return unless Feature.enabled?(:member_expiring_email_notification, member.source.root_ancestor)
return if member.expiry_notified_at.present?
with_context(user: member.user) do
notification_service.member_about_to_expire(member)
Gitlab::AppLogger.info(message: "Notifying user about expiring membership", member_id: member.id)
member.update(expiry_notified_at: Time.current)
end
end
end
end
|