### Summary - Converts conversation auto-resolution duration from days to minutes for more granular control - Updates validation to allow values from 10 minutes (minimum) to 999 days (maximum) - Implements smart messaging to show appropriate time units in activity messages ### Changes - Created migration to convert existing durations from days to minutes (x1440) - Updated conversation resolver to use minutes instead of days - Added dynamic translation key selection based on duration value - Updated related specs and documentation - Added support for displaying durations in days, hours, or minutes based on value ### Test plan - Verify account validation accepts new minute-based ranges - Confirm existing account settings are correctly migrated - Test auto-resolution works properly with minute values - Ensure proper time unit display in activity messages --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
15 lines
662 B
Ruby
15 lines
662 B
Ruby
class Conversations::ResolutionJob < ApplicationJob
|
|
queue_as :low
|
|
|
|
def perform(account:)
|
|
# limiting the number of conversations to be resolved to avoid any performance issues
|
|
resolvable_conversations = account.conversations.resolvable(account.auto_resolve_after).limit(Limits::BULK_ACTIONS_LIMIT)
|
|
resolvable_conversations.each do |conversation|
|
|
# send message from bot that conversation has been resolved
|
|
# do this is account.auto_resolve_message is set
|
|
::MessageTemplates::Template::AutoResolve.new(conversation: conversation).perform if account.auto_resolve_message.present?
|
|
conversation.toggle_status
|
|
end
|
|
end
|
|
end
|