Browse Source

Fixed issue #662 - Add setting to define internal/external notice default setting.

Rolf Schmidt 8 years ago
parent
commit
7cd9ccae75

+ 3 - 1
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

+ 35 - 0
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

+ 28 - 0
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',