Commit Graph

119 Commits

Author SHA1 Message Date
Gerhard Schlager
e2770bc1c4 FIX: async reload of locales could result in missing translations 2018-10-01 17:14:36 +02:00
Kyle Zhao
f1cb431968 FIX: rescue ActiveRecord::RecordInvalid in find_or_create_by_safe! (#6385)
AR uniqueness validation could raise ActiveRecord::RecordInvalid
2018-09-12 11:03:12 +10:00
Guo Xiang Tan
8dc1463ab3 Enable Lint/ShadowingOuterLocalVariable for Rubocop. 2018-09-04 10:16:42 +08:00
Maja Komel
182d9a4666 FIX: escape regex chars when searching site texts 2018-09-02 17:25:57 +10:00
Sam
6ee352510a Correctly handle exception 2018-08-23 16:27:00 +10:00
Sam
57d04200a1 Add Rails 6 note here 2018-08-21 11:09:10 +10:00
Sam
ca5a6f0a9d FIX: handle concurrently creating post reply keys
In some very rare conditions this would be called concurrently and fail
2018-08-21 10:59:18 +10:00
Sam
b6e9c734f2 replace error with message
So Discourse continues to work on Ruby trunk
2018-07-04 09:42:38 +10:00
Sam
2f0e73f2d6 DEV: fast pluck to use type_map in mini_sql 2018-06-20 17:53:49 +10:00
Sam
44091f20c6 DEV: allow for method deprecation using Discourse.deprecate
New method deprecator will ensure one log message an hour happens
for all deprecated method calls per call site

Also removes unused monkey patches to ActiveRecord::Base
2018-06-20 17:53:49 +10:00
Guo Xiang Tan
6e97242bb9 Monkey patch in 7830a950ef 2018-06-19 09:45:48 +08:00
Sam
87fabdc2f3 FIX: correct pool reaper
This removes a freedom patch and replaces with a custom reaper thread
it also captures an issue where reaper would fail when connections where
empty
2018-06-14 18:22:02 +10:00
Sam
71aa20bd30 FIX: pool drainer to use Rails 5.2 implementation
old implementation did not reap abandoned connections
2018-06-14 15:54:48 +10:00
Sam
66982c7800 FIX: stop using Rails connection reaper in multisite
The Rails 5.2 connection reaper appears to be leaking threads
this is a quick fix to stop it, though we need to make sure we
never leak connection pools as well.
2018-06-14 12:49:30 +10:00
Guo Xiang Tan
139d0813b4 Re-enable fast_pluck freedom patch. 2018-06-13 09:25:23 +08:00
Guo Xiang Tan
29c1f01494 Fix broken pool drainer after the upgrade.
See 6cd5cc375a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb (L467)

We think there is a leak at the moment because a discarded pool
belonging to the parent process shouldn't be present in the
forked process.
2018-06-08 13:19:07 +08:00
Sam
42847252a4 remove conditional code 2018-06-08 13:38:25 +10:00
Sam
1834417e2f downgrade rails properly 2018-06-07 20:38:22 +10:00
Guo Xiang Tan
ad5082d969 Make rubocop happy again. 2018-06-07 13:28:18 +08:00
Sam
89ad2b5900 DEV: Rails 5.2 upgrade and global gem upgrade
This updates tests to use latest rails 5 practice
and updates ALL dependencies that could be updated

Performance testing shows that performance has not regressed
if anything it is marginally faster now.
2018-06-07 14:21:33 +10:00
Sam
b7037808bb PERF: stop using exec which is blocking for direct sql 2018-05-03 15:50:30 +10:00
Sam
6a3c8fe69c FEATURE: protect against accidental column or table drops
Often we need to amend our schema, it is tempting to use
drop_table, rename_column and drop_column to amned schema
trouble though is that existing code that is running in production
can depend on the existance of previous schema leading to application
breaking until new code base is deployed.

The commit enforces new rules to ensure we can never drop tables or
columns in migrations and instead use Migration::ColumnDropper and
Migration::TableDropper to defer drop the db objects
2018-03-21 15:43:32 +11:00
Gerhard Schlager
eb52c5469e FEATURE: Allow plugins to register a new locale 2018-01-25 14:57:41 +01:00
Sam
081959227d FIX: unicode titles missing when visiting topic from topic list 2017-12-21 15:20:47 +11:00
Guo Xiang Tan
c390169b71 Move monkey patch into freedom_patchers. 2017-11-21 14:15:11 +08:00
Guo Xiang Tan
9d6449ae92 Revert "Guard ActionRecord::Base.exec_sql against a readonly PostgreSQL cluster."
This reverts commit c2a5e603c2.
2017-10-19 15:39:03 +08:00
Guo Xiang Tan
c2a5e603c2 Guard ActionRecord::Base.exec_sql against a readonly PostgreSQL cluster. 2017-10-19 14:47:29 +08:00
Sam
f6fdc1ebe8 FEATURE: flexible crawler detection
You can use the crawler user agents site setting to amend what user agents
are considered crawlers based on a string match in the user agent

Also improves performance of crawler detection slightly
2017-09-29 12:31:50 +10:00
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Guo Xiang Tan
a4399c2eab FIX: Translation overrides were not cached by locale properly. 2017-07-07 12:28:00 +09:00
Robin Ward
754c1e5438 Upgrade to Babel 6 2017-07-05 15:25:23 -04:00
Guo Xiang Tan
52e654b3ac FIX: Translation fallback was not using fallback's translation override.
https://meta.discourse.org/t/discobot-falling-back-to-site-locale-is-not-using-customized-copies/65140
2017-07-03 14:52:27 +09:00
Sam
a3e8c3cd7b FEATURE: Native theme support
This feature introduces the concept of themes. Themes are an evolution
of site customizations.

Themes introduce two very big conceptual changes:

- A theme may include other "child themes", children can include grand
children and so on.

- A theme may specify a color scheme

The change does away with the idea of "enabled" color schemes.

It also adds a bunch of big niceties like

- You can source a theme from a git repo

- History for themes is much improved

- You can only have a single enabled theme. Themes can be selected by
    users, if you opt for it.

On a technical level this change comes with a whole bunch of goodies

- All CSS is now compiled using a custom pipeline that uses libsass
    see /lib/stylesheet

- There is a single pipeline for css compilation (in the past we used
    one for customizations and another one for the rest of the app

- The stylesheet pipeline is now divorced of sprockets, there is no
   reliance on sprockets for CSS bundling

- CSS is generated with source maps everywhere (including themes) this
    makes debugging much easier

- Our "live reloader" is smarter and avoid a flash of unstyled content
   we run a file watcher in "puma" in dev so you no longer need to run
   rake autospec to watch for CSS changes
2017-04-12 10:53:49 -04:00
Régis Hanol
a2c04be718 FIX: eradicate I18n fallback issues 💣
FIX: client's translation overrides were not working when the current locale was missing a key
FIX: ExtraLocalesController.show was not properly handling multiple translations
FIX: JsLocaleHelper#output_locale was not properly handling multiple translations

FIX: ExtraLocalesController.show's spec which was randomly failing
FIX: JsLocaleHelper#output_locale was muting cached translations hashes

REFACTOR: move 'enableVerboseLocalization' to the 'localization' initializer
REFACTOR: remove unused I18n.js methods (getFallbacks, localize, parseDate, toTime, strftime, toCurrency, toPercentage)
REFACTOR: remove all I18n.pluralizationRules and instead use MessageFormat's pluralization rules

TEST: add tests for localization initializer
TEST: add tests for I18n.js
2017-02-24 11:31:21 +01:00
Sam
d28d8a1f85 FIX: order by op_likes leads to broken browsing 2016-12-27 19:08:54 +11:00
Robin Ward
b601120b39 Support for Raw Handlebars and helpers in Ember 1.13 2016-10-26 10:27:57 -04:00
Robin Ward
be1d74d207 Split out common functions into discourse-common module 2016-09-22 09:52:19 -04:00
Régis Hanol
038eb6f645 FIX: translations with a symbol as key should also be overridable 2016-08-24 11:53:03 +02:00
Robin Ward
bba0fd0654 REFACTOR: PreloadStore to ES6 2016-07-11 12:57:05 -04:00
Robin Ward
7ff5b228cd REFACTOR: Raw Handlebars ported to ES6 2016-07-11 12:57:05 -04:00
Sam
d9bcf85edc PERF: make development tolerable under sprockets 3 2016-05-13 18:30:03 +10:00
Guo Xiang Tan
21df320f71
FIX: Duplicated file. 2016-04-18 11:18:37 +08:00
Guo Xiang Tan
256d7a00e9 Update sprockets. (#4167)
* Update sass-rails.

* FIX: Tilt dependency has been removed from Ember::Handlebars::Template.

* Update `DiscourseIIFE` to new Sprockets API.

* `Rails.application.assets` returns `nil` in production.

* Move sprockets-rails out of the assets group.

* Pin ember-rails to 0.18.5 which works with Sprockets 3.x.

* Update sprockets to 3.6.0.

* Make `DiscourseSassCompiler` work with Sprockets 3.

* Use `Sass::Rails::SassImporterGlobbing` instead of haxxing our own.

* Moneky patch so that we don't add dependencies for our custom css.

* FIX: Missing class.

* Upgrade ember-handlebars-template.

* FIX: require path needs to share the same root as the folder's path.

* Bump discourse-qunit-rails.

* Update ember-template-compiler.js to 1.12.2.

* `prepend` is private in Ruby 2.0.0.
2016-04-18 10:47:52 +08:00
Robin Ward
cc25716e47 FIX: Allow message format translations to be overridden 2016-04-08 14:49:50 -04:00
Guo Xiang Tan
90fde5053d FIX: Load Redis patch much earlier. 2016-03-11 17:29:00 +08:00
Guo Xiang Tan
ced86aa890 FIX: N+1 query on topics view page. 2016-02-23 16:22:40 +08:00
Gerhard Schlager
8481548def FIX: Load fallback locales after reloading translations 2016-02-22 22:48:56 +01:00
Gerhard Schlager
80c9fa4dca FIX: Load translation overrides for more than one locale 2016-02-22 22:48:56 +01:00
Sam
bbbb09a6fb FEATURE: start tracking information about migrations that run
This commit adds a new tracking table that lets us know

- When a migration ran
- What version Discourse was at
- How long it took
- What version Rails was at

The built in tracking in Rails is very limited, does not track this info
2016-02-17 18:08:25 +11:00