* Implemented ActiveJob for RateLimitChecker Job * Changes as per the review * Further changes as per the review
24 lines
388 B
Ruby
24 lines
388 B
Ruby
class PingAdmins
|
|
def initialize(user)
|
|
@user = user
|
|
end
|
|
|
|
def self.call(*args)
|
|
new(*args).call
|
|
end
|
|
|
|
def call
|
|
return unless user && Rails.env.production?
|
|
|
|
SlackBot.ping(
|
|
"Rate limit exceeded. https://dev.to#{user.path}",
|
|
channel: "abuse-reports",
|
|
username: "rate_limit",
|
|
icon_emoji: ":hand:",
|
|
)
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :user
|
|
end
|