mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
feat: Add support for minutes in auto resolve feature (#11269)
### 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>
This commit is contained in:
@@ -119,7 +119,7 @@ RSpec.describe 'Accounts API', type: :request do
|
||||
|
||||
context 'when it is an authenticated user' do
|
||||
it 'shows an account' do
|
||||
account.update(auto_resolve_duration: 30)
|
||||
account.update(name: 'new name')
|
||||
|
||||
get "/api/v1/accounts/#{account.id}",
|
||||
headers: admin.create_new_auth_token,
|
||||
@@ -130,7 +130,6 @@ RSpec.describe 'Accounts API', type: :request do
|
||||
expect(response.body).to include(account.locale)
|
||||
expect(response.body).to include(account.domain)
|
||||
expect(response.body).to include(account.support_email)
|
||||
expect(response.body).to include(account.auto_resolve_duration.to_s)
|
||||
expect(response.body).to include(account.locale)
|
||||
end
|
||||
end
|
||||
@@ -189,7 +188,8 @@ RSpec.describe 'Accounts API', type: :request do
|
||||
locale: 'en',
|
||||
domain: 'example.com',
|
||||
support_email: 'care@example.com',
|
||||
auto_resolve_duration: 40,
|
||||
auto_resolve_after: 40,
|
||||
auto_resolve_message: 'Auto resolved',
|
||||
timezone: 'Asia/Kolkata',
|
||||
industry: 'Technology',
|
||||
company_size: '1-10'
|
||||
@@ -206,7 +206,10 @@ RSpec.describe 'Accounts API', type: :request do
|
||||
expect(account.reload.locale).to eq(params[:locale])
|
||||
expect(account.reload.domain).to eq(params[:domain])
|
||||
expect(account.reload.support_email).to eq(params[:support_email])
|
||||
expect(account.reload.auto_resolve_duration).to eq(params[:auto_resolve_duration])
|
||||
|
||||
%w[auto_resolve_after auto_resolve_message].each do |attribute|
|
||||
expect(account.reload.settings[attribute]).to eq(params[attribute.to_sym])
|
||||
end
|
||||
|
||||
%w[timezone industry company_size].each do |attribute|
|
||||
expect(account.reload.custom_attributes[attribute]).to eq(params[attribute.to_sym])
|
||||
|
||||
Reference in New Issue
Block a user