Commit Graph

44240 Commits

Author SHA1 Message Date
71f7f7ed49 FEATURE: Add external_id to topics (#15825)
* FEATURE: Add external_id to topics

This commit allows for topics to be created and fetched by an
external_id. These changes are API only for now as there aren't any
front changes.

* add annotations

* add external_id to this spec

* Several PR feedback changes

- Add guardian to find topic
- 403 is returned for not found as well now
- add `include_external_id?`
- external_id is now case insensitive
- added test for posts_controller
- added test for topic creator
- created constant for max length
- check that it redirects to the correct path
- restrain external id in routes file

* remove puts

* fix tests

* only check for external_id in webhook if exists

* Update index to exclude external_id if null

* annotate

* Update app/controllers/topics_controller.rb

We need to check whether the topic is present first before passing it to the guardian.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>

* Apply suggestions from code review

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2022-02-08 20:55:32 -07:00
59343c3057 DEV: Add Windows Hello webauthn authentication spec (#15871)
Follow up to 6f7364e48bf3546e5a279fe483549d6e62cb3272 to add a spec
that tests the full authentication of a Windows Hello algorithm (-257)
webauthn verification. The test added in that commit only tested that
we know about that algorithm, not whether it was actually usable.
2022-02-09 12:47:47 +10:00
8abc4a0fd6 Revert "DEV: Prioritize full name when setting active (#15820)" (#15869)
This reverts commit 5a93ce421da4e52b9d649cf609cd7d79d21a1683.
2022-02-08 13:25:19 -06:00
5a93ce421d DEV: Prioritize full name when setting active (#15820)
Prioritize full name in these places (when setting active):
See: https://meta.discourse.org/t/display-full-name-not-username-when-attributing-quote-or-reply/203533/6 for context

- Reply to post
- Composer reply to post
- Quoting
2022-02-08 08:37:20 -06:00
fa9b2b4f42 Update translations (#15864) 2022-02-08 14:13:14 +01:00
6f7364e48b FEATURE: RS512, RS384 and RS256 COSE algorithms (#15804)
* FEATURE: RS512, RS384 and RS256 COSE algorithms

These algorithms are not implemented by cose-ruby, but used in the web
authentication API and were marked as supported.

* FEATURE: Use all algorithms supported by cose-ruby

Previously only a subset of the algorithms were allowed.
2022-02-08 14:07:47 +02:00
03b7d71827 DEV: Ensure that Discourse global is available for widget init (#15862)
Under ember-cli, we rely on the `ember-export-application-global` addon to make `window.Discourse` available. This happens in an initializer. Previously this inititalizer would run after `auto-load-modules`, and so any widget/helper modules would not be able to access it. This commit sets some `after` parameters on the `auto-load-modules` and `inject-objects` initializers to ensure that `export-application-global` is run first.
2022-02-08 10:45:36 +00:00
ecc07fd8dc DEV: Make Ember CLI assets the default in production (#15861)
This was reverted in e92f57255de429fcf12c4259235d88c5485d934f due to memory usage concerns. This memory issue was resolved by 4cceb55621aa5a25c72415d78a43bd62be68d68d.
2022-02-08 10:03:53 +00:00
7afe768d60 DEV: Add tests for wistia onebox. (#15860)
Follow-up to 4ef56b0ca4d997e5d0b331c488c83b7f574721df
2022-02-08 13:04:32 +08:00
6a2b85710b Build(deps): Bump request_store from 1.5.0 to 1.5.1 (#15641)
Bumps [request_store](https://github.com/steveklabnik/request_store) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/steveklabnik/request_store/releases)
- [Commits](https://github.com/steveklabnik/request_store/compare/v1.5.0...v1.5.1)

---
updated-dependencies:
- dependency-name: request_store
  dependency-type: indirect
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-08 13:05:35 +11:00
4ef56b0ca4 FIX: Explicitly set allowfullscreen on Wistia Oneboxes (#15828) 2022-02-08 13:02:32 +11:00
6758835387 FIX: Overridden MessageFormat fallbacks (#15855)
…were missing pluralization rules

This resulted in errors like `MessageFormat.locale.en is not a function`
2022-02-08 12:31:08 +11:00
6f03b2694d DEV: Fix typo. (#15857) 2022-02-08 09:04:53 +08:00
eadf618752 FIX: Align progress text (#15856) 2022-02-07 18:18:17 -06:00
4cceb55621 Revert "PERF: Update ember-auto-import (#15814)" (#15854)
This reverts commit f4c6a6185517a7d8a17c3faefb7e2e8cc67c44a8 and a8325c9016230f5171e0b72d7bff069784f64d16

This update of ember-auto-import and webpack causes significantly higher memory use during rebuilds. This made ember-cli totally unusable on 1GB RAM / 2GB swap environments. We don't have a specific need for this upgrade right now, so reverting for now.
2022-02-07 22:41:07 +00:00
d602c60e7d Build(deps): Bump sidekiq from 6.4.0 to 6.4.1 (#15853)
Bumps [sidekiq](https://github.com/mperham/sidekiq) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/mperham/sidekiq/releases)
- [Changelog](https://github.com/mperham/sidekiq/blob/main/Changes.md)
- [Commits](https://github.com/mperham/sidekiq/compare/v6.4.0...v6.4.1)

---
updated-dependencies:
- dependency-name: sidekiq
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-07 16:29:24 -05:00
820fea835c FIX: Further reduce the input of to_tsvector (#15716)
Random strings can result into much longer tsvectors. For example
parsing a Base64 string of ~600kb can result in a tsvector of over 1MB,
which is the maximum size of a tsvector.

Follow-up-to: 823c3f09d44ab89e88c4910abe36899bb23d601d
2022-02-07 23:03:01 +02:00
e92f57255d Revert "DEV: Make Ember CLI assets the default in production (#15843)" (#15852)
This reverts 1b622667bc8c08e56707b3f0a43828808d024787

We have had reports of issues rebuilding under memory-constrained environments. Reverting while we investigate further.
2022-02-07 20:31:10 +00:00
15cff27bfe DEV: Stringify keys of nested hashes in job arguments (#15850)
This provides symmetry with the `.with_indifferent_access` usage in `Jobs#perform`, which is also recursive.
2022-02-07 20:28:45 +00:00
ecd88e9abb DEV: Make :send_system_message arguments strings (#15851) 2022-02-07 20:18:17 +00:00
7223d5e012 UX: Fix login header z-index (#15848) 2022-02-07 13:31:03 -06:00
e83d603bbc DEV: Send message to DiscourseHub when dismissing (#15849) 2022-02-07 20:15:26 +01:00
cd460155aa DEV: Add Ember-CLI backwards compatibility for Discourse.Site (#15847) 2022-02-07 18:39:34 +00:00
9bfe5e58d3 Revert "DEV: Add context in AdminConstraint (#15838)" (#15845)
This reverts commit 492226a9737fc6c8d672383316569b7d2c523a55.
2022-02-07 21:05:19 +03:00
c8c23ba557 DEV: Introduce deprecation warning for non-json Job arguments (#15842)
This commit introduces our own handling and warning for Sidekiq's new 'non-json-serializable' warning. This decouples us from Sidekiq's own deprecation cycle, and allows us to use our own deprecation system. It also means that the dump/parse happens in test mode, which will help us to catch occurrences before they reach production.
2022-02-07 17:59:55 +00:00
a8325c9016 DEV: Load all vendor files for theme-qunit under prod ember-cli (#15844)
This regressed in f4c6a6185517a7d8a17c3faefb7e2e8cc67c44a8
2022-02-07 17:58:54 +00:00
1b622667bc DEV: Make Ember CLI assets the default in production (#15843)
This can be disabled by setting `EMBER_CLI_PROD_ASSETS=0`, but this option will not be available for long. If your theme/plugin/site has issues under Ember CLI, please open a topic on https://meta.discourse.org
2022-02-07 15:25:57 +00:00
ea2fd75d10 DEV: Fix some regexes in phpBB3 import script (#15829)
1. bbcode hashes don't always have exactly 8 characters.

2. colors aren't always hex values, it can be a color string ("red", "blue", etc).

3. The closing tag of smileys doesn't always include a `:` character (the start of the regex was already right for this particular issue)
2022-02-07 16:16:46 +01:00
492226a973 DEV: Add context in AdminConstraint (#15838)
This allows plugins to override the permissions required to access
specific things like the Logster and Sidekiq web UI without the changes
leaking to the rest of Discourse routes.
2022-02-07 16:25:31 +03:00
64be371749 DEV: Improve handling of invalid requests (#15841)
Our discourse_public_exceptions middleware is designed to catch bubbled exceptions from lower in the stack, and then use `ApplicationController.rescue_with_handler` to render an appropriate error response.

When the request itself is invalid, we had an escape-hatch to skip re-dispatching the request to ApplicationController. However, it was possible to work around this by 'layering' the errors. For example, if you made a request which resulted in a 404, but **also** had some other invalidity, the escape hatch would not be triggered.

This commit ensures that these kind of 'layered' errors are properly handled, without logging warnings. It also adds detection for invalid JSON bodies and badly-formed multipart requests.

The user-facing behavior is unchanged. This commit simply prevents warnings being logged for invalid requests.
2022-02-07 13:16:57 +00:00
bc5f2d0c4e Build(deps): Bump in_threads from 1.5.4 to 1.6.0 (#15642)
Bumps [in_threads](https://github.com/toy/in_threads) from 1.5.4 to 1.6.0.
- [Release notes](https://github.com/toy/in_threads/releases)
- [Changelog](https://github.com/toy/in_threads/blob/master/CHANGELOG.markdown)
- [Commits](https://github.com/toy/in_threads/compare/v1.5.4...v1.6.0)

---
updated-dependencies:
- dependency-name: in_threads
  dependency-type: indirect
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-07 14:11:52 +01:00
45c00c72bd FIX: Do not override mobile scroll on docked progress element (#15840) 2022-02-07 13:51:07 +01:00
404f882e5c FEATURE: in result.rb don't use email for username suggestions until enabled in settings (#15586) 2022-02-07 16:02:26 +04:00
357186ab7e FIX: User option fields definition was being mutated on save (#15837)
In the commit d8bf2810ffe49619077371d854fc12cba81f80fa we hoisted
the userOptionFields array to a module-level variable, but kept
the code inside save() the same. This causes an issue where if
save() is called twice on the same user with some array of user
option fields, the userOptionFields array is mutated, which means
the second save is likely not saving the fields intended.

This commit fixes the issue by not mutating the array. We cannot
change them into consts though, because we have an API to add more
items to the array.
2022-02-07 16:58:27 +10:00
0a738bd5bc FEATURE: Allow sending group SMTP emails with from alias (#15687)
This commit allows group SMTP emails to be sent with a
different from email address that has been set up as an
alias in the email provider. Emails from the alias will
be grouped correctly using Message-IDs in the mail client,
and replies to the alias go into the correct group inbox.
2022-02-07 13:52:01 +10:00
454d3740b4 DEV: Remove deprecated site settings. (#15725) 2022-02-07 11:26:06 +08:00
b7eacaed21 FIX: Handle addressable error when parsing an invalid URL. (#15836)
Passing in an invalid URL would result in an `Addressable::URI::InvalidURIError` which we were not catching.
2022-02-07 11:25:42 +08:00
5bd55acf83 FIX: Add DB constraints for post & topic counter cache for UserStat (#15626)
Ensures that `UserStat#post_count` and `UserStat#topic_count` does not
go below 0. When it does like it did now, we tend to have bugs in our
code since we're usually coding with the assumption that the count isn't
negative.

In order to support the constraints, our post and topic fabricators in
tests will now automatically increment the count for the respective
user's `UserStat` as well. We have to do this because our fabricators
bypasss `PostCreator` which holds the responsibility of updating `UserStat#post_count` and
`UserStat#topic_count`.
2022-02-07 11:23:34 +08:00
81e175e6ba FIX: allow native lazy loading attribute for quoted avatar image (#15834) 2022-02-07 09:28:26 +08:00
f805aa9e90 Build(deps): Bump ipaddr from 1.2.3 to 1.2.4
Bumps [ipaddr](https://github.com/ruby/ipaddr) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/ruby/ipaddr/releases)
- [Changelog](https://github.com/ruby/ipaddr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ruby/ipaddr/compare/v1.2.3...v1.2.4)

---
updated-dependencies:
- dependency-name: ipaddr
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-07 09:26:40 +08:00
ac8e5f0df7 Build(deps-dev): Bump rb-fsevent from 0.11.0 to 0.11.1
Bumps [rb-fsevent](https://github.com/thibaudgg/rb-fsevent) from 0.11.0 to 0.11.1.
- [Release notes](https://github.com/thibaudgg/rb-fsevent/releases)
- [Commits](https://github.com/thibaudgg/rb-fsevent/compare/v0.11.0...v0.11.1)

---
updated-dependencies:
- dependency-name: rb-fsevent
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-07 09:26:24 +08:00
a16184ab0d Build(deps): Bump excon from 0.90.0 to 0.91.0
Bumps [excon](https://github.com/excon/excon) from 0.90.0 to 0.91.0.
- [Release notes](https://github.com/excon/excon/releases)
- [Changelog](https://github.com/excon/excon/blob/master/changelog.txt)
- [Commits](https://github.com/excon/excon/compare/v0.90.0...v0.91.0)

---
updated-dependencies:
- dependency-name: excon
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-07 09:26:08 +08:00
cc7a04afdc DEV: Improve test paths pattern for Ember CLI.
Ember tests follows a convention where test files have a postfix of
`-test.js`. This ensures that any files in the tests folder which
follows this pattern is included.
2022-02-07 09:22:15 +08:00
65f46ad4ed FIX: Better param guards for wiki and post_type posts controller. 2022-02-07 09:21:24 +08:00
930f51e175 FEATURE: Split up text segmentation for Chinese and Japanese.
* Chinese segmenetation will continue to rely on cppjieba
* Japanese segmentation will use our port of TinySegmenter
* Korean currently does not rely on segmentation which was dropped in c677877e4fe5381f613279901f36ae255c909573
* SiteSetting.search_tokenize_chinese_japanese_korean has been split
into SiteSetting.search_tokenize_chinese and
SiteSetting.search_tokenize_japanese respectively
2022-02-07 09:21:14 +08:00
9ddd1f739e DEV: Update :critical_user_email calls to use strings (#15827)
Symbols are converted to strings anyway, so there is no change in behaviour. The latest version of sidekiq introduced a warning for this.
2022-02-04 23:43:53 +00:00
5d82a695d0 DEV: Use string timestamp when enqueuing update_top_redirection (#15826)
Job arguments go via JSON, and so DateTime objects will appear as strings in the Job's `#execute` method. The latest version of Sidekiq has started warning about this to reduce developer confusion.
2022-02-04 23:14:35 +00:00
f53d70ac63 DEV: Ensure delay_for and queue are not passed as job arguments (#15824)
This regressed in 3a85c4d680 because deep_stringify_keys makes a copy of the `opts` hash
2022-02-04 20:11:03 +00:00
863262a5de DEV: Update more Jobs#enqueue calls to use strings (#15823)
Symbols are converted to strings anyway, so there is no change in behaviour. The latest version of sidekiq introduced a warning for this.
2022-02-04 19:58:34 +00:00
be8c0baa18 DEV: Include exception class in Discourse.warn_exception log (#15822)
Sometimes, the 'message' portion of an exception isn't enough to work out what's happening. In these cases, including the exception class name can help with debugging.
2022-02-04 19:41:08 +00:00