From bbf0312e72781013e8790281542dc6911b0243d6 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 1 Nov 2013 15:17:38 -0400 Subject: [PATCH 1/5] FIX: Non-Admins couldn't send private messages through the new user expansion --- app/assets/javascripts/discourse/routes/topic_route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/routes/topic_route.js b/app/assets/javascripts/discourse/routes/topic_route.js index 2e15687189ee0..3da8d1e252c0b 100644 --- a/app/assets/javascripts/discourse/routes/topic_route.js +++ b/app/assets/javascripts/discourse/routes/topic_route.js @@ -19,7 +19,7 @@ Discourse.TopicRoute = Discourse.Route.extend({ composePrivateMessage: function(user) { var self = this; - this.transitionTo('userPrivateMessages', user).then(function () { + this.transitionTo('userActivity', user).then(function () { self.controllerFor('userActivity').send('composePrivateMessage'); }); }, From 1f283b5ca92a3b105c6106dcdfad5302ae6537f3 Mon Sep 17 00:00:00 2001 From: Kris Aubuchon Date: Fri, 1 Nov 2013 15:45:56 -0400 Subject: [PATCH 2/5] main logo size consistency fix --- app/assets/stylesheets/desktop/header.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/assets/stylesheets/desktop/header.scss b/app/assets/stylesheets/desktop/header.scss index d6e4303639fa6..3f8f6acd0a3fd 100644 --- a/app/assets/stylesheets/desktop/header.scss +++ b/app/assets/stylesheets/desktop/header.scss @@ -29,8 +29,7 @@ } } #site-logo { - max-height: 40px; - max-width: 350px; + width: 122px; } .icon-home { font-size: 20px; From 04aa1690e24d3e3d23c74c467db5642683e438db Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 1 Nov 2013 15:48:28 -0400 Subject: [PATCH 3/5] Adjust ul,ol margins --- app/assets/stylesheets/desktop/topic-post.scss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scss index 374f2db569171..62e2ea4111c89 100644 --- a/app/assets/stylesheets/desktop/topic-post.scss +++ b/app/assets/stylesheets/desktop/topic-post.scss @@ -39,7 +39,7 @@ h1 .topic-statuses .topic-status i {margin-right: 5px;} margin-left: -8px; } -.avoid-tab { +.avoid-tab { padding-top: 25px; .topic-meta-data-inside {margin-top: -30px;} } @@ -131,7 +131,7 @@ nav.post-controls { border: none; margin-left: 3px; transition: all linear 0.15s; - outline: none; + outline: none; &:hover { background: #eee; color: #888; @@ -394,12 +394,12 @@ span.post-count { #topic-title { z-index: 1000; padding: 14px 0 8px 0; - h1 { - line-height: 1.2em; - overflow: hidden; + h1 { + line-height: 1.2em; + overflow: hidden; } .topic-statuses { - margin-top: -2px; + margin-top: -2px; .icon-pushpin {margin-top: -1px;} } .star {font-size: 20px; margin-top: 8px;} @@ -435,7 +435,7 @@ iframe { } .extra-info-wrapper { - float: left; + float: left; width: 78%; .topic-statuses {margin-right: 5px;} } @@ -499,7 +499,7 @@ iframe { .contents .cooked { padding-right: 30px; h1, h2, h3 {margin: 10px 0;} - ul, ol {margin: 15px 0;} + ul, ol {margin: 0 15px;} li p {margin: 3px 0;} } From 52c34571331b950bcf56b827301eb44dd6775b0a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 1 Nov 2013 16:32:12 -0400 Subject: [PATCH 4/5] Site setting to support showing real names in posts. Also put back in type to search on site settings --- .../controllers/admin_site_settings_controller.js | 15 ++++----------- .../admin/templates/site_settings.js.handlebars | 3 +-- app/assets/javascripts/discourse/models/post.js | 5 +++++ .../discourse/templates/post.js.handlebars | 5 +++++ app/models/site_setting.rb | 1 + config/locales/client.cs.yml | 1 + config/locales/client.da.yml | 1 + config/locales/client.de.yml | 1 + config/locales/client.en.yml | 2 +- config/locales/client.es.yml | 1 + config/locales/client.fr.yml | 1 + config/locales/client.id.yml | 1 + config/locales/client.it.yml | 1 + config/locales/client.ko.yml | 1 + config/locales/client.nb_NO.yml | 1 + config/locales/client.nl.yml | 1 + config/locales/client.pseudo.yml | 1 + config/locales/client.pt.yml | 1 + config/locales/client.pt_BR.yml | 1 + config/locales/client.ru.yml | 1 + config/locales/client.sv.yml | 1 + config/locales/client.zh_CN.yml | 1 + config/locales/client.zh_TW.yml | 1 + config/locales/server.en.yml | 1 + 24 files changed, 35 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js index 924654a2ba7bd..e3d2dacd5b36a 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js @@ -26,7 +26,9 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P } var adminSettingsController = this; - return this.get('content').filter(function(item, index, enumerable) { + + var maxResults = Em.isNone(filter) ? this.get('content.length') : 20; + return _.first(this.get('content').filter(function(item, index, enumerable) { if (adminSettingsController.get('onlyOverridden') && !item.get('overridden')) return false; if (filter) { if (item.get('setting').toLowerCase().indexOf(filter) > -1) return true; @@ -36,20 +38,11 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P } return true; - }); + }), maxResults); }.property('filter', 'content.@each', 'onlyOverridden'), actions: { - /** - Changes the currently active filter - - @method changeFilter - **/ - changeFilter: function() { - this.set('filter', this.get('newFilter')); - }, - /** Reset a setting to its default value diff --git a/app/assets/javascripts/admin/templates/site_settings.js.handlebars b/app/assets/javascripts/admin/templates/site_settings.js.handlebars index 25885c1572d5f..ff6e21ab79a48 100644 --- a/app/assets/javascripts/admin/templates/site_settings.js.handlebars +++ b/app/assets/javascripts/admin/templates/site_settings.js.handlebars @@ -6,8 +6,7 @@
- {{textField value=newFilter}} - + {{textField value=filter placeholderKey="type_to_filter"}}
diff --git a/app/assets/javascripts/discourse/models/post.js b/app/assets/javascripts/discourse/models/post.js index 4696996ddab13..7cae814f96217 100644 --- a/app/assets/javascripts/discourse/models/post.js +++ b/app/assets/javascripts/discourse/models/post.js @@ -32,6 +32,11 @@ Discourse.Post = Discourse.Model.extend({ notDeleted: Em.computed.not('deleted'), userDeleted: Em.computed.empty('user_id'), + showName: function() { + var name = this.get('name'); + return name && (name !== this.get('username')) && Discourse.SiteSettings.display_name_on_posts; + }.property('name', 'username'), + postDeletedBy: function() { if (this.get('firstPost')) { return this.get('topic.deleted_by'); } return this.get('deleted_by'); diff --git a/app/assets/javascripts/discourse/templates/post.js.handlebars b/app/assets/javascripts/discourse/templates/post.js.handlebars index 95da0cd1d8323..641d43d93a10a 100644 --- a/app/assets/javascripts/discourse/templates/post.js.handlebars +++ b/app/assets/javascripts/discourse/templates/post.js.handlebars @@ -21,6 +21,11 @@
{{avatar this imageSize="large"}}

{{breakUp username}}

+ + {{#if showName}} +

{{breakUp name}}

+ {{/if}} + {{#if user_title}}
{{user_title}}
{{/if}}
{{else}} diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index 9a7adf6c224f3..070b1115c8e14 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -270,6 +270,7 @@ class SiteSetting < ActiveRecord::Base # hidden setting only used by system setting(:uncategorized_category_id, -1, hidden: true) + client_setting(:display_name_on_posts, false) client_setting(:enable_names, true) def self.call_discourse_hub? diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml index 2ade576b92266..cce34b0039de6 100644 --- a/config/locales/client.cs.yml +++ b/config/locales/client.cs.yml @@ -1062,6 +1062,7 @@ cs: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "zadejte text pro filtrování..." admin: title: 'Discourse Administrace' diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml index 55a904717dca8..ab1e894c31523 100644 --- a/config/locales/client.da.yml +++ b/config/locales/client.da.yml @@ -683,6 +683,7 @@ da: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "type to filter..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml index b09d24178a5e1..8fc524b39a39e 100644 --- a/config/locales/client.de.yml +++ b/config/locales/client.de.yml @@ -1049,6 +1049,7 @@ de: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "Tippe etwas ein, um zu filtern..." admin: title: 'Discourse Administrator' diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 3775cae9238fe..f51176145b03f 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1074,7 +1074,7 @@ en: # This section is exported to the javascript for i18n in the admin section admin_js: - filter: "filter" + type_to_filter: "type to filter..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml index a38aa47f18368..4e04aebfa3d83 100644 --- a/config/locales/client.es.yml +++ b/config/locales/client.es.yml @@ -793,6 +793,7 @@ es: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "type to filter..." admin: title: 'Administrador' diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml index 44e0b3f94003f..32a94c5bc3ddc 100644 --- a/config/locales/client.fr.yml +++ b/config/locales/client.fr.yml @@ -1032,6 +1032,7 @@ fr: create_post: "Répondre / Voir" readonly: "Voir" admin_js: + type_to_filter: "Commencez à taper pour filtrer..." admin: title: 'Administation Discourse' moderator: 'Modérateur' diff --git a/config/locales/client.id.yml b/config/locales/client.id.yml index 4ffb456916525..b2ccba06c585a 100644 --- a/config/locales/client.id.yml +++ b/config/locales/client.id.yml @@ -638,6 +638,7 @@ id: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "type to filter..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml index 7b279a80acfb7..b1749051409b3 100644 --- a/config/locales/client.it.yml +++ b/config/locales/client.it.yml @@ -1001,6 +1001,7 @@ it: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "scrivi per filtrare..." admin: title: 'Amministrazione Discourse' diff --git a/config/locales/client.ko.yml b/config/locales/client.ko.yml index 722c8a881afca..2abaab6bc7d95 100644 --- a/config/locales/client.ko.yml +++ b/config/locales/client.ko.yml @@ -841,6 +841,7 @@ ko: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "필터를 입력하세요" admin: title: 'Discourse 관리자' diff --git a/config/locales/client.nb_NO.yml b/config/locales/client.nb_NO.yml index 3b56e82cc250d..a18da7acb51e9 100644 --- a/config/locales/client.nb_NO.yml +++ b/config/locales/client.nb_NO.yml @@ -914,6 +914,7 @@ nb_NO: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "skriv for å filtrere..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml index 8d3dc6357a364..5e64204e5c5df 100644 --- a/config/locales/client.nl.yml +++ b/config/locales/client.nl.yml @@ -1014,6 +1014,7 @@ nl: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: typ om te filteren... admin: title: Discourse Beheer diff --git a/config/locales/client.pseudo.yml b/config/locales/client.pseudo.yml index 5e7f474175e77..172a7f31266b3 100644 --- a/config/locales/client.pseudo.yml +++ b/config/locales/client.pseudo.yml @@ -969,6 +969,7 @@ pseudo: ƀřóŵšéř íš ťóó ółď ťó ŵóřǩ óɳ ťĥíš Ďíščóůřšé ƒóřůɱ. Рłéášé <á ĥřéƒ="ĥťťƿ://ƀřóŵšéĥáƿƿý.čóɱ">ůƿǧřáďé ýóůř ƀřóŵšéř. ]]' admin_js: + type_to_filter: '[[ ťýƿé ťó ƒíłťéř... ]]' admin: title: '[[ Ďíščóůřšé Áďɱíɳ ]]' moderator: '[[ Ϻóďéřáťóř ]]' diff --git a/config/locales/client.pt.yml b/config/locales/client.pt.yml index 857a28344f409..c6a2179cb07b6 100644 --- a/config/locales/client.pt.yml +++ b/config/locales/client.pt.yml @@ -602,6 +602,7 @@ pt: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "escreve para filtrar..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.pt_BR.yml b/config/locales/client.pt_BR.yml index aaef72092a180..3b0e986d506c0 100644 --- a/config/locales/client.pt_BR.yml +++ b/config/locales/client.pt_BR.yml @@ -1069,6 +1069,7 @@ pt_BR: # Essa seção é para o javascript para i18n no admin admin_js: + type_to_filter: "escreva para filtrar..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.ru.yml b/config/locales/client.ru.yml index 1d1373eaf73b7..406c9ab29531e 100644 --- a/config/locales/client.ru.yml +++ b/config/locales/client.ru.yml @@ -1085,6 +1085,7 @@ ru: create_post: 'Отвечать / Просматривать' readonly: Просматривать admin_js: + type_to_filter: 'Введите текст для фильтрации...' admin: title: 'Discourse Admin' moderator: Модератор diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml index a07376eaa20c9..2fedf9af4a562 100644 --- a/config/locales/client.sv.yml +++ b/config/locales/client.sv.yml @@ -788,6 +788,7 @@ sv: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "skriv för att filtrera..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml index 2843bda89faf4..26fc3c21f71a9 100644 --- a/config/locales/client.zh_CN.yml +++ b/config/locales/client.zh_CN.yml @@ -1075,6 +1075,7 @@ zh_CN: # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "输入过滤条件……" admin: title: '论道 管理' diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml index 36b940e883d15..7d913a2040fa0 100644 --- a/config/locales/client.zh_TW.yml +++ b/config/locales/client.zh_TW.yml @@ -968,6 +968,7 @@ zh_TW: readonly: "觀看" # This section is exported to the javascript for i18n in the admin section admin_js: + type_to_filter: "輸入過濾條件……" admin: title: '論道 管理' diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index f1449556edfa9..bf95d69ad6232 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -722,6 +722,7 @@ en: dominating_topic_minimum_percent: "What percentage of posts a user has to make in a topic before we consider it dominating." enable_names: "Allow users to show their full names" + display_name_on_posts: "Also show a user's full name on their posts" notification_types: mentioned: "%{display_username} mentioned you in %{link}" From e679ba97a3be36df7e67a53ae85c14237bb5d304 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 1 Nov 2013 16:55:56 -0400 Subject: [PATCH 5/5] FIX: categories created by users who are deleted cannot be deleted --- lib/user_destroyer.rb | 13 +++++++++++++ spec/components/user_destroyer_spec.rb | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/user_destroyer.rb b/lib/user_destroyer.rb index 8f27154a9f370..dcc2bb0bd2082 100644 --- a/lib/user_destroyer.rb +++ b/lib/user_destroyer.rb @@ -42,6 +42,19 @@ def destroy(user, opts={}) b.record_match! if b end Post.with_deleted.where(user_id: user.id).update_all("user_id = NULL") + + # If this user created categories, fix those up: + categories = Category.where(user_id: user.id).all + categories.each do |c| + c.user_id = Discourse.system_user.id + c.save! + if topic = Topic.with_deleted.where(id: c.topic_id).first + topic.try(:recover!) + topic.user_id = Discourse.system_user.id + topic.save! + end + end + StaffActionLogger.new(@staff).log_user_deletion(user, opts.slice(:context)) DiscourseHub.unregister_nickname(user.username) if SiteSetting.call_discourse_hub? MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id] diff --git a/spec/components/user_destroyer_spec.rb b/spec/components/user_destroyer_spec.rb index bb5a48986cbe6..a04629579494a 100644 --- a/spec/components/user_destroyer_spec.rb +++ b/spec/components/user_destroyer_spec.rb @@ -238,6 +238,17 @@ UserDestroyer.new(@admin).destroy(@user, {block_ip: true}) end end + + context 'user created a category' do + let!(:category) { Fabricate(:category, user: @user) } + + it "assigns the system user to the categories" do + UserDestroyer.new(@admin).destroy(@user, {delete_posts: true}) + category.reload.user_id.should == Discourse.system_user.id + category.topic.should be_present + category.topic.user_id.should == Discourse.system_user.id + end + end end end