From 5fc150e057893bd71e3d7235d3e446418aace93a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 14:37:23 -0400 Subject: [PATCH 1/8] A mucher saner API for updating the title of routes, even when nested. Properly sends the title of the page to google analytics --- .../javascripts/admin/routes/admin_route.js | 12 ++-------- app/assets/javascripts/discourse.js | 14 ++++------- .../discourse/controllers/topic.js.es6 | 14 +++++++++-- .../initializers/page-tracking.js.es6 | 10 ++++---- .../javascripts/discourse/lib/page_tracker.js | 4 ++-- .../javascripts/discourse/routes/about.js.es6 | 6 ++--- .../discourse/routes/application.js.es6 | 7 ++++++ .../discourse/routes/badges-index.js.es6 | 6 ++--- .../discourse/routes/badges-show.js.es6 | 10 ++++++-- .../routes/build-category-route.js.es6 | 12 ++++++---- .../discourse/routes/build-topic-route.js.es6 | 16 ++++++------- .../discourse/routes/discourse_route.js | 23 +++++++++++++++++++ .../routes/discovery_categories_route.js | 14 ++++------- .../discourse/routes/topic_route.js | 8 +++++++ .../javascripts/discourse/routes/user.js.es6 | 8 +++++++ .../javascripts/discourse/views/topic.js.es6 | 5 ---- .../javascripts/discourse/views/user.js.es6 | 9 +------- 17 files changed, 106 insertions(+), 72 deletions(-) diff --git a/app/assets/javascripts/admin/routes/admin_route.js b/app/assets/javascripts/admin/routes/admin_route.js index 2ffc74c97e2..e90a18f5fb3 100644 --- a/app/assets/javascripts/admin/routes/admin_route.js +++ b/app/assets/javascripts/admin/routes/admin_route.js @@ -1,17 +1,9 @@ -/** - The base admin route - - @class AdminRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ Discourse.AdminRoute = Discourse.Route.extend({ renderTemplate: function() { this.render('admin/templates/admin'); }, - activate: function() { - Discourse.set('title', I18n.t('admin_title')); + titleToken: function() { + return I18n.t('admin_title'); } }); diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index dfaa061720d..27b12c53abb 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -10,6 +10,7 @@ var DiscourseResolver = require('discourse/ember/resolver').default; window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, { rootElement: '#main', + _docTitle: null, getURL: function(url) { // If it's a non relative URL, return it. @@ -25,13 +26,8 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, { Resolver: DiscourseResolver, - titleChanged: function() { - var title = ""; - - if (this.get('title')) { - title += "" + (this.get('title')) + " - "; - } - title += Discourse.SiteSettings.title; + _titleChanged: function() { + var title = this.get('_docTitle') || Discourse.SiteSettings.title; // if we change this we can trigger changes on document.title // only set if changed. @@ -44,14 +40,14 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, { title = "(" + notifyCount + ") " + title; } - if(title !== document.title) { + if (title !== document.title) { // chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome window.setTimeout(function() { document.title = "."; document.title = title; }, 200); } - }.observes('title', 'hasFocus', 'notifyCount'), + }.observes('_docTitle', 'hasFocus', 'notifyCount'), faviconChanged: function() { if(Discourse.User.currentProp('dynamic_favicon')) { diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index d163fff5a7a..8c54c841a54 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -11,11 +11,21 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, { maxTitleLength: Discourse.computed.setting('max_topic_title_length'), - contextChanged: function(){ + contextChanged: function() { this.set('controllers.search.searchContext', this.get('model.searchContext')); }.observes('topic'), - termChanged: function(){ + _titleChanged: function() { + var title = this.get('title'); + if (!Em.empty(title)) { + + // Note normally you don't have to trigger this, but topic titles can be updated + // and are sometimes lazily loaded. + this.send('refreshTitle'); + } + }.observes('title'), + + termChanged: function() { var dropdown = this.get('controllers.header.visibleDropdown'); var term = this.get('controllers.search.term'); diff --git a/app/assets/javascripts/discourse/initializers/page-tracking.js.es6 b/app/assets/javascripts/discourse/initializers/page-tracking.js.es6 index 9faab0c4acd..bfb3f3d7fc8 100644 --- a/app/assets/javascripts/discourse/initializers/page-tracking.js.es6 +++ b/app/assets/javascripts/discourse/initializers/page-tracking.js.es6 @@ -12,16 +12,18 @@ export default { // Out of the box, Discourse tries to track google analytics // if it is present if (typeof window._gaq !== 'undefined') { - pageTracker.on('change', function() { - window._gaq.push(['_trackPageview', window.location.pathname+window.location.search]); + pageTracker.on('change', function(url, title) { + window._gaq.push(["_set", "title", title]); + window._gaq.push(['_trackPageview', url]); }); return; } + // Also use Universal Analytics if it is present if (typeof window.ga !== 'undefined') { - pageTracker.on('change', function() { - window.ga('send', 'pageview', window.location.pathname+window.location.search); + pageTracker.on('change', function(url, title) { + window.ga('send', 'pageview', {page: url, title: title}); }); } } diff --git a/app/assets/javascripts/discourse/lib/page_tracker.js b/app/assets/javascripts/discourse/lib/page_tracker.js index cd581ee01e1..52da9ff6cb3 100644 --- a/app/assets/javascripts/discourse/lib/page_tracker.js +++ b/app/assets/javascripts/discourse/lib/page_tracker.js @@ -22,8 +22,8 @@ Discourse.PageTracker = Ember.Object.extend(Ember.Evented, { self = this; router.on('didTransition', function() { - var router = this; - self.trigger('change', router.get('url')); + this.send('refreshTitle'); + self.trigger('change', this.get('url'), Discourse.get('_docTitle')); }); this.set('started', true); } diff --git a/app/assets/javascripts/discourse/routes/about.js.es6 b/app/assets/javascripts/discourse/routes/about.js.es6 index 962b0f50d73..3021dd0835f 100644 --- a/app/assets/javascripts/discourse/routes/about.js.es6 +++ b/app/assets/javascripts/discourse/routes/about.js.es6 @@ -5,9 +5,7 @@ export default Discourse.Route.extend({ }); }, - setupController: function(controller, model) { - controller.set('model', model); - Discourse.set('title', I18n.t('about.simple_title')); + titleToken: function() { + return I18n.t('about.simple_title'); } }); - diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6 index ae75165f696..ddc4d635938 100644 --- a/app/assets/javascripts/discourse/routes/application.js.es6 +++ b/app/assets/javascripts/discourse/routes/application.js.es6 @@ -1,6 +1,13 @@ var ApplicationRoute = Em.Route.extend({ + siteTitle: Discourse.computed.setting('title'), + actions: { + _collectTitleTokens: function(tokens) { + tokens.push(this.get('siteTitle')); + Discourse.set('_docTitle', tokens.join(' - ')); + }, + showTopicEntrance: function(data) { this.controllerFor('topic-entrance').send('show', data); }, diff --git a/app/assets/javascripts/discourse/routes/badges-index.js.es6 b/app/assets/javascripts/discourse/routes/badges-index.js.es6 index 48992756b25..fb7e9905654 100644 --- a/app/assets/javascripts/discourse/routes/badges-index.js.es6 +++ b/app/assets/javascripts/discourse/routes/badges-index.js.es6 @@ -1,5 +1,4 @@ export default Discourse.Route.extend({ - model: function() { if (PreloadStore.get('badges')) { return PreloadStore.getAndRemove('badges').then(function(json) { @@ -10,8 +9,7 @@ export default Discourse.Route.extend({ } }, - setupController: function(controller, model) { - controller.set('model', model); - Discourse.set('title', I18n.t('badges.title')); + titleToken: function() { + return I18n.t('badges.title'); } }); diff --git a/app/assets/javascripts/discourse/routes/badges-show.js.es6 b/app/assets/javascripts/discourse/routes/badges-show.js.es6 index e0b817a5e50..a9dbc00f16b 100644 --- a/app/assets/javascripts/discourse/routes/badges-show.js.es6 +++ b/app/assets/javascripts/discourse/routes/badges-show.js.es6 @@ -1,4 +1,4 @@ -export default Ember.Route.extend({ +export default Discourse.Route.extend({ serialize: function(model) { return {id: model.get('id'), slug: model.get('name').replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase()}; }, @@ -13,12 +13,18 @@ export default Ember.Route.extend({ } }, + titleToken: function() { + var model = this.modelFor('badges.show'); + if (model) { + return model.get('displayName'); + } + }, + setupController: function(controller, model) { Discourse.UserBadge.findByBadgeId(model.get('id')).then(function(userBadges) { controller.set('userBadges', userBadges); controller.set('userBadgesLoaded', true); }); controller.set('model', model); - Discourse.set('title', model.get('displayName')); } }); diff --git a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 index 645df896dda..26d753eb43a 100644 --- a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 @@ -61,13 +61,17 @@ export default function(filter, params) { }); }, + titleToken: function() { + var filterText = I18n.t('filters.' + filter.replace('/', '.') + '.title', {count: 0}), + model = this.currentModel; + + return I18n.t('filters.with_category', { filter: filterText, category: model.get('name') }); + }, + setupController: function(controller, model) { var topics = this.get('topics'), periods = this.controllerFor('discovery').get('periods'), - periodId = topics.get('for_period') || (filter.indexOf('/') > 0 ? filter.split('/')[1] : ''), - filterText = I18n.t('filters.' + filter.replace('/', '.') + '.title', {count: 0}); - - Discourse.set('title', I18n.t('filters.with_category', { filter: filterText, category: model.get('name') })); + periodId = topics.get('for_period') || (filter.indexOf('/') > 0 ? filter.split('/')[1] : ''); this.controllerFor('navigation/category').set('canCreateTopic', topics.get('can_create_topic')); this.controllerFor('discovery/topics').setProperties({ diff --git a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 index 98d5bae6df1..3b764cc6a7d 100644 --- a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 @@ -32,6 +32,13 @@ export default function(filter, extras) { return Discourse.TopicList.list(filter, findOpts, extras); }, + titleToken: function() { + if (filter === Discourse.Utilities.defaultHomepage()) { return; } + + var filterText = I18n.t('filters.' + filter.replace('/', '.') + '.title', {count: 0}); + return I18n.t('filters.with_topics', {filter: filterText}); + }, + setupController: function(controller, model, trans) { controller.setProperties(Em.getProperties(trans, _.keys(queryParams).map(function(v){ @@ -39,14 +46,7 @@ export default function(filter, extras) { }))); var periods = this.controllerFor('discovery').get('periods'), - periodId = model.get('for_period') || (filter.indexOf('/') > 0 ? filter.split('/')[1] : ''), - filterText = I18n.t('filters.' + filter.replace('/', '.') + '.title', {count: 0}); - - if (filter === Discourse.Utilities.defaultHomepage()) { - Discourse.set('title', ''); - } else { - Discourse.set('title', I18n.t('filters.with_topics', {filter: filterText})); - } + periodId = model.get('for_period') || (filter.indexOf('/') > 0 ? filter.split('/')[1] : ''); this.controllerFor('discovery/topics').setProperties({ model: model, diff --git a/app/assets/javascripts/discourse/routes/discourse_route.js b/app/assets/javascripts/discourse/routes/discourse_route.js index 820c3c0b09a..2302716085a 100644 --- a/app/assets/javascripts/discourse/routes/discourse_route.js +++ b/app/assets/javascripts/discourse/routes/discourse_route.js @@ -21,6 +21,29 @@ Discourse.Route = Em.Route.extend({ Em.run.scheduleOnce('afterRender', Discourse.Route, 'cleanDOM'); }, + actions: { + _collectTitleTokens: function(tokens) { + // If there's a title token method, call it and get the token + if (this.titleToken) { + var t = this.titleToken(); + if (t && t.length) { + if (t instanceof Array) { + t.forEach(function(ti) { + tokens.push(ti); + }); + } else { + tokens.push(t); + } + } + } + return true; + }, + + refreshTitle: function() { + this.send('_collectTitleTokens', []); + } + }, + redirectIfLoginRequired: function() { var app = this.controllerFor('application'); if (app.get('loginRequired')) { diff --git a/app/assets/javascripts/discourse/routes/discovery_categories_route.js b/app/assets/javascripts/discourse/routes/discovery_categories_route.js index ffc5042a5ff..13f066865be 100644 --- a/app/assets/javascripts/discourse/routes/discovery_categories_route.js +++ b/app/assets/javascripts/discourse/routes/discovery_categories_route.js @@ -1,11 +1,3 @@ -/** - The route for handling the "Categories" view - - @class DiscoveryCategoriesRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenComposer, { renderTemplate: function() { this.render('navigation/categories', { outlet: 'navigation-bar' }); @@ -31,16 +23,18 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenCompos }); }, + titleToken: function() { + return I18n.t('filters.categories.title'); + }, + setupController: function(controller, model) { controller.set('model', model); - Discourse.set('title', I18n.t('filters.categories.title')); // Only show either the Create Category or Create Topic button this.controllerFor('navigation/categories').set('canCreateCategory', model.get('can_create_category')); this.controllerFor('navigation/categories').set('canCreateTopic', model.get('can_create_topic') && !model.get('can_create_category')); this.openTopicDraft(model); - }, actions: { diff --git a/app/assets/javascripts/discourse/routes/topic_route.js b/app/assets/javascripts/discourse/routes/topic_route.js index 583f008cc70..a02a635bc67 100644 --- a/app/assets/javascripts/discourse/routes/topic_route.js +++ b/app/assets/javascripts/discourse/routes/topic_route.js @@ -12,7 +12,15 @@ Discourse.TopicRoute = Discourse.Route.extend({ show_deleted: { replace: true } }, + titleToken: function() { + var model = this.modelFor('topic'); + if (model) { + return model.get('title'); + } + }, + actions: { + showTopicAdminMenu: function() { this.controllerFor("topic-admin-menu").send("show"); }, diff --git a/app/assets/javascripts/discourse/routes/user.js.es6 b/app/assets/javascripts/discourse/routes/user.js.es6 index 3bcd085acc7..7ae758de0b4 100644 --- a/app/assets/javascripts/discourse/routes/user.js.es6 +++ b/app/assets/javascripts/discourse/routes/user.js.es6 @@ -1,5 +1,13 @@ export default Discourse.Route.extend({ + titleToken: function() { + var model = this.modelFor('user'); + var username = model.get('username'); + if (username) { + return [I18n.t("user.profile"), username]; + } + }, + actions: { logout: function() { Discourse.logout(); diff --git a/app/assets/javascripts/discourse/views/topic.js.es6 b/app/assets/javascripts/discourse/views/topic.js.es6 index bbd0f1e170a..0cfc4a3d76a 100644 --- a/app/assets/javascripts/discourse/views/topic.js.es6 +++ b/app/assets/javascripts/discourse/views/topic.js.es6 @@ -17,11 +17,6 @@ export default Discourse.View.extend(AddCategoryClass, Discourse.Scrolling, { postStream: Em.computed.alias('controller.postStream'), - _updateTitle: function() { - var title = this.get('topic.title'); - if (title) return Discourse.set('title', _.unescape(title)); - }.observes('topic.loaded', 'topic.title'), - _composeChanged: function() { var composerController = Discourse.get('router.composerController'); composerController.clearState(); diff --git a/app/assets/javascripts/discourse/views/user.js.es6 b/app/assets/javascripts/discourse/views/user.js.es6 index 25413955b9a..7c795652ba9 100644 --- a/app/assets/javascripts/discourse/views/user.js.es6 +++ b/app/assets/javascripts/discourse/views/user.js.es6 @@ -1,11 +1,4 @@ export default Ember.View.extend(Discourse.ScrollTop, { templateName: 'user/user', - userBinding: 'controller.content', - - updateTitle: function() { - var username = this.get('user.username'); - if (username) { - Discourse.set('title', "" + (I18n.t("user.profile")) + " - " + username); - } - }.observes('user.loaded', 'user.username') + userBinding: 'controller.content' }); From 1cda92c753e8ef9daad6c0e074ec64cf8e4213f1 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 15:07:10 -0400 Subject: [PATCH 2/8] Minor documentation change to `PageTracker` --- app/assets/javascripts/discourse/lib/page_tracker.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/page_tracker.js b/app/assets/javascripts/discourse/lib/page_tracker.js index 52da9ff6cb3..b94b5ab81ed 100644 --- a/app/assets/javascripts/discourse/lib/page_tracker.js +++ b/app/assets/javascripts/discourse/lib/page_tracker.js @@ -1,18 +1,14 @@ /** - Called whenever the "page" changes. This allows us to set up analytics + Called whenever the "page" changes. This allows us to set up analytics and other tracking. To get notified when the page changes, you can install a hook like so: ```javascript - Discourse.PageTracker.current().on('change', function(url) { - console.log('the page changed to: ' + url); + Discourse.PageTracker.current().on('change', function(url, title) { + console.log('the page changed to: ' + url + ' and title ' + title); }); ``` - - @class PageTracker - @namespace Discourse - @module Discourse **/ Discourse.PageTracker = Ember.Object.extend(Ember.Evented, { start: function() { From ae20369733c08d28e3fb67bba3f54a282973e447 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 15:45:06 -0400 Subject: [PATCH 3/8] FIX: unread was being tagged as "new" in the `PreloadStore` --- lib/topic_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index b872daf3e4d..a38bd8b67e0 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -84,7 +84,7 @@ class TopicQuery end def list_unread - create_list(:new, {}, unread_results) + create_list(:unread, {}, unread_results) end def list_posted From 285c66b899ee92c2aaa0b2c4251252691e2b639e Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 16:03:04 -0400 Subject: [PATCH 4/8] FIX: Say the file uploaded is too large, not "image" as you can upload other kinds of files. --- app/assets/javascripts/discourse/lib/utilities.js | 2 +- config/locales/client.cs.yml | 2 -- 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.fi.yml | 1 - config/locales/client.fr.yml | 1 - config/locales/client.he.yml | 1 - config/locales/client.id.yml | 1 - config/locales/client.it.yml | 1 - config/locales/client.ja.yml | 1 - config/locales/client.ko.yml | 1 - config/locales/client.nb_NO.yml | 1 - config/locales/client.nl.yml | 1 - config/locales/client.pl_PL.yml | 1 - config/locales/client.pt.yml | 1 - config/locales/client.pt_BR.yml | 1 - config/locales/client.ro.yml | 1 - config/locales/client.ru.yml | 1 - config/locales/client.sv.yml | 1 - config/locales/client.uk.yml | 1 - config/locales/client.zh_CN.yml | 1 - config/locales/client.zh_TW.yml | 1 - test/javascripts/lib/utilities-test.js.es6 | 2 +- 25 files changed, 3 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/utilities.js b/app/assets/javascripts/discourse/lib/utilities.js index 0796f300269..2bc56beafc0 100644 --- a/app/assets/javascripts/discourse/lib/utilities.js +++ b/app/assets/javascripts/discourse/lib/utilities.js @@ -292,7 +292,7 @@ Discourse.Utilities = { // entity too large, usually returned from the web server case 413: var maxSizeKB = Discourse.SiteSettings.max_image_size_kb; - bootbox.alert(I18n.t('post.errors.image_too_large', { max_size_kb: maxSizeKB })); + bootbox.alert(I18n.t('post.errors.file_too_large', { max_size_kb: maxSizeKB })); return; // the error message is provided by the server diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml index b988a6277f0..3fe37f1e039 100644 --- a/config/locales/client.cs.yml +++ b/config/locales/client.cs.yml @@ -989,8 +989,6 @@ cs: edit: "Bohužel nastala chyba při editaci příspěvku. Prosím zkuste to znovu." upload: "Bohužel nastala chyba při nahrávání příspěvku. Prosím zkuste to znovu." attachment_too_large: "Soubor, který se snažíte nahrát je bohužel příliš velký (maximální velikost je {{max_size_kb}}kb). Prosím zmenšete ho zkuste to znovu." - image_too_large: "Obrázek, který se snažíte nahrát je bohužel příliš velký (maximální velikost je {{max_size_kb}}kb). Prosím zmenšete ho zkuste to znovu." - too_many_uploads: "Bohužel, najednou smíte nahrát jen jeden soubor." upload_not_authorized: "Bohužel, soubor, který se snažíte nahrát, není povolený (povolené přípony: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Bohužel, noví uživatelé nemohou nahrávat obrázky." attachment_upload_not_allowed_for_new_user: "Bohužel, noví uživatelé nemohou nahrávat přílohy." diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml index 163030a843e..2ce7fdf035b 100644 --- a/config/locales/client.da.yml +++ b/config/locales/client.da.yml @@ -918,7 +918,6 @@ da: edit: "Beklager, der opstrod en fejl under redigeringen af dit indlæg. Prøv venligst igen." upload: "Beklager, der opstod en fejl ved upload af filen. Prøv venligst igen." attachment_too_large: "Beklager, filen, som du forsøger at uploade, er for store (den maksimale størrelse er {{max_size_kb}}kb)." - image_too_large: "Beklager, billedet, som du forsøger at uploade, er for stort (den maksimale størrelse er {{max_size_kb}}kb), gør det venligst mindre og prøv igen." too_many_uploads: "Beklager, men du kan kun uploade én fil ad gangen." upload_not_authorized: "Beklager, filen, som du forsøger at uploade, er ikke godkendt (godkendte filendelser: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Beklager, nye brugere kan ikke uploade billeder." diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml index 0fe4c73616a..c3be8b06e3c 100644 --- a/config/locales/client.de.yml +++ b/config/locales/client.de.yml @@ -941,7 +941,6 @@ de: edit: "Entschuldige, es gab einen Fehler beim Bearbeiten des Beitrags. Bitte versuche es noch einmal." upload: "Entschuldige, es gab einen Fehler beim Hochladen der Datei. Bitte versuche es noch einmal." attachment_too_large: "Entschuldige, die Datei, die du hochladen wolltest, ist zu groß (Maximalgröße {{max_size_kb}} KB)." - image_too_large: "Entschuldige, das Bild, das du hochladen wolltest, ist zu groß (Maximalgröße {{max_size_kb}} KB), bitte reduziere die Dateigröße und versuche es nochmal." too_many_uploads: "Entschuldige, du darfst immer nur eine Datei hochladen." upload_not_authorized: "Entschuldige, die Datei, die du hochladen wolltest, ist nicht erlaubt (erlaubte Endungen: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Entschuldige, neue Benutzer dürfen keine Bilder hochladen." diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 1767045243b..c2a709d8026 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1074,7 +1074,7 @@ en: edit: "Sorry, there was an error editing your post. Please try again." upload: "Sorry, there was an error uploading that file. Please try again." attachment_too_large: "Sorry, the file you are trying to upload is too big (maximum size is {{max_size_kb}}kb)." - image_too_large: "Sorry, the image you are trying to upload is too big (maximum size is {{max_size_kb}}kb), please resize it and try again." + file_too_large: "Sorry, the file you are trying to upload is too big (maximum size is {{max_size_kb}}kb)" too_many_uploads: "Sorry, you can only upload one file at a time." upload_not_authorized: "Sorry, the file you are trying to upload is not authorized (authorized extension: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Sorry, new users can not upload images." diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml index 4f5339eaa35..793e6eb3790 100644 --- a/config/locales/client.es.yml +++ b/config/locales/client.es.yml @@ -951,7 +951,6 @@ es: edit: "Lo sentimos, hubo un error al editar tu post. Por favor, inténtalo de nuevo." upload: "Lo sentimos, hubo un error al subir el archivo. Por favor, inténtalo de nuevo." attachment_too_large: "Lo siento, el archivo que estas intentando subir es demasiado grande (el tamaño máximo es {{max_size_kb}}kb)." - image_too_large: "Lo sentimos, la imagen que está intentando cargar es demasiado grande (el tamaño máximo es de {{max_size_kb}}kb), por favor, cambie el tamaño e inténtelo de nuevo." too_many_uploads: "Lo siento solo puedes subir un archivo cada vez." upload_not_authorized: "Lo sentimos, el archivo que intenta cargar no está autorizado (authorized extension: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Lo siento, usuarios nuevos no pueden subir imágenes." diff --git a/config/locales/client.fi.yml b/config/locales/client.fi.yml index 151d8dabca6..9f54f1f0d47 100644 --- a/config/locales/client.fi.yml +++ b/config/locales/client.fi.yml @@ -946,7 +946,6 @@ fi: edit: "Pahoittelut, viestin muokkaus ei onnistunut. Ole hyvä ja yritä uudelleen." upload: "Pahoittelut, tiedoston lähetys ei onnistunut. Ole hyvä ja yritä uudelleen." attachment_too_large: "Pahoittelut, tiedosto jonka latausta yritit on liian suuri ( suurin tiedostokoko on {{max_size_kb}}kb)." - image_too_large: "Pahoittelut, kuva jonka yritit ladata on liian suuri (suurin sallittu kuvakoko on {{max_size_kb}}kb), pienennä kuvaa ja yritä uudestaan." too_many_uploads: "Pahoittelut, voit ladata vain yhden tiedoston kerrallaan." upload_not_authorized: "Pahoittelut, tiedostomuoto ei ole sallittu (sallitut tiedostopäätteet: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Pahoittelut, uudet käyttjät eivät saa ladata kuvia." diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml index dfbd6152a43..ea7934de2c6 100644 --- a/config/locales/client.fr.yml +++ b/config/locales/client.fr.yml @@ -951,7 +951,6 @@ fr: edit: "Désolé, il y a eu une erreur lors de l'édition de votre message. Merci de réessayer." upload: "Désolé, il y a eu une erreur lors de l'envoi du fichier. Merci de réessayer." attachment_too_large: "Désolé, le fichier que vous êtes en train d'envoyer est trop grand (taille maximum de {{max_size_kb}} Ko)." - image_too_large: "Désolé, l'image que vous êtes en train d'envoyer est trop grande (taille maximum de {{max_size_kb}} Ko). Merci de le redimensionner et de réessayer." too_many_uploads: "Désolé, vous ne pouvez envoyer qu'un seul fichier à la fois." upload_not_authorized: "Désolé, le fichier que vous êtes en train d'envoyer n'est pas autorisé (extensions autorisées : {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Désolé, les nouveaux utilisateurs ne peuvent pas envoyer d'image." diff --git a/config/locales/client.he.yml b/config/locales/client.he.yml index 258eaccd808..01de9ebaac0 100644 --- a/config/locales/client.he.yml +++ b/config/locales/client.he.yml @@ -947,7 +947,6 @@ he: edit: "סליחה, הייתה שגיאה בעריכת ההודעה שלך. אנא נסה שנית." upload: "סליחה, הייתה שגיאה בהעלאת הקובץ שלך. אנא נסה שנית" attachment_too_large: "סליחה, אך הקובץ שאתה מנסה להעלות גדול מידי (הגודל המקסימלי הוא {{max_size_kb}}kb)." - image_too_large: "סליחה, אך התמונה שאתה מנסה להעלות גדולה מידי. (הגודל המקסימלי הוא {{max_size_kb}}kb), אנא שנה את הגודל ונסה שנית." too_many_uploads: "סליחה, אך ניתן להעלות רק קובץ אחת כל פעם." upload_not_authorized: "סליחה, אך סוג הקובץ שאתה מנסה להעלות אינו מורשה (סיומות מורשות: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "סליחה, משתמשים חדשים לא יכולים להעלות תמונות." diff --git a/config/locales/client.id.yml b/config/locales/client.id.yml index 9cad058c1e4..e47f93813e7 100644 --- a/config/locales/client.id.yml +++ b/config/locales/client.id.yml @@ -190,7 +190,6 @@ id: post: errors: attachment_too_large: "Maaf, file yang kamu unggah terlalu besar (ukuran maksimal {{max_size_kb}}kb)." - image_too_large: "Maaf, file yang kamu unggah terlalu besar (ukuran maksimal {{max_size_kb}}kb), mohon diperkecil dan coba lagi." image_upload_not_allowed_for_new_user: "Maaf, pengguna baru belum diperbolehkan mengunggah gambar." attachment_upload_not_allowed_for_new_user: "Maaf, pengguna baru belum diperbolehkan mengunggah lampiran." revisions: diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml index ac804e2ca5b..860787e16f4 100644 --- a/config/locales/client.it.yml +++ b/config/locales/client.it.yml @@ -950,7 +950,6 @@ it: edit: "Spiacenti, si è verificato un errore nel modificare il tuo messaggio. Prova di nuovo." upload: "Spiacenti, si è verificato un errore durante il caricamento del file. Prova di nuovo." attachment_too_large: "Spiacenti, il file che stai tentando di caricare è troppo grande (il massimo consentito è {{max_size_kb}}kb)." - image_too_large: "Spiacenti, l'immagine che stai cercando di caricare è troppo grande (la dimensione massima è {{max_size_kb}}kb). Ridimensionala e riprova." too_many_uploads: "Spiacenti, puoi caricare un solo file per volta." upload_not_authorized: "Spiacenti, il file che stai cercando di caricare non è autorizzato (estensioni autorizzate: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Spiacenti, i nuovi utenti non possono caricare immagini." diff --git a/config/locales/client.ja.yml b/config/locales/client.ja.yml index 9b2db45f270..21d9a62023b 100644 --- a/config/locales/client.ja.yml +++ b/config/locales/client.ja.yml @@ -885,7 +885,6 @@ ja: edit: "申し訳ありませんが、ポスト編集中にエラーが発生しました。もう一度やり直してください。" upload: "申し訳ありませんが、ファイルアップロード中にエラーが発生しました。もう一度やり直してください。" attachment_too_large: "申し訳ありませんが、アップロード対象ファイルが大きすぎます (最大サイズは {{max_size_kb}}kb)。" - image_too_large: "申し訳ありませんが、アップロード対象ファイルが大きすぎます (最大サイズは {{max_size_kb}}kb)。" too_many_uploads: "申し訳ありませんが、複数のファイルは同時にアップロードできません。" upload_not_authorized: "申し訳ありませんが、対象ファイルをアップロードする権限がありません (利用可能な拡張子: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "申し訳ありませんが、新規ユーザは画像のアップロードができません。" diff --git a/config/locales/client.ko.yml b/config/locales/client.ko.yml index c80b2e0d05a..58615830e7a 100644 --- a/config/locales/client.ko.yml +++ b/config/locales/client.ko.yml @@ -905,7 +905,6 @@ ko: edit: "죄송합니다. 게시물을 수정하는 중에 오류가 발생했습니다. 다시 시도하십시오." upload: "죄송합니다. 파일을 업로드하는 동안 오류가 발생했습니다. 다시 시도하십시오." attachment_too_large: "업로드하려는 파일의 크기가 너무 큽니다. 최대 크기는 {{max_size_kb}}kb 입니다." - image_too_large: "업로드하려는 이미지의 크기가 너무 큽니다. 최대 크기는 {{max_size_kb}}kb 입니다. 사이즈를 조정하고 다시 시도해보세요." too_many_uploads: "한번에 한 파일만 업로드 하실 수 있습니다." upload_not_authorized: "업로드 하시려는 파일 확장자는 사용이 불가능합니다 (사용가능 확장자: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "죄송합니다. 새로운 유저는 이미지를 업로드 하실 수 없습니다." diff --git a/config/locales/client.nb_NO.yml b/config/locales/client.nb_NO.yml index 17da11aa8e6..cdeffc6b63b 100644 --- a/config/locales/client.nb_NO.yml +++ b/config/locales/client.nb_NO.yml @@ -947,7 +947,6 @@ nb_NO: edit: "Beklager, det oppstod en feil ved redigeringen av ditt innlegg. Vennligst prøv igjen." upload: "Sorry, there was an error uploading that file. Please try again." attachment_too_large: "Beklager, filen du prøver å laste opp er for stor (maksimal størrelsen er {{max_size_kb}}kb)." - image_too_large: "Beklager, filen du prøve å laste opp er for stor (maks størrelse er {{max_size_kb}}kb), vennligst reduser størrelsen og prøv igjen." too_many_uploads: "Beklager, du kan bare laste opp ett bilde om gangen." upload_not_authorized: "Beklager, filen du prøver å laste opp er ikke godkjent (godkjente filtyper: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Beklager, nye brukere kan ikke laste opp bilder" diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml index 6f0ec67c699..230bb58f0ca 100644 --- a/config/locales/client.nl.yml +++ b/config/locales/client.nl.yml @@ -935,7 +935,6 @@ nl: edit: "Sorry, er is iets misgegaan bij het bewerken van je bericht. Probeer het nog eens." upload: "Sorry, er is iets misgegaan bij het uploaden van je bestand. Probeer het nog eens." attachment_too_large: "Sorry, het bestand dat je wil uploaden is te groot (maximum grootte is {{max_size_kb}}kb)." - image_too_large: "Sorry, de afbeelding je wil uploaden is te groot (maximum grootte is {{max_size_kb}}kb), verklein de afbeelding en probeer het opnieuw." too_many_uploads: "Sorry, je kan maar één afbeelding tegelijk uploaden." upload_not_authorized: "Sorry, je mag dat type bestand niet uploaden (toegestane extensies: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Sorry, nieuwe gebruikers mogen nog geen afbeeldingen uploaden." diff --git a/config/locales/client.pl_PL.yml b/config/locales/client.pl_PL.yml index 52f061deb07..5266a496d33 100644 --- a/config/locales/client.pl_PL.yml +++ b/config/locales/client.pl_PL.yml @@ -995,7 +995,6 @@ pl_PL: edit: "Przepraszamy, podczas edytowania twojego wpisu wystąpił błąd. Spróbuj ponownie." upload: "Przepraszamy, wystąpił błąd podczas wczytywania Twojego pliku. Proszę, spróbuj ponownie." attachment_too_large: "Przepraszamy, ale plik, który chcesz wgrać jest za duży (maksymalny rozmiar to {{max_size_kb}}KB)." - image_too_large: "Przepraszamy, ale obraz, który chcesz wgrać jest za duży (maksymalny rozmiar to {{max_size_kb}}KB), proszę zmień jego rozmiar i spróbuj ponownie." too_many_uploads: "Przepraszamy, ale możesz wgrać tylko jeden plik naraz." upload_not_authorized: "Przepraszamy, ale plik który chcesz wgrać jest niedozwolony (dozwolone rozszerzenia: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Przepraszamy, ale nowi użytkownicy nie mogą wgrywać obrazów." diff --git a/config/locales/client.pt.yml b/config/locales/client.pt.yml index 43fcb69240d..f58d20613a4 100644 --- a/config/locales/client.pt.yml +++ b/config/locales/client.pt.yml @@ -934,7 +934,6 @@ pt: edit: "Desculpe, houve um erro ao editar a sua mensagem. Por favor, tente outra vez." upload: "Desculpe, houve um erro ao enviar esse ficheiro. Por favor, tente outra vez." attachment_too_large: "Desculpe, o ficheiro que está a enviar é muito grande (o tamanho máximo permitido é {{max_size_kb}}kb)." - image_too_large: "Desculpe, o ficheiro que está a enviar é muito grande (o tamanho máximo é {{max_size_kb}}kb), por favor diminua-o e tente novamente." too_many_uploads: "Desculpe, apenas pode enviar um ficheiro de cada vez." upload_not_authorized: "Desculpe, o tipo de ficheiro que está a enviar não está autorizado (extensões autorizadas: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Desculpe, novos utilizadores não podem enviar imagens." diff --git a/config/locales/client.pt_BR.yml b/config/locales/client.pt_BR.yml index 1a674de6e3d..4f91623174e 100644 --- a/config/locales/client.pt_BR.yml +++ b/config/locales/client.pt_BR.yml @@ -951,7 +951,6 @@ pt_BR: edit: "Desculpe, houve um erro ao editar sua resposta. Por favor, tente outra vez." upload: "Desculpe, houve um erro ao enviar esse arquivo. Por favor, tente outra vez." attachment_too_large: "Desculpe, o arquivo que você está tentando enviar é muito grande (o tamanho máximo permitido é {{max_size_kb}}kb)." - image_too_large: "Desculpe, o arquivo que você está tentando enviar é muito grande (o tamanho máximo é {{max_size_kb}}kb), por favor diminua-o e tente novamente." too_many_uploads: "Desculpe, você pode enviar apenas um arquivos por vez." upload_not_authorized: "Desculpe, o tipo de arquivo que você está tentando enviar não está autorizado (extensões autorizadas: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Desculpe, novos usuário não podem enviar imagens." diff --git a/config/locales/client.ro.yml b/config/locales/client.ro.yml index 9fdbf86e5a7..87a10e49ddd 100644 --- a/config/locales/client.ro.yml +++ b/config/locales/client.ro.yml @@ -1029,7 +1029,6 @@ ro: edit: "Ne pare rău , s-a semnalat o eroare în editarea postării dumneavoastră . Vă rugăm încercati iar." upload: "Ne pare rău ,s-a semnalat o eroare în încarcarea acelui fişier. Vă rugăm încercati iar." attachment_too_large: "Ne pare rău, fişierul pe care-l încarcaţi este prea mare (marimea maximă este de {{max_size_kb}}kb)." - image_too_large: "Ne pare rău, imaginea pe care o încarcaţi este prea mare (marimea maximă este de {{max_size_kb}}kb), redimensionaţi şi încercaţi iar." too_many_uploads: "Ne pare rău, puteţi încarca doar cate un fişier." upload_not_authorized: "Ne pare rău, fişierul pe care-l încarcaţi nu este autorizat (extensia pentru autorizare: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Ne pare rău, noul utilizator nu poate încarca imagini." diff --git a/config/locales/client.ru.yml b/config/locales/client.ru.yml index acfbbc2d6be..a510883b6ff 100644 --- a/config/locales/client.ru.yml +++ b/config/locales/client.ru.yml @@ -994,7 +994,6 @@ ru: edit: "К сожалению, не удалось изменить сообщение. Попробуйте еще раз." upload: "К сожалению, не удалось загрузить файл. Попробуйте еще раз." attachment_too_large: "Файл, который вы пытаетесь загрузить, слишком большой (максимальный разрешенный размер {{max_size_kb}}КБ)." - image_too_large: "Изображение, которое вы пытаетесь загрузить, слишком большое (максимальный разрешенный размер {{max_size_kb}}КБ), пожалуйста, уменьшите размер изображения и повторите попытку." too_many_uploads: "К сожалению, за один раз можно загрузить только одно изображение." upload_not_authorized: "К сожалению, вы не можете загрузить файл данного типа (список разрешенных типов файлов: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "К сожалению, загрузка изображений недоступна новым пользователям." diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml index f8190df585d..e2939371f7d 100644 --- a/config/locales/client.sv.yml +++ b/config/locales/client.sv.yml @@ -897,7 +897,6 @@ sv: edit: "Tyvärr, det uppstod ett fel under ändringen av ditt inlägg. Var god försök igen." upload: "Tyvärr, det uppstod ett fel under uppladdandet av den filen. Vad god försök igen." attachment_too_large: "Tyvärr, filen du försöker ladda upp är för stor (maximal storlek är {{max_size_kb}} kb)." - image_too_large: "Tyvärr, filen som du försöker ladda upp är för stor (maxstorlek är {{max_size_kb}}kb), var god ändra storlek och försök igen." too_many_uploads: "Tyvärr, du kan bara ladda upp en bild i taget." upload_not_authorized: "Tyvärr, filen du försökte ladda upp är inte tillåten (tillåtna filtyper: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Tyvärr, nya användare kan inte ladda upp bilder." diff --git a/config/locales/client.uk.yml b/config/locales/client.uk.yml index 3e4448a94ed..43d186f1a57 100644 --- a/config/locales/client.uk.yml +++ b/config/locales/client.uk.yml @@ -717,7 +717,6 @@ uk: edit: "Даруйте, під час редагування допису трапилася помилка. Будь ласка, спробуйте ще раз." upload: "Даруйте, під час завантаження цього файлу трапилася помилка. Будь ласка, спробуйте ще раз." attachment_too_large: "Даруйте, але файл, який Ви намагаєтеся завантажити, надто великий (максимальний розмір складає {{max_size_kb}} кБ)." - image_too_large: "Даруйте, але зображення, яке Ви намагаєтеся завантажити, є надто великим (максимальний розмір складає {{max_size_kb}} кБ). Будь ласка, зменшіть його та спробуйте ще раз." too_many_uploads: "Даруйте, але Ви можете одночасно завантажувати тільки один файл." upload_not_authorized: "Даруйте, але файл, який Ви намагаєтеся завантажити, є недозволеним (дозволені розширення: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "Даруйте, нові користувачі не можуть завантажувати зображення." diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml index db0c0d5e484..98cce98c81e 100644 --- a/config/locales/client.zh_CN.yml +++ b/config/locales/client.zh_CN.yml @@ -905,7 +905,6 @@ zh_CN: edit: "抱歉,在编辑您的帖子时发生了错误。请重试。" upload: "抱歉,在上传文件时发生了错误。请重试。" attachment_too_large: "抱歉,您上传的附件太大了(最大不能超过 {{max_size_kb}}kb)。" - image_too_large: "抱歉,您上传的图片太大了(最大不能超过 {{max_size_kb}}kb),请调整文件大小后重新上传。" too_many_uploads: "抱歉, 您只能一次上传一张图片。" upload_not_authorized: "抱歉, 您不能上传此类型文件(可上传的文件类型有: {{authorized_extensions}})。" image_upload_not_allowed_for_new_user: "抱歉,新注册用户无法上传图片。" diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml index 2e382de11f0..762e299e247 100644 --- a/config/locales/client.zh_TW.yml +++ b/config/locales/client.zh_TW.yml @@ -901,7 +901,6 @@ zh_TW: edit: "抱歉,編輯你的文章時發生錯誤,請再試一次。" upload: "抱歉,上傳你的檔案時發生錯誤,請再試一次。" attachment_too_large: "抱歉,你想上傳的檔案太大 (最大限制為 {{max_size_kb}} kb)。" - image_too_large: "抱歉,你想上傳的圖片太大 (最大限制為 {{max_size_kb}} kb),請將圖片縮小後再試一次。" too_many_uploads: "抱歉,一次只能上傳一個檔案。" upload_not_authorized: "抱歉,你想上傳的是不允許的檔案 (允許的副檔名: {{authorized_extensions}})." image_upload_not_allowed_for_new_user: "抱歉,新用戶不可上傳圖片。" diff --git a/test/javascripts/lib/utilities-test.js.es6 b/test/javascripts/lib/utilities-test.js.es6 index 46d667940bc..0052767c4b3 100644 --- a/test/javascripts/lib/utilities-test.js.es6 +++ b/test/javascripts/lib/utilities-test.js.es6 @@ -57,7 +57,7 @@ test("prevents files that are too big from being uploaded", function() { sandbox.stub(bootbox, "alert"); not(validUpload([image])); - ok(bootbox.alert.calledWith(I18n.t('post.errors.image_too_large', { max_size_kb: 5 }))); + ok(bootbox.alert.calledWith(I18n.t('post.errors.file_too_large', { max_size_kb: 5 }))); }); var dummyBlob = function() { From 80183f04f5f42568322afedc242ad52000ae04ff Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 16:12:02 -0400 Subject: [PATCH 5/8] FIX: CSS on admin referrals broke with the fixed table. See: https://meta.discourse.org/t/admin-dashboard-top-referred-topics-links-overlap-with-clicks/20945 --- app/assets/stylesheets/common/admin/admin_base.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index 12d88b21a31..55a0fc524f7 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -5,7 +5,6 @@ .admin-contents table { width: 100%; - table-layout: fixed; tr {text-align: left;} td, th {padding: 8px;} th {border-top: 1px solid scale-color-diff();} @@ -539,6 +538,7 @@ section.details { .admin-flags { + table-layout: fixed; .hidden-post td.excerpt, .hidden-post td.user { opacity: 0.5; } .deleted td.excerpt, .deleted td.user { background-color: scale-color($danger, $lightness: 70%); } From 3b38667274fe96977e8852d1415eb58537d1d7cd Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 16:35:27 -0400 Subject: [PATCH 6/8] FIX: Check for word boundaries with censored words. --- app/assets/javascripts/discourse/dialects/censored_dialect.js | 4 ++-- test/javascripts/lib/markdown-test.js.es6 | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/dialects/censored_dialect.js b/app/assets/javascripts/discourse/dialects/censored_dialect.js index 947f70f796d..079b84ec9c4 100644 --- a/app/assets/javascripts/discourse/dialects/censored_dialect.js +++ b/app/assets/javascripts/discourse/dialects/censored_dialect.js @@ -6,7 +6,7 @@ Discourse.Dialect.addPreProcessor(function(text) { if (!censorRegexp) { var split = censored.split("|"); if (split && split.length) { - censorRegexp = new RegExp(split.map(function (t) { return "(" + t.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + ")"; }).join("|"), "ig"); + censorRegexp = new RegExp("\\b" + split.map(function (t) { return "(" + t.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + ")"; }).join("|") + "\\b", "ig"); } } @@ -14,7 +14,7 @@ Discourse.Dialect.addPreProcessor(function(text) { var m = censorRegexp.exec(text); while (m && m[0]) { var replacement = new Array(m[0].length+1).join('■'); - text = text.replace(m[0], replacement); + text = text.replace(new RegExp("\\b" + m[0] + "\\b", "ig"), replacement); m = censorRegexp.exec(text); } diff --git a/test/javascripts/lib/markdown-test.js.es6 b/test/javascripts/lib/markdown-test.js.es6 index 2420f51d182..08eb2f87d49 100644 --- a/test/javascripts/lib/markdown-test.js.es6 +++ b/test/javascripts/lib/markdown-test.js.es6 @@ -485,4 +485,7 @@ test("censoring", function() { cooked("aw shucks, golly gee whiz.", "

aw ■■■■■■, golly gee ■■■■.

", "it censors words in the Site Settings"); + cooked("you are a whizzard! I love cheesewhiz. Whiz.", + "

you are a whizzard! I love cheesewhiz. ■■■■.

", + "it doesn't censor words unless they have boundaries."); }); From c1b8943a6f66944e74de9d426bc482a209b4f3f2 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 16:48:15 -0400 Subject: [PATCH 7/8] FIX: Category badges in the header should use the primary header color --- app/assets/stylesheets/desktop/topic-post.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scss index 195993e4650..359a710c351 100644 --- a/app/assets/stylesheets/desktop/topic-post.scss +++ b/app/assets/stylesheets/desktop/topic-post.scss @@ -583,7 +583,7 @@ iframe { padding: 0; .badge-category { - color: $primary; + color: $header_primary; padding: 0 0 0 3px; margin-right: 5px; } From d3b268cd2cf0ef7fd9891da20d7d7d19c1ae8a8d Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 9 Oct 2014 19:42:50 -0400 Subject: [PATCH 8/8] FIX: Broken build --- app/assets/javascripts/discourse/lib/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/utilities.js b/app/assets/javascripts/discourse/lib/utilities.js index 2bc56beafc0..2de94c45e21 100644 --- a/app/assets/javascripts/discourse/lib/utilities.js +++ b/app/assets/javascripts/discourse/lib/utilities.js @@ -200,7 +200,7 @@ Discourse.Utilities = { var fileSizeKB = file.size / 1024; var maxSizeKB = Discourse.SiteSettings['max_' + type + '_size_kb']; if (fileSizeKB > maxSizeKB) { - bootbox.alert(I18n.t('post.errors.' + type + '_too_large', { max_size_kb: maxSizeKB })); + bootbox.alert(I18n.t('post.errors.file_too_large', { max_size_kb: maxSizeKB })); return false; }