mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 17:08:30 +08:00
CLEANUP: remove 'contains_messages' leftover 💩
This commit is contained in:
parent
96aa5b865f
commit
8049dfdfda
|
@ -22,7 +22,6 @@ 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('contains_messages')) { return false; }
|
||||
return c.get('permission') === PermissionType.FULL;
|
||||
});
|
||||
},
|
||||
|
|
|
@ -90,12 +90,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
this.set('selectedReplies', []);
|
||||
}.on('init'),
|
||||
|
||||
@computed("model.isPrivateMessage", "model.category_id")
|
||||
showCategoryChooser(isPrivateMessage, categoryId) {
|
||||
const category = Discourse.Category.findById(categoryId);
|
||||
const containsMessages = category && category.get("contains_messages");
|
||||
return !isPrivateMessage && !containsMessages;
|
||||
},
|
||||
showCategoryChooser: Ember.computed.not("model.isPrivateMessage"),
|
||||
|
||||
gotoInbox(name) {
|
||||
var url = '/users/' + this.get('currentUser.username_lower') + '/messages';
|
||||
|
|
|
@ -87,7 +87,6 @@ const Category = RestModel.extend({
|
|||
custom_fields: this.get('custom_fields'),
|
||||
topic_template: this.get('topic_template'),
|
||||
suppress_from_homepage: this.get('suppress_from_homepage'),
|
||||
contains_messages: this.get("contains_messages"),
|
||||
},
|
||||
type: this.get('id') ? 'PUT' : 'POST'
|
||||
});
|
||||
|
|
|
@ -67,12 +67,10 @@ const Composer = RestModel.extend({
|
|||
creatingPrivateMessage: Em.computed.equal('action', PRIVATE_MESSAGE),
|
||||
notCreatingPrivateMessage: Em.computed.not('creatingPrivateMessage'),
|
||||
|
||||
@computed("privateMessage", "archetype.hasOptions", "categoryId")
|
||||
showCategoryChooser(isPrivateMessage, hasOptions, categoryId) {
|
||||
@computed("privateMessage", "archetype.hasOptions")
|
||||
showCategoryChooser(isPrivateMessage, hasOptions) {
|
||||
const manyCategories = Discourse.Category.list().length > 1;
|
||||
const category = Discourse.Category.findById(categoryId);
|
||||
const containsMessages = category && category.get("contains_messages");
|
||||
return !isPrivateMessage && !containsMessages && (hasOptions || manyCategories);
|
||||
return !isPrivateMessage && (hasOptions || manyCategories);
|
||||
},
|
||||
|
||||
privateMessage: function(){
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
</section>
|
||||
|
||||
{{#if emailInEnabled}}
|
||||
<section class='field'>
|
||||
<label>
|
||||
{{input type="checkbox" checked=category.contains_messages}}
|
||||
{{i18n 'category.contains_messages'}}
|
||||
</label>
|
||||
</section>
|
||||
<section class='field'>
|
||||
<label>
|
||||
{{input type="checkbox" checked=category.email_in_allow_strangers}}
|
||||
|
|
|
@ -178,7 +178,6 @@ class CategoriesController < ApplicationController
|
|||
:position,
|
||||
:email_in,
|
||||
:email_in_allow_strangers,
|
||||
:contains_messages,
|
||||
:suppress_from_homepage,
|
||||
:parent_category_id,
|
||||
:auto_close_hours,
|
||||
|
|
|
@ -474,7 +474,6 @@ end
|
|||
# auto_close_based_on_last_post :boolean default(FALSE)
|
||||
# topic_template :text
|
||||
# suppress_from_homepage :boolean default(FALSE)
|
||||
# contains_messages :boolean default(FALSE), not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
|
|
|
@ -544,7 +544,6 @@ class Topic < ActiveRecord::Base
|
|||
|
||||
def change_category_to_id(category_id)
|
||||
return false if private_message?
|
||||
return false if category.try(:contains_messages)
|
||||
|
||||
new_category_id = category_id.to_i
|
||||
# if the category name is blank, reset the attribute
|
||||
|
|
|
@ -19,8 +19,7 @@ class BasicCategorySerializer < ApplicationSerializer
|
|||
:background_url,
|
||||
:can_edit,
|
||||
:topic_template,
|
||||
:has_children,
|
||||
:contains_messages
|
||||
:has_children
|
||||
|
||||
def include_parent_category_id?
|
||||
parent_category_id
|
||||
|
|
|
@ -1631,7 +1631,6 @@ 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.'
|
||||
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"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveContainsMessageOnCategory < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :categories, :contains_messages
|
||||
end
|
||||
end
|
|
@ -898,18 +898,6 @@ describe TopicsController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when topic is in support category' 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, 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
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "allow_uncategorized_topics is false" do
|
||||
before do
|
||||
SiteSetting.stubs(:allow_uncategorized_topics).returns(false)
|
||||
|
|
Loading…
Reference in New Issue
Block a user