rename 'is_support' to 'contains_messages'

This commit is contained in:
Régis Hanol 2015-11-26 18:40:54 +01:00
parent e8a6ff4808
commit ba0df7e4cd
11 changed files with 18 additions and 13 deletions

View File

@ -21,7 +21,7 @@ export default ComboboxView.extend({
return categories.filter(c => {
if (scopedCategoryId && c.get('id') !== scopedCategoryId && c.get('parent_category_id') !== scopedCategoryId) { return false; }
if (c.get('isUncategorizedCategory')) { return false; }
if (c.get('is_support')) { return false; }
if (c.get('contains_messages')) { return false; }
return c.get('permission') === Discourse.PermissionType.FULL;
});
},

View File

@ -81,8 +81,8 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
@computed("model.isPrivateMessage", "model.category_id")
showCategoryChooser(isPrivateMessage, categoryId) {
const category = Discourse.Category.findById(categoryId);
const isSupport = category && category.get("is_support");
return !isPrivateMessage && !isSupport;
const containsMessages = category && category.get("contains_messages");
return !isPrivateMessage && !containsMessages;
},
actions: {

View File

@ -86,7 +86,7 @@ const Category = RestModel.extend({
custom_fields: this.get('custom_fields'),
topic_template: this.get('topic_template'),
suppress_from_homepage: this.get('suppress_from_homepage'),
is_support: this.get("is_support"),
contains_messages: this.get("contains_messages"),
},
type: this.get('id') ? 'PUT' : 'POST'
});

View File

@ -71,8 +71,8 @@ const Composer = RestModel.extend({
showCategoryChooser(isPrivateMessage, hasOptions, categoryId) {
const manyCategories = Discourse.Category.list().length > 1;
const category = Discourse.Category.findById(categoryId);
const isSupport = category && category.get("is_support");
return !isPrivateMessage && !isSupport && (hasOptions || manyCategories);
const containsMessages = category && category.get("contains_messages");
return !isPrivateMessage && !containsMessages && (hasOptions || manyCategories);
},
privateMessage: function(){

View File

@ -22,8 +22,8 @@
{{#if emailInEnabled}}
<section class='field'>
<label>
{{input type="checkbox" checked=category.is_support}}
{{i18n 'category.email_in_allow_strangers'}}
{{input type="checkbox" checked=category.contains_messages}}
{{i18n 'category.contains_messages'}}
</label>
</section>
<section class='field'>

View File

@ -178,7 +178,7 @@ class CategoriesController < ApplicationController
:position,
:email_in,
:email_in_allow_strangers,
:is_support,
:contains_messages,
:suppress_from_homepage,
:parent_category_id,
:auto_close_hours,

View File

@ -540,7 +540,7 @@ class Topic < ActiveRecord::Base
def change_category_to_id(category_id)
return false if private_message?
return false if category.try(:is_support)
return false if category.try(:contains_messages)
new_category_id = category_id.to_i
# if the category name is blank, reset the attribute

View File

@ -20,7 +20,7 @@ class BasicCategorySerializer < ApplicationSerializer
:can_edit,
:topic_template,
:has_children,
:is_support
:contains_messages
def include_parent_category_id?
parent_category_id

View File

@ -1590,7 +1590,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.'
is_support: "Transform this category into a private support portal."
contains_messages: "Change this category to only contain messages."
suppress_from_homepage: "Suppress this category from the homepage."
allow_badges_label: "Allow badges to be awarded in this category"
edit_permissions: "Edit Permissions"

View File

@ -0,0 +1,5 @@
class RenameIsSupportToContainsMessages < ActiveRecord::Migration
def change
rename_column :categories, :is_support, :contains_messages
end
end

View File

@ -902,7 +902,7 @@ describe TopicsController do
let(:another_category) { Fabricate(:category) }
it "cannot change the category of a topic that is in a support category" do
@topic.category = Fabricate(:category, is_support: true)
@topic.category = Fabricate(:category, contains_messages: true)
@topic.save!
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, category_id: another_category.id
expect(response).not_to be_success