From 8f6d35aa59339fc20490e58086625a2f73832ec8 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Wed, 15 Nov 2017 17:36:52 +0100 Subject: [PATCH] FEATURE: category setting for mailinglist mirror --- app/assets/javascripts/discourse/models/category.js.es6 | 1 + .../templates/components/edit-category-settings.hbs | 7 +++++++ app/controllers/categories_controller.rb | 1 + app/models/category.rb | 1 + app/serializers/category_serializer.rb | 1 + config/locales/client.en.yml | 1 + ...0171115170858_add_mailinglist_mirror_to_categories.rb | 9 +++++++++ 7 files changed, 21 insertions(+) create mode 100644 db/migrate/20171115170858_add_mailinglist_mirror_to_categories.rb diff --git a/app/assets/javascripts/discourse/models/category.js.es6 b/app/assets/javascripts/discourse/models/category.js.es6 index 6af4ff87509..52c3eb443c7 100644 --- a/app/assets/javascripts/discourse/models/category.js.es6 +++ b/app/assets/javascripts/discourse/models/category.js.es6 @@ -90,6 +90,7 @@ const Category = RestModel.extend({ position: this.get('position'), email_in: this.get('email_in'), email_in_allow_strangers: this.get('email_in_allow_strangers'), + mailinglist_mirror: this.get('mailinglist_mirror'), parent_category_id: this.get('parent_category_id'), uploaded_logo_id: this.get('uploaded_logo.id'), uploaded_background_id: this.get('uploaded_background.id'), diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs index 382b70361e8..fa7b2a5653e 100644 --- a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs +++ b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs @@ -119,6 +119,13 @@ +
+ +
+ {{plugin-outlet name="category-email-in" args=(hash category=category)}} {{/if}} diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index d9ec6da97d2..56c49b9da9b 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -233,6 +233,7 @@ class CategoriesController < ApplicationController :position, :email_in, :email_in_allow_strangers, + :mailinglist_mirror, :suppress_from_homepage, :all_topics_wiki, :parent_category_id, diff --git a/app/models/category.rb b/app/models/category.rb index 54f59af7226..35c550468a4 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -555,6 +555,7 @@ end # default_view :string(50) # subcategory_list_style :string(50) default("rows_with_featured_topics") # default_top_period :string(20) default("all") +# mailinglist_mirror :boolean default(FALSE), not null # # Indexes # diff --git a/app/serializers/category_serializer.rb b/app/serializers/category_serializer.rb index dae914fc6dc..3c5f98a97bf 100644 --- a/app/serializers/category_serializer.rb +++ b/app/serializers/category_serializer.rb @@ -8,6 +8,7 @@ class CategorySerializer < BasicCategorySerializer :position, :email_in, :email_in_allow_strangers, + :mailinglist_mirror, :suppress_from_homepage, :all_topics_wiki, :can_delete, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 64304dd1c06..3ddc814f7e9 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2122,6 +2122,7 @@ en: email_in_allow_strangers: "Accept emails from anonymous users with no accounts" email_in_disabled: "Posting new topics via email is disabled in the Site Settings. To enable posting new topics via email, " email_in_disabled_click: 'enable the "email in" setting.' + mailinglist_mirror: "Category mirrors a mailinglist" suppress_from_homepage: "Suppress this category from the homepage." show_subcategory_list: "Show subcategory list above topics in this category." num_featured_topics: "Number of topics shown on the categories page:" diff --git a/db/migrate/20171115170858_add_mailinglist_mirror_to_categories.rb b/db/migrate/20171115170858_add_mailinglist_mirror_to_categories.rb new file mode 100644 index 00000000000..71555579d86 --- /dev/null +++ b/db/migrate/20171115170858_add_mailinglist_mirror_to_categories.rb @@ -0,0 +1,9 @@ +class AddMailinglistMirrorToCategories < ActiveRecord::Migration[5.1] + def up + add_column :categories, :mailinglist_mirror, :boolean, default: false, null: false + end + + def down + remove_column :categories, :mailinglist_mirror + end +end