Commit Graph

37603 Commits

Author SHA1 Message Date
4078b22887 FIX: Handle missing provider return sso url
This commit prevents a 500 error from occurring if someone is trying to
setup their discourse instance as a sso provider and they don't pass in
a `return_sso_url` in their payload.
2020-05-12 18:16:50 -06:00
9981fa4466 FIX: Prevent column name conflicts in reviewable code (#9753)
We were getting errors like this in Reviewables in some cases:

```
ActiveRecord::StatementInvalid (PG::AmbiguousColumn: ERROR:  column reference "category_id" is ambiguous
LINE 4: ...TRUE) OR (reviewable_by_group_id IN (NULL))) AND (category_i...
```

The problem that was making everything go boom is that plugins can add their own custom filters for Reviewables. If one is doing an INNER JOIN on topics, which has its own category_id column, we would get the above AmbiguousColumn error. The solution here is to just make all references to the reviewable columns in the list_for and viewable_by code prefixed by the table name e.g. reviewables.category_id.
2020-05-13 09:05:56 +10:00
e990d8adce FIX: ensures preview is correctly computing timezone for current user (#9758)
This also fixes a related bug with timezones on displayed date when in calendar range.
2020-05-12 12:30:41 -07:00
d9f5499f3a Revert "Revert "DEV: Remove Discourse.Route""
This reverts commit b4d27d327deeab8e42fd67bafe5dd369742e636e.

Plugins have been updated to not use this anymore.
2020-05-12 14:15:07 -04:00
e73e9aa7f2 DEV: skip failing test (#9755) 2020-05-12 18:32:12 +02:00
033644ea82 DEV: Adds an integrity spec for JS constants 2020-05-12 12:23:36 -04:00
1c0c425f38 DEV: Detect correct data dir using ENV 2020-05-12 13:10:57 -03:00
497dc6eaa7 Add a global setting for CDN origin
This is so that, on a multisite cluster, when we handle a CDN request,
the hostname that is requested corresponds to one of the sites -
specifically the default site.
2020-05-12 16:43:40 +01:00
2298e14d38 FEATURE: Support for App Shortcuts Menu (#9749)
* FEATURE: Support for App Shortcuts Menu

This adds a list of shortcuts to a installed Discourse instance.

It can be accessed by right clicks or long press on the app icon.

See https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/Shortcuts/explainer.md

List of possible follow ups include:

- Making it admin customizable
- Making it user customizable
- Using SVG icons from the site icon sprite
- Picking an accent color for icons

* FIX: Add type to shortcut menu icons
2020-05-12 12:24:33 -03:00
088c11a12c FIX: Don't raise an exception if a TopicLink cannot be created
This can happen under concurrency and it's fine. If a `TopicLink`
already exists we can continue on without raising an error.
2020-05-12 11:15:59 -04:00
0344ad14c1 FIX: Add missing rss routes to parameter api whitelist 2020-05-12 16:08:35 +01:00
c94e6a9a66 FEATURE: add noindex header to tags pages (#9748) 2020-05-12 10:44:46 -04:00
9bce91f59f DEV: Allow plugins to add extra icons to category-link (#9743) 2020-05-12 09:41:16 -05:00
6230f5c554 FEATURE: Allow parameter authentication for UserApiKeys (#9742)
This refactors default_current_user_provider in a few ways:
- Introduce a generic `api_parameter_allowed?` method which checks for whitelisted routes/formats
- Only read the api_key parameter on allowed routes. It is now completely ignored on other routes (previously it would raise a 403)
- Start reading user_api_key parameter on allowed routes
- Refactor tests as end-end integration tests

A plugin API for PARAMETER_API_PATTERNS will be added soon
2020-05-12 13:35:36 +01:00
16137308b0 FIX: Show Settings button if plugin has settings (#9728)
It used to check if the plugin has an enabled_setting.
2020-05-12 11:18:19 +03:00
a29ae17d3a FIX: saving drafts unconditionally increases sequence
Previously we only changed sequence on ownership change, this
cause a race condition between tabs where user could type for a
long time without being warned of an out of date draft.

This change is a radical change and we should watch closely.

Code was already in place to track sequence on the client so no
changes are needed there.
2020-05-12 16:55:42 +10:00
451e9c4bb9 DEV: minor SQL formatting change
Moved join prior to left join to make query less confusing.

Has no material impact on performance.
2020-05-12 16:55:42 +10:00
4ea7a7cf67 Build(deps): Bump rubocop from 0.82.0 to 0.83.0
Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.82.0 to 0.83.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.82.0...v0.83.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-12 14:28:29 +08:00
8fb99f218d FEATURE: Allow plugins to register a callback to ignore DraftSequence. 2020-05-12 14:25:20 +08:00
d301af39bd PERF: Avoid hitting DB when fetching draft sequence of bot user. 2020-05-12 13:56:58 +08:00
39a2d90e0f DEV: Pass currentUser to post-menu button builders (#9752)
Adding this from a review; I was using Discourse.currentUser which is frowned upon now.

Passing currentUser both for regular post menu buttons and extra buttons attached via the plugin API.

Lots of formatting/whitespace changes, best off reviewing with ?w=1
2020-05-12 14:09:38 +10:00
3c423faafd DEV: Avoid repeating draft key logic in multiple places. 2020-05-12 11:14:03 +08:00
a009ec597d remove ember container div 2020-05-11 21:12:33 -04:00
6f228b0312 FIX: Remove unnecessary forward slashes in regex 2020-05-11 17:55:44 -07:00
dfe55d2344 DEV: remove prefix
.public was a cut-and-paste fail, removing
2020-05-12 10:09:02 +10:00
f4a53bd8f0 DEV: create missing indexes
These indexes should have been created in aa2a9da4
2020-05-12 09:57:31 +10:00
aa2a9da4b2 PERF: reduce exclusive locking when changing tables
posts and topics tables can be huge, this migration change
ensures the migration performs less work in one giant transaction
reducing risk of deadlocks

Migration is re-runnable thanks to NOT EXISTS checks
2020-05-12 09:51:59 +10:00
4c8bece104 FEATURE: default canonical URL (#9738)
For pages that do not specify canonical URL we will default to `https://SITENAME/PATH`. 

This ensures that if a URL is crawled on the CDN the search ranking will transfer to the main site.

Additionally we whitelist the `?page` param
2020-05-12 09:13:20 +10:00
7cdf41d311 DEV: Remove reference to Discourse.Category 2020-05-11 18:28:45 -04:00
e744b9efec FIX: add tabindex=-1 on tabLoc post links
This prevents tabbing from confusing screenreaders, as having default tabindex
with aria-hidden confuses screenreaders
2020-05-11 14:43:12 -07:00
90b900704b FIX: Improve mobile footer nav accessibility 2020-05-11 16:55:34 -04:00
b4d27d327d Revert "DEV: Remove Discourse.Route"
This reverts commit eed7983404fdf7f2f2b48144035739aa158099d7.
2020-05-11 16:50:53 -04:00
22af44ac49 DEV: Remove Discourse.Mobile 2020-05-11 16:13:29 -04:00
eed7983404 DEV: Remove Discourse.Route 2020-05-11 16:11:33 -04:00
74db317974 DEV: Remove deprecation for Discourse.Category 2020-05-11 16:10:21 -04:00
286b4e535e DEV: allows buttons to define aria-label (#9747) 2020-05-11 22:09:44 +02:00
b4bd238dd6 DEV: Add safe deprecation to Discourse.User 2020-05-11 16:08:12 -04:00
46730a2f0d DEV: Allow us to keep the deprecation with Ember CLI 2020-05-11 16:06:06 -04:00
4c17ff98fa DEV: Remove deprecation for Discourse.Session 2020-05-11 15:51:10 -04:00
8311374a5a DEV: Replace version.js.erb with pre generated file 2020-05-11 15:43:09 -04:00
d2b16a7618 DEV: Generate emoji/data on demand (#9744)
These emoji rarely change and can be re-generated when we make changes
to them.
2020-05-11 15:29:46 -04:00
ab919332dc DEV: api documentation updates (#9612)
* DEV: api documentation updates

- Created a script to convert json responses to rswag
- Documented several api endpoints
- Switched rswag to use header based auth

* Update script, fix some schema missmatches
2020-05-11 13:06:49 -06:00
af6e61defd FIX: sets a title for notifications button (#9745) 2020-05-11 20:46:08 +02:00
5a073c6a0a Revert "FIX: title should attempt to fallback to label before name (#9739)"
This reverts commit c6bf552ca3a61059d569d199d1e330547a78f761.
2020-05-11 20:09:11 +02:00
141f16eb6b FIX: Multiple schema.org improvements
* Do not show "Uncategorized" category in topics list.
* Use "BreadcrumbList" only if topic is in a category.
* Add tags list as keywords to the first post.
* Add "dateModified" even if it is the same with "datePublished".
* Show "crawler-linkback-list" only if there are links to be shown.
2020-05-11 20:38:49 +03:00
0deb05740f Revert "DEV: allows to define an ariaLabel on d-button (#9716)"
This reverts commit 7a95dd48415c2152f1c791b2dfcd04f6910c1ca7.
2020-05-11 19:19:13 +02:00
7a95dd4841 DEV: allows to define an ariaLabel on d-button (#9716)
* DEV: allows to define an ariaLabel on d-button

This topic also adds this function to topic-footer-buttons, simplifies the whole logic of titile/label/arialabel in d-button and adds tests for these properties.

* typo
2020-05-11 18:42:51 +02:00
c6bf552ca3 FIX: title should attempt to fallback to label before name (#9739) 2020-05-11 18:42:18 +02:00
4d137b4f89 FIX: Handle a deleted topic in thumbnail generation
Follow up to 03818e642a1ae871bffdc0c39c10f05f0b8b0398

A topic can be deleted between job enqueue and job execution
2020-05-11 13:32:37 -03:00
6e3fe1abba DEV: Use async/await instead of andThen() 2020-05-11 18:22:48 +02:00