2019-05-03 08:17:27 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-04 15:31:48 -07:00
|
|
|
module Jobs
|
2019-10-02 14:01:53 +10:00
|
|
|
class SendPushNotification < ::Jobs::Base
|
2018-05-04 15:31:48 -07:00
|
|
|
def execute(args)
|
2018-05-17 12:52:01 +05:30
|
|
|
user = User.find_by(id: args[:user_id])
|
2024-08-02 17:25:15 +04:00
|
|
|
push_window = SiteSetting.push_notification_time_window_mins
|
|
|
|
return if !user || (push_window > 0 && user.seen_since?(push_window.minutes.ago))
|
2022-12-19 20:17:40 +00:00
|
|
|
|
|
|
|
PushNotificationPusher.push(user, args[:payload])
|
2018-05-04 15:31:48 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|