2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-04 17:31:48 -05:00
|
|
|
module Jobs
|
2019-10-01 23:01:53 -05:00
|
|
|
class SendPushNotification < ::Jobs::Base
|
2018-05-04 17:31:48 -05:00
|
|
|
def execute(args)
|
2018-05-17 02:22:01 -05:00
|
|
|
user = User.find_by(id: args[:user_id])
|
2024-08-02 08:25:15 -05: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 14:17:40 -06:00
|
|
|
|
|
|
|
PushNotificationPusher.push(user, args[:payload])
|
2018-05-04 17:31:48 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|