Feat: send fb message outside of standard messaging window (#4439)
This commit is contained in:
@@ -90,10 +90,20 @@ class Conversation < ApplicationRecord
|
||||
delegate :auto_resolve_duration, to: :account
|
||||
|
||||
def can_reply?
|
||||
return last_message_less_than_24_hrs? if additional_attributes['type'] == 'instagram_direct_message'
|
||||
|
||||
return true unless inbox&.channel&.has_24_hour_messaging_window?
|
||||
|
||||
last_incoming_message = messages.incoming.last
|
||||
return false if last_incoming_message.nil?
|
||||
|
||||
last_message_less_than_24_hrs?
|
||||
end
|
||||
|
||||
def last_incoming_message
|
||||
messages&.incoming&.last
|
||||
end
|
||||
|
||||
def last_message_less_than_24_hrs?
|
||||
return false if last_incoming_message.nil?
|
||||
|
||||
Time.current < last_incoming_message.created_at + 24.hours
|
||||
|
||||
Reference in New Issue
Block a user