FIX: adding the 'contains_messages' column back

This commit is contained in:
Régis Hanol 2016-01-12 12:06:51 +01:00
parent 8049dfdfda
commit e2744fc19f
12 changed files with 21 additions and 15 deletions

View File

@ -6,9 +6,9 @@ import PermissionType from 'discourse/models/permission-type';
export default ComboboxView.extend({ export default ComboboxView.extend({
classNames: ['combobox category-combobox'], classNames: ['combobox category-combobox'],
overrideWidths: true,
dataAttributes: ['id', 'description_text'], dataAttributes: ['id', 'description_text'],
valueBinding: Ember.Binding.oneWay('source'), valueBinding: Ember.Binding.oneWay('source'),
overrideWidths: true,
castInteger: true, castInteger: true,
@computed("scopedCategoryId", "categories") @computed("scopedCategoryId", "categories")

View File

@ -18,8 +18,8 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
queryParams: ['filter', 'username_filters', 'show_deleted'], queryParams: ['filter', 'username_filters', 'show_deleted'],
loadedAllPosts: Em.computed.or('model.postStream.loadedAllPosts', 'model.postStream.loadingLastPost'), loadedAllPosts: Em.computed.or('model.postStream.loadedAllPosts', 'model.postStream.loadingLastPost'),
enteredAt: null, enteredAt: null,
firstPostExpanded: false,
retrying: false, retrying: false,
firstPostExpanded: false,
adminMenuVisible: false, adminMenuVisible: false,
showRecover: Em.computed.and('model.deleted', 'model.details.can_recover'), showRecover: Em.computed.and('model.deleted', 'model.details.can_recover'),

View File

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

View File

@ -73,9 +73,10 @@ const Composer = RestModel.extend({
return !isPrivateMessage && (hasOptions || manyCategories); return !isPrivateMessage && (hasOptions || manyCategories);
}, },
privateMessage: function(){ @computed("creatingPrivateMessage", "topic")
return this.get('creatingPrivateMessage') || this.get('topic.archetype') === 'private_message'; privateMessage(creatingPrivateMessage, topic) {
}.property('creatingPrivateMessage', 'topic'), return creatingPrivateMessage || (topic && topic.get('archetype') === 'private_message');
},
topicFirstPost: Em.computed.or('creatingTopic', 'editingFirstPost'), topicFirstPost: Em.computed.or('creatingTopic', 'editingFirstPost'),

View File

@ -26,6 +26,7 @@
{{i18n 'category.email_in_allow_strangers'}} {{i18n 'category.email_in_allow_strangers'}}
</label> </label>
</section> </section>
<section class='field'> <section class='field'>
<label> <label>
{{fa-icon "envelope-o"}} {{fa-icon "envelope-o"}}

View File

@ -184,8 +184,8 @@ class CategoriesController < ApplicationController
:auto_close_based_on_last_post, :auto_close_based_on_last_post,
:logo_url, :logo_url,
:background_url, :background_url,
:allow_badges,
:slug, :slug,
:allow_badges,
:topic_template, :topic_template,
:custom_fields => [params[:custom_fields].try(:keys)], :custom_fields => [params[:custom_fields].try(:keys)],
:permissions => [*p.try(:keys)]) :permissions => [*p.try(:keys)])

View File

@ -75,6 +75,7 @@ class Category < ActiveRecord::Base
scoped_to_permissions(guardian, [:create_post, :full]) scoped_to_permissions(guardian, [:create_post, :full])
end end
} }
delegate :post_template, to: 'self.class' delegate :post_template, to: 'self.class'
# permission is just used by serialization # permission is just used by serialization

View File

@ -27,7 +27,7 @@ class Topic < ActiveRecord::Base
attr_accessor :allowed_user_ids attr_accessor :allowed_user_ids
def self.max_sort_order def self.max_sort_order
2**31 - 1 @max_sort_order ||= (2 ** 31) - 1
end end
def featured_users def featured_users

View File

@ -11,12 +11,12 @@ class BasicCategorySerializer < ApplicationSerializer
:description, :description,
:description_text, :description_text,
:topic_url, :topic_url,
:logo_url,
:background_url,
:read_restricted, :read_restricted,
:permission, :permission,
:parent_category_id, :parent_category_id,
:notification_level, :notification_level,
:logo_url,
:background_url,
:can_edit, :can_edit,
:topic_template, :topic_template,
:has_children :has_children

View File

@ -1,9 +1,9 @@
# encoding: utf-8 # encoding: utf-8
#
# This file contains content for the client portion of Discourse, sent out # This file contains content for the client portion of Discourse, sent out
# to the Javascript app. # to the Javascript app.
# #
# To work with us on translations, see: # To work with us on translations, see: https://www.transifex.com/projects/p/discourse-org/
# https://www.transifex.com/projects/p/discourse-org/
# #
# This is a "source" file, which is used by Transifex to get translations for other languages. # This is a "source" file, which is used by Transifex to get translations for other languages.
# After this file is changed, it needs to be pushed by a maintainer to Transifex: # After this file is changed, it needs to be pushed by a maintainer to Transifex:
@ -12,8 +12,7 @@
# #
# Read more here: https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882 # Read more here: https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882
# #
# To validate this YAML file after you change it, please paste it into # To validate this YAML file after you change it, please paste it into http://yamllint.com/
# http://yamllint.com/
en: en:
js: js:

View File

@ -0,0 +1,5 @@
class AddContainsMessagesBackToCategories < ActiveRecord::Migration
def change
add_column :categories, :contains_messages, :boolean
end
end

View File

@ -199,7 +199,6 @@ class TopicQuery
end end
def prioritize_pinned_topics(topics, options) def prioritize_pinned_topics(topics, options)
pinned_clause = options[:category_id] ? "topics.category_id = #{options[:category_id].to_i} AND" : "pinned_globally AND " pinned_clause = options[:category_id] ? "topics.category_id = #{options[:category_id].to_i} AND" : "pinned_globally AND "
pinned_clause << " pinned_at IS NOT NULL " pinned_clause << " pinned_at IS NOT NULL "
if @user if @user