Prefer named comparison #after? to numeric comparison on times (#16057)
ActiveSupport adds DateAndTime::Calculations#after? (and before?) - which clarifies intent (users newer than the relative time are skipped) of the early returns.
This commit is contained in:
parent
6f2cf0e9fd
commit
f20b8bd412
1 changed files with 6 additions and 6 deletions
|
|
@ -37,7 +37,7 @@ module Broadcasts
|
|||
|
||||
def send_welcome_notification
|
||||
return if
|
||||
user.created_at > 3.hours.ago ||
|
||||
user.created_at.after?(3.hours.ago) ||
|
||||
received_notification?(welcome_broadcast) ||
|
||||
commented_on_welcome_thread?
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ module Broadcasts
|
|||
|
||||
def send_authentication_notification
|
||||
return if
|
||||
user.created_at > 1.day.ago ||
|
||||
user.created_at.after?(1.day.ago) ||
|
||||
authenticated_with_all_providers? ||
|
||||
received_notification?(authentication_broadcast)
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ module Broadcasts
|
|||
|
||||
def send_feed_customization_notification
|
||||
return if
|
||||
user.created_at > 3.days.ago ||
|
||||
user.created_at.after?(3.days.ago) ||
|
||||
user_following_tags? ||
|
||||
received_notification?(customize_feed_broadcast)
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ module Broadcasts
|
|||
end
|
||||
|
||||
def send_ux_customization_notification
|
||||
return if user.created_at > 5.days.ago || received_notification?(customize_ux_broadcast)
|
||||
return if user.created_at.after?(5.days.ago) || received_notification?(customize_ux_broadcast)
|
||||
|
||||
Notification.send_welcome_notification(user.id, customize_ux_broadcast.id)
|
||||
@notification_enqueued = true
|
||||
|
|
@ -75,7 +75,7 @@ module Broadcasts
|
|||
|
||||
def send_discuss_and_ask_notification
|
||||
return if
|
||||
user.created_at > 6.days.ago ||
|
||||
user.created_at.after?(6.days.ago) ||
|
||||
(asked_a_question && started_a_discussion) ||
|
||||
received_notification?(discuss_and_ask_broadcast)
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ module Broadcasts
|
|||
end
|
||||
|
||||
def send_download_app_notification
|
||||
return if user.created_at > 7.days.ago || received_notification?(download_app_broadcast)
|
||||
return if user.created_at.after?(7.days.ago) || received_notification?(download_app_broadcast)
|
||||
|
||||
Notification.send_welcome_notification(user.id, download_app_broadcast.id)
|
||||
@notification_enqueued = true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue