Commit Graph

37809 Commits

Author SHA1 Message Date
Gerhard Schlager f683c5d0e0 DEV: Check English locale for errors in CI
Moves the most important checks into a linter. It gets executed by Lefthook as well as the docker rake task and Github actions. Doing those checks in rspec takes too long and it produces errors when the discourse:test Docker image contains old, invalid locale files.
2020-06-03 21:54:58 +02:00
Mark VanLandingham c200238bdc
DEV: Reorder appending extra header icons (#9973) 2020-06-03 14:28:02 -05:00
Vinoth Kannan 3e7f7fdde8
FEATURE: category setting for default list filter. (#9975) 2020-06-04 00:56:56 +05:30
Robin Ward 22789e0201 New `bootstrap.json` endpoint for starting up Discourse
Discourse needs a bunch of data preloaded before it can start up.
Normally we throw blobs of this into the HTML document that is requested
but in some cases that's awkward to retrieve.

For example with Ember CLI you have a separate javascript application
that needs to make its own HTML.

This API endpoint returns a JSON object with all the data Discourse needs to
bootstrap and start up.
2020-06-03 14:45:23 -04:00
Robin Ward ba00cc8ec4
DEV: Move `Discourse.getURL` and related functions to a module (#9966)
* DEV: Move `Discourse.getURL` and related functions to a module

* DEV: Remove `Discourse.getURL` and `Discourse.getURLWithCDN`

* FIX: `get-url` is required for server side code

* DEV: Deprecate `BaseUri` too.
2020-06-03 12:45:26 -04:00
Joffrey JAFFEUX d27b877a40
FIX: prevents false boolean param to be filtered as non existant (#9968)
* FIX: prevents false boolean param to be filtered as non existant

This was preventing to filter top category route to be filtered by replies.

* if order is different ascending should be true on first click

* test

* fix

* just pass params

* more fixxes
2020-06-03 10:19:53 -06:00
Vinoth Kannan 7fe414d35d FIX: hide rss feed & json if a user profile is hidden. 2020-06-03 19:03:02 +05:30
dependabot-preview[bot] fc0f112f16
Bump connection_pool from 2.2.2 to 2.2.3 (#9967)
Bumps [connection_pool](https://github.com/mperham/connection_pool) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/mperham/connection_pool/releases)
- [Changelog](https://github.com/mperham/connection_pool/blob/master/Changes.md)
- [Commits](https://github.com/mperham/connection_pool/compare/v2.2.2...v2.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-03 09:29:30 -04:00
Guo Xiang Tan 76ce814a62
DEV: Use `safe_each_connection` patch when preloading Rails.
This is to ensure we still boot even if there is a problem with any of
the databases.
2020-06-03 15:36:50 +08:00
Guo Xiang Tan a4a33fccb0
DEV: Update rails_failover. 2020-06-03 14:31:11 +08:00
Sam Saffron cbaad631a4
PERF: add FORCE_BOOTSNAP env var
Bootsnap is designed to work in production per:
https://github.com/Shopify/bootsnap

Over the years we have seen very few issues with it, none of which
were corruption.

This allows us to enable bootsnap in production

Having bootsnap enabled means that we can speed up deploys by
about 5 seconds per server. It also means a lot less waiting for
various production rake tasks and so on.
2020-06-03 15:18:47 +10:00
Guo Xiang Tan 04a291ceea
DEV: Fix race conditions due to directory removal for uploads spec. 2020-06-03 12:28:39 +08:00
Guo Xiang Tan 141fba8866
UX: Ensure that `select-kit` is hidden consistently. 2020-06-03 11:51:01 +08:00
Sam Saffron 57a3d4e0d2
FEATURE: whitelist theme repo mode (experimental)
In some restricted setups all JS payloads need tight control.

This setting bans admins from making changes to JS on the site and
requires all themes be whitelisted to be used.

There are edge cases we still need to work through in this mode
hence this is still not supported in production and experimental.

Use an example like this to enable:

`DISCOURSE_WHITELISTED_THEME_REPOS="https://repo.com/repo.git,https://repo.com/repo2.git"`

By default this feature is not enabled and no changes are made.

One exception is that default theme id was missing a security check
this was added for correctness.
2020-06-03 13:19:57 +10:00
Guo Xiang Tan 062db10c52
FIX: `EmailValidator` needs to validate format of email. 2020-06-03 10:34:37 +08:00
Kris 1b5a505930 Small fixes to image uploaders 2020-06-02 20:36:01 -04:00
Sam Saffron 10e321a96f
Revert "DEV: makes autocomplete debounced (#9941)"
This reverts commit f9e715672b.

Sadly this debounce fix appears to break @mention autocomplete,
reverting for now.
2020-06-03 08:40:21 +10:00
Kris 688d9428fe Use an em-based width for better scaling with font-size changes 2020-06-02 17:14:04 -04:00
Kris 9e9ff01e86 Add missing text back in 2020-06-02 16:39:18 -04:00
Gerhard Schlager 9c42c0fe9a FIX: Broken MessageFormat string 2020-06-02 21:42:39 +02:00
Gerhard Schlager fc640f31df DEV: Skip interpolation key specs until build scripts can be fixed
Currently the build fails because it runs the specs for all plugins even though the current source of those plugins isn't pulled from git.
2020-06-02 19:51:47 +02:00
Gerhard Schlager 0cf297725f DEV: Use consistent interpolation key format in translations
From now on client strings can easily be reused on the server and you don’t have to think about choosing the right format anymore.
2020-06-02 19:05:10 +02:00
Mark VanLandingham b3c8d36412
DEV: Plugin api for adding extra header icons (#9964) 2020-06-02 11:39:12 -05:00
Robin Ward 4e3a84c687 FIX: If creating a flag for a watched word, include the reason 2020-06-02 11:49:02 -04:00
Jarek Radosz 3e8d548d35
FIX: Prevent clipping user mentions (#9962) 2020-06-02 16:30:34 +02:00
Guo Xiang Tan 439db7ca1e
DEV: Add `REDIS_RAILS_FAILOVER` env to test our new redis failover. 2020-06-02 17:24:14 +08:00
Guo Xiang Tan deb84017f2
Update `rails_failover`. 2020-06-02 17:01:45 +08:00
Guo Xiang Tan 4120ef7305
Bump rails_multisite to 2.2.2. 2020-06-02 16:49:33 +08:00
David Taylor 75b1298e99
DEV: Drop unused image_url column from posts and topics (#9953)
This has been superseded by image_upload_id. The image_url value in API responses is now generated dynamically from the upload record.
2020-06-02 16:21:38 +10:00
Bianca Nenciu d76ea9fa6b
FIX: Do not destroy $.fileupload element (#9888)
conditional-loading-section component rerendered the <input> element
and lost the necessary event handlers for jQuery-File-Upload.
2020-06-02 16:14:41 +10:00
Dan Ungureanu ef3e3077d0
FIX: Staff users can bypass tag validation rule (#9924) 2020-06-02 16:11:25 +10:00
Joffrey JAFFEUX f9e715672b
DEV: makes autocomplete debounced (#9941)
* DEV: makes autocomplete debounced

* better wording
2020-06-02 15:20:14 +10:00
Aman Gupta Karmani 6358e79f0f
FIX: catch NoMethodError during precompile_css too (#9940)
Ran into this on heroku:

    NoMethodError: undefined method `enabled?' for #<Theme:0x0000558f069e7718>
    vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_methods.rb:431:in `method_missing'
    app/models/theme.rb:155:in `block (2 levels) in transform_ids'
    vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/delegation.rb:85:in `each'
    vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/delegation.rb:85:in `each'
    vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/query_methods.rb:260:in `select'
    vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/query_methods.rb:260:in `select'
    app/models/theme.rb:155:in `block in transform_ids'
    app/models/theme.rb:105:in `get_set_cache'
    app/models/theme.rb:140:in `transform_ids'
    app/models/theme.rb:321:in `list_baked_fields'
    app/models/theme.rb:317:in `resolve_baked_field'
    lib/stylesheet/manager.rb:289:in `theme_digest'
2020-06-02 15:18:03 +10:00
dependabot-preview[bot] 111e8dec10
DEV: Bump rubocop from 0.84.0 to 0.85.0 (#9960)
Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.84.0 to 0.85.0.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.84.0...v0.85.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

Change looks safe, everything is still passing lint
2020-06-02 15:11:33 +10:00
Guo Xiang Tan 426b62a04a
DEV: Add silencer for verbose query logs in development. 2020-06-02 12:15:31 +08:00
Guo Xiang Tan 3dd1778199
PERF: Reduce number of queries from 3 -> 1 when fetching web manifest. 2020-06-02 12:04:02 +08:00
Guo Xiang Tan e4cd4f7e0b
DEV: Avoid reaching for `Redis#_client` which is considered deprecated. 2020-06-02 11:46:55 +08:00
Guo Xiang Tan fe9c82994d
DEV: Actually disconnect from Redis connections after fork. 2020-06-02 11:40:16 +08:00
Guo Xiang Tan ade60b0cbc
DEV: Enable readonly mode for all multisite sites when PG goes down.
The risk here is that the database for one site goes down in the multisite setup and we drop everything to readonly mode. However, I discussed this with Sam and we agree that one database having problem is very rare. Most of the time, it is the entire DB cluster that goes down.
2020-06-02 11:32:07 +08:00
Guo Xiang Tan 7897010dfd
Fix lint. 2020-06-02 10:45:18 +08:00
Guo Xiang Tan 370cba451d
DEV: Refactor away conditionals that we don't need. 2020-06-02 10:40:29 +08:00
Guo Xiang Tan c21e3bbd1b
DEV: Prefer `create!` over `create` when not checking return value.
We don't want stuff to silently fail.
2020-06-02 10:34:05 +08:00
Penar Musaraj 2a0a689442
UX: prevent devices from miscalculating fullscreen composer height
Fixes issue seen in some Chromebooks that flip between tablet and regular notebook window size
2020-06-01 22:24:16 -04:00
Sam Saffron 7e52106812
DEV: when synchornizing state pull tags
In some cases we may want topic tracking state to keep track of tags
this small change ensures we do not remove them if they are already in place
2020-06-02 11:42:00 +10:00
Guo Xiang Tan 326d6d5b0f
DEV: Pause Sidekiq when forcing pg readonly mode. 2020-06-02 09:20:03 +08:00
Penar Musaraj fa6aa7f627
FIX: Digest frequency issue on user creation
If `default email digest frequency` was set to "Never", users would get
a `digest_after_minutes` set to `nil` which triggered this error
in the logs if/when the site eventually changed that setting and
enabled digests:

```
NoMethodError (undefined method `>=' for nil:NilClass)
/var/www/discourse/app/mailers/user_notifications.rb:227:in `digest'
```
2020-06-01 17:39:16 -04:00
Robin Ward a95826f60c
Remove discourse constants (#9958)
* DEV: `Discourse.baseUri` does not exist

This never could have worked - should have been `Discourse.BaseUri` if
anything.

* DEV: Remove Discourse.Environment

* DEV: Remove `Discourse.disableMissingIconWarning`

* DEV: A bunch more missing environment checks
2020-06-01 16:33:43 -04:00
Kane York 9162cd8f3d
FIX: Only render group card if user title is from group (#9946)
This was failing when a user with a primary_group chose to display a title coming from a badge.
2020-06-01 11:44:41 -07:00
Neil Lalonde 09dc5eb5ea
Version bump to v2.5.0.beta6 2020-06-01 14:13:48 -04:00
Neil Lalonde 72c09ab4ae
Update translations 2020-06-01 13:58:51 -04:00