Fixes #3575 - Display minutes for session timeouts instead of seconds.
This commit is contained in:
parent
dc0813ba28
commit
01b414f9fc
3 changed files with 82 additions and 17 deletions
|
@ -424,7 +424,7 @@ class CreateBase < ActiveRecord::Migration[4.2]
|
|||
t.string :name, limit: 200, null: false
|
||||
t.string :area, limit: 100, null: false
|
||||
t.string :description, limit: 2000, null: false
|
||||
t.string :options, limit: 2000, null: true
|
||||
t.text :options, null: true
|
||||
t.text :state_current, limit: 200.kilobytes + 1, null: true
|
||||
t.string :state_initial, limit: 2000, null: true
|
||||
t.boolean :frontend, null: false
|
||||
|
|
55
db/migrate/20210528000000_update_session_timeout_dropdown.rb
Normal file
55
db/migrate/20210528000000_update_session_timeout_dropdown.rb
Normal file
|
@ -0,0 +1,55 @@
|
|||
class UpdateSessionTimeoutDropdown < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
return if !Setting.exists?(name: 'system_init_done')
|
||||
|
||||
change_column :settings, :options, :text, null: true
|
||||
Setting.reset_column_information
|
||||
|
||||
update_setting
|
||||
end
|
||||
|
||||
def options
|
||||
[ { value: '0', name: 'disabled' }, { value: 1.hour.seconds, name: '1 hour' }, { value: 2.hours.seconds, name: '2 hours' }, { value: 1.day.seconds, name: '1 day' }, { value: 7.days.seconds, name: '1 week' }, { value: 14.days.seconds, name: '2 weeks' }, { value: 21.days.seconds, name: '3 weeks' }, { value: 28.days.seconds, name: '4 weeks' } ]
|
||||
end
|
||||
|
||||
def update_setting
|
||||
setting = Setting.find_by(name: 'session_timeout')
|
||||
setting.options = {
|
||||
form: [
|
||||
{
|
||||
display: 'Default',
|
||||
null: false,
|
||||
name: 'default',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
{
|
||||
display: 'admin',
|
||||
null: false,
|
||||
name: 'admin',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
{
|
||||
display: 'ticket.agent',
|
||||
null: false,
|
||||
name: 'ticket.agent',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
{
|
||||
display: 'ticket.customer',
|
||||
null: false,
|
||||
name: 'ticket.customer',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
]
|
||||
}
|
||||
setting.save!
|
||||
end
|
||||
end
|
|
@ -1041,6 +1041,8 @@ Setting.create_if_not_exists(
|
|||
},
|
||||
frontend: true
|
||||
)
|
||||
|
||||
options = [ { value: '0', name: 'disabled' }, { value: 1.hour.seconds, name: '1 hour' }, { value: 2.hours.seconds, name: '2 hours' }, { value: 1.day.seconds, name: '1 day' }, { value: 7.days.seconds, name: '1 week' }, { value: 14.days.seconds, name: '2 weeks' }, { value: 21.days.seconds, name: '3 weeks' }, { value: 28.days.seconds, name: '4 weeks' } ]
|
||||
Setting.create_if_not_exists(
|
||||
title: 'Session Timeout',
|
||||
name: 'session_timeout',
|
||||
|
@ -1049,28 +1051,36 @@ Setting.create_if_not_exists(
|
|||
options: {
|
||||
form: [
|
||||
{
|
||||
display: 'Default',
|
||||
null: false,
|
||||
name: 'default',
|
||||
tag: 'input',
|
||||
display: 'Default',
|
||||
null: false,
|
||||
name: 'default',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
{
|
||||
display: 'admin',
|
||||
null: false,
|
||||
name: 'admin',
|
||||
tag: 'input',
|
||||
display: 'admin',
|
||||
null: false,
|
||||
name: 'admin',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
{
|
||||
display: 'ticket.agent',
|
||||
null: false,
|
||||
name: 'ticket.agent',
|
||||
tag: 'input',
|
||||
display: 'ticket.agent',
|
||||
null: false,
|
||||
name: 'ticket.agent',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
{
|
||||
display: 'ticket.customer',
|
||||
null: false,
|
||||
name: 'ticket.customer',
|
||||
tag: 'input',
|
||||
display: 'ticket.customer',
|
||||
null: false,
|
||||
name: 'ticket.customer',
|
||||
tag: 'select',
|
||||
options: options,
|
||||
translate: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue