feat: send instagram message after 24 hours (#4698)
Added MESSAGE_TAG: HUMAN_AGENT for Instagram messages if the user wants to send it after the standard message window. Fixes #4689
This commit is contained in:
@@ -512,6 +512,38 @@ RSpec.describe Conversation, type: :model do
|
||||
)
|
||||
expect(conversation.can_reply?).to eq true
|
||||
end
|
||||
|
||||
context 'when instagram channel' do
|
||||
it 'return true with HUMAN_AGENT if it is outside of 24 hour window' do
|
||||
InstallationConfig.where(name: 'ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT').first_or_create(value: true)
|
||||
|
||||
conversation.update(additional_attributes: { type: 'instagram_direct_message' })
|
||||
create(
|
||||
:message,
|
||||
account: conversation.account,
|
||||
inbox: facebook_inbox,
|
||||
conversation: conversation,
|
||||
created_at: Time.now - 48.hours
|
||||
)
|
||||
|
||||
expect(conversation.can_reply?).to eq true
|
||||
end
|
||||
|
||||
it 'return false without HUMAN_AGENT if it is outside of 24 hour window' do
|
||||
InstallationConfig.where(name: 'ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT').first_or_create(value: false)
|
||||
|
||||
conversation.update(additional_attributes: { type: 'instagram_direct_message' })
|
||||
create(
|
||||
:message,
|
||||
account: conversation.account,
|
||||
inbox: facebook_inbox,
|
||||
conversation: conversation,
|
||||
created_at: Time.now - 48.hours
|
||||
)
|
||||
|
||||
expect(conversation.can_reply?).to eq false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user