From 7cd9ccae7506a7e66487dcc0ea5dee23a5e697ce Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Mon, 23 Jan 2017 14:54:44 +0100 Subject: [PATCH] Fixed issue #662 - Add setting to define internal/external notice default setting. --- .../ticket_zoom/article_new.coffee | 4 ++- ...001_ui_ticket_zoom_article_new_internal.rb | 35 +++++++++++++++++++ db/seeds.rb | 28 +++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee index 26296dbd5..7566674b3 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee @@ -52,11 +52,13 @@ class App.TicketZoomArticleNew extends App.Controller @type = @defaults['type'] || 'note' @articleTypes = [] if possibleArticleType.note + internal = @Config.get('ui_ticket_zoom_article_new_internal') + @articleTypes.push { name: 'note' icon: 'note' attributes: [] - internal: true, + internal: internal, features: ['attachment'] } if possibleArticleType.email diff --git a/db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb b/db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb new file mode 100644 index 000000000..0bcedd951 --- /dev/null +++ b/db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb @@ -0,0 +1,35 @@ +class UiTicketZoomArticleNewInternal < ActiveRecord::Migration + def up + + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + + Setting.create_if_not_exists( + title: 'Define default visibility of new a new article', + name: 'ui_ticket_zoom_article_new_internal', + area: 'UI::TicketZoom', + description: 'Set default visibility of new a new article.', + options: { + form: [ + { + display: '', + null: true, + name: 'ui_ticket_zoom_article_new_internal', + tag: 'boolean', + translate: true, + options: { + true => 'internal', + false => 'public', + }, + }, + ], + }, + state: true, + preferences: { + prio: 1, + permission: ['admin.ui'], + }, + frontend: true + ) + end +end diff --git a/db/seeds.rb b/db/seeds.rb index 239da5873..f43b3eefb 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -521,6 +521,34 @@ Setting.create_if_not_exists( frontend: true ) +Setting.create_if_not_exists( + title: 'Define default visibility of new a new article', + name: 'ui_ticket_zoom_article_new_internal', + area: 'UI::TicketZoom', + description: 'Set default visibility of new a new article.', + options: { + form: [ + { + display: '', + null: true, + name: 'ui_ticket_zoom_article_new_internal', + tag: 'boolean', + translate: true, + options: { + true => 'internal', + false => 'public', + }, + }, + ], + }, + state: true, + preferences: { + prio: 1, + permission: ['admin.ui'], + }, + frontend: true +) + Setting.create_if_not_exists( title: 'New User Accounts', name: 'user_create_account',