Commit Graph

30369 Commits

Author SHA1 Message Date
Carson Chang
dc850eb1b9 linting 2023-09-10 08:22:00 +00:00
Carson Chang
5a75608112
Remove unnecessary plugin outlet <span> wrapper 2023-09-10 00:59:06 -07:00
David Taylor
e813109c18
DEV: Replace BulkTopicSelection mixin with a helper object (#23486)
Previously landed in 206969e and then reverted in 7b165c6 due to an issue with tag-show. This PR resolves that issue.
2023-09-09 14:08:02 +01:00
Jarek Radosz
8c6b1fbbc1
DEV: Move helper tests to the correct directory (#23485) 2023-09-09 14:03:13 +02:00
Isaac Janzen
7b165c6c2f
Revert "DEV: Replace BulkTopicSelection mixin with a helper object (#23268)" (#23484)
This reverts commit 206969e49d.
2023-09-09 00:26:56 +01:00
Isaac Janzen
198181b7f8
DEV: Convert raw-email modal to component-based API (#23471) 2023-09-08 13:28:23 -05:00
Isaac Janzen
daf8c32d0e
FIX: Render 'In topic context' search results at the correct time (#23481) 2023-09-08 12:20:55 -05:00
Kris
22747e26fd
DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
Bianca Nenciu
4db5310135
DEV: Remove unused topic_create_allowed_category_ids (#23463) 2023-09-08 12:03:22 +03:00
dependabot[bot]
dc29136af0
Build(deps-dev): Bump the babel group (#23445)
Bumps the babel group in /app/assets/javascripts with 1 update: [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).

- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.16/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/standalone"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-08 01:18:25 +02:00
Kris
a35842e369
UX: fix mobile timeline footer button positioning (#23470) 2023-09-07 18:26:35 -04:00
Kris
4ed0ab79f6
FIX: focus state color on .btn[href] (#23469) 2023-09-07 17:51:34 -04:00
David Taylor
754cd9cd22
DEV: Enable sourcemaps in production under Embroider (#23466) 2023-09-07 19:35:39 +01:00
David Taylor
206969e49d
DEV: Replace BulkTopicSelection mixin with a helper object (#23268)
Mixins are considered deprecated by Ember, and cannot be applied to modern framework objects. Also, the coupling they introduce can make things very difficult to refactor.

This commit takes the state/logic from BulkTopicSelection and turns it into a helper object. This avoids it polluting any controllers/components its included in.

In future, the entire helper object can be passed down to child components so that they don't need to lookup controllers using the resolver. Those kinds of changes would involve changing some very heavily-overridden templates, so they are not included in this PR. It will likely be done as part of the larger refactor in https://github.com/discourse/discourse/pull/22622.
2023-09-07 19:05:41 +01:00
Isaac Janzen
72f124a5d0
DEV: Update install-theme modal extension points (#23444) 2023-09-07 10:28:16 -05:00
David Taylor
894307ff0e
DEV: Update asset config for embroider (#23461)
- Add data-embroider-ignore to all script tags which are not currently being compiled by embroider

- Ensure all remaining script tags are wrapped in `<discourse-chunked-script>` so that Rails will follow any renames which Embroider makes (e.g. when it adds fingerprints to filenames)
2023-09-07 16:17:22 +01:00
Godfrey Chan
e1373c3e84
DEV: introduce Embroider behind a flag, and start testing in CI (#23005)
Discourse core now builds and runs with Embroider! This commit adds
the Embroider-based build pipeline (`USE_EMBROIDER=1`) and start
testing it on CI.

The new pipeline uses Embroider's compat mode + webpack bundler to
build discourse code, and leave everything else (admin, wizard,
markdown-it, plugins, etc) exactly the same using the existing
Broccoli-based build as external bundles (<script> tags), passed
to the build as `extraPublicTress` (which just means they get
placed in the `/public` folder).

At runtime, these "external" bundles are glued back together with
`loader.js`. Specifically, the external bundles are compiled as
AMD modules (just as they were before) and registered with the
global `loader.js` instance. They expect their `import`s (outside
of whatever is included in the bundle) to be already available in
the `loader.js` runtime registry.

In the classic build, _every_ module gets compiled into AMD and
gets added to the `loader.js` runtime registry. In Embroider,
the goal is to do this as little as possible, to give the bundler
more flexibility to optimize modules, or omit them entirely if it
is confident that the module is unused (i.e. tree-shaking).

Even in the most compatible mode, there are cases where Embroider
is confident enough to omit modules in the runtime `loader.js`
registry (notably, "auto-imported" non-addon NPM packages). So we
have to be mindful of that an manage those dependencies ourselves,
as seen in #22703.

In the longer term, we will look into using modern features (such
as `import()`) to express these inter-dependencies.

This will only be behind a flag for a short period of time while we
perform some final testing. Within the next few weeks, we intend
to enable by default and remove the flag.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2023-09-07 13:15:43 +01:00
Andrei Prigorshnev
73781c8a96
FIX: Do not consider code-blocks when parsing mentions (#23280)
We have the max_mentions_per_chat_message site settings; when a user tries 
to mention more users than allowed, no one gets mentioned.

Chat messages may contain code-blocks with strings that look like mentions:

  def foo
    @bar + @baz
  end

The problem is that the parsing code considers these as real mentions and counts 
them when checking the limit. This commit fixes the problem.
2023-09-07 16:13:13 +04:00
Jarek Radosz
02bd709bc3
DEV: Fix badge tests (#23442)
`badge.save(["name", "description", "badge_type_id"])` api it was testing isn't a thing anymore.

Also: replaces `assert.expect(0)` with more useful assertions
2023-09-07 09:53:37 +08:00
Isaac Janzen
5288d875d5
A11Y: Ensure you can tab to submit on 2FA modal (#23135)
This PR relies upon https://github.com/discourse/discourse/pull/23093

- move login modal tests to `..../modal/login/....`
2023-09-06 12:22:41 -05:00
Mark VanLandingham
576c76e4cb
FEATURE: addBeforeAuthCompleteCallback plugin API method (#23441) 2023-09-06 08:48:51 -07:00
Jarek Radosz
60bc4efda4
DEV: Use a standard service injection (#23439)
A follow up to f73d8346c2
2023-09-06 17:10:08 +02:00
Roman Rizzi
0f6ac634f4
FIX: Everyone should be aware a cached summary is outdated. (#23438)
This should be the case even they cannot regenerate it.
2023-09-06 12:09:21 -03:00
David Taylor
f73d8346c2
DEV: Improve RestModel injections workaround (#23435)
We have a workaround so that currentUser/siteSettings/appEvents work properly on RestModel instances which are created without an owner. This is not ideal, but fixing this properly is not trivial. This commit improves the workaround to be more robust and support all service injections.
2023-09-06 15:11:05 +01:00
Meghna
5742c4b875
UX: fix tag chooser width when there are multiple tags (#23432) 2023-09-06 16:01:03 +05:30
Meghna
48951bb35e
UX: show only one username on multiple likes notification (#23385)
To adjust for small width screen and multiple locales only show one
username on multiple likes notification.
2023-09-06 15:30:56 +05:30
Jarek Radosz
5e7287eba5
DEV: Convert sticky-avatars into a modifier (#23060)
Instead of a initializer and a lib class (that needed access to the ownership system)
2023-09-06 11:32:08 +02:00
Ted Johansson
e74560f062
FIX: Don't mix up action labels between different reviewables (#23365)
Currently, if the review queue has both a flagged post and a flagged chat message, one of the two will have some of the labels of their actions replaced by those of the other. In other words, the labels are getting mixed up. For example, a flagged chat message might show up with an action labelled "Delete post".

This is happening because when using bundles, we are sending along the actions in a separate part of the response, so they can be shared by many reviewables. The bundles then index into this bag of actions by their ID, which is something generic describing the server action, e.g. "agree_and_delete".

The problem here is the same action can have different labels depending on the type of reviewable. Now that the bag of actions contains multiple actions with the same ID, which one is chosen is arbitrary. I.e. it doesn't distinguish based on the type of the reviewable.

This change adds an additional field to the actions, server_action, which now contains what used to be the ID. Meanwhile, the ID has been turned into a concatenation of the reviewable type and the server action, e.g. post-agree_and_delete.

This still provides the upside of denormalizing the actions while allowing for different reviewable types to have different labels and descriptions.

At first I thought I would prepend the reviewable type to the ID, but this doesn't work well because the ID is used on the server-side to determine which actions are possible, and these need to be shared between different reviewables. Hence the introduction of server_action, which now serves that purpose.

I also thought about changing the way that the bundle indexes into the bag of actions, but this is happening through some EmberJS mechanism, so we don't own that code.
2023-09-06 10:57:30 +08:00
Jeff Wong
2829898951 Add plugin outlet for after-panel-body in user menu
Similar to panel-body-bottom but shows up outside the div, and
shows even during EmptyStateComponent is shown.
2023-09-05 18:22:05 -07:00
Jeff Wong
bbc7518b0f FIX: tests 2023-09-05 18:21:51 -07:00
Jeff Wong
a8324395e9 FEATURE: add silence reason dropdown to admin penalty reason
Adds dropdown list for pre-defined penalty options to silence to
mirror options on suspension list.
2023-09-05 18:21:51 -07:00
Jarek Radosz
b55a5cbbb2
DEV: Remove unnecessary assert.expects (#23426)
And one superfluous `run`. And add an assert to user-badge test. And replace `expect` with `allSettled` in rest-model tests.
2023-09-06 02:16:50 +02:00
Martin Brennan
c532f6eb3d
FEATURE: Secure uploads in PMs only (#23398)
This adds a new secure_uploads_pm_only site setting. When secure_uploads
is true with this setting, only uploads created in PMs will be marked
secure; no uploads in secure categories will be marked as secure, and
the login_required site setting has no bearing on upload security
either.

This is meant to be a stopgap solution to prevent secure uploads
in a single place (private messages) for sensitive admin data exports.
Ideally we would want a more comprehensive way of saying that certain
upload types get secured which is a hybrid/mixed mode secure uploads,
but for now this will do the trick.
2023-09-06 09:39:09 +10:00
Isaac Janzen
152a99b3f4
DEV: Allow uploadUrl to be based to theme-upload-add modal (#23415) 2023-09-05 15:36:48 -05:00
Jarek Radosz
d308360376
FIX: An incorrect import (#23414)
Introduced in bb2d1f8703
2023-09-05 22:11:20 +02:00
Jarek Radosz
1ca4e7241e
UX: Fix checkbox slider (#23412) 2023-09-05 22:08:44 +02:00
David Taylor
2ed223fced
DEV: Move from babel-plugin-debug-macros fork to in-repo patch (#22702) 2023-09-05 18:07:56 +01:00
Isaac Janzen
bb2d1f8703
DEV: Convert login modal to component-based API (#23093)
# Desktop
##### Before
<img width="865" alt="Screenshot 2023-08-17 at 1 32 02 PM" src="https://github.com/discourse/discourse/assets/50783505/1691ae34-8cc3-4deb-bee0-748851a43f6c">

##### After
<img width="818" alt="Screenshot 2023-08-17 at 1 34 13 PM" src="https://github.com/discourse/discourse/assets/50783505/0dcc6d95-270f-44a1-8582-5f7bf89e7e2c">

# Mobile
##### Before
<img width="364" alt="Screenshot 2023-08-17 at 1 28 20 PM" src="https://github.com/discourse/discourse/assets/50783505/6758b7f9-da65-464e-b289-d43177218026">

##### After
<img width="365" alt="Screenshot 2023-08-17 at 1 28 33 PM" src="https://github.com/discourse/discourse/assets/50783505/f32f28d3-a48c-485f-91eb-dc6bcaf8a2e1">

# Changes Made
- I took the liberty to hide the password <kbd>Show</kbd> / <kbd>Hide</kbd> toggle when no password present.
##### Before
<img width="237" alt="Screenshot 2023-08-15 at 4 46 16 PM" src="https://github.com/discourse/discourse/assets/50783505/dfa46535-27ea-4756-8cb0-2c1108505ec7">
<img width="240" alt="Screenshot 2023-08-15 at 4 43 03 PM" src="https://github.com/discourse/discourse/assets/50783505/b1b9bacd-8b11-4fb5-89ce-53135417193f">
<img width="244" alt="Screenshot 2023-08-15 at 4 42 58 PM" src="https://github.com/discourse/discourse/assets/50783505/88f3176b-fc25-4d0b-8193-967bf898f113">

##### After
<img width="263" alt="Screenshot 2023-08-15 at 4 45 47 PM" src="https://github.com/discourse/discourse/assets/50783505/48241693-5b0b-4c21-8a06-e14262ede79c">
<img width="268" alt="Screenshot 2023-08-15 at 4 45 50 PM" src="https://github.com/discourse/discourse/assets/50783505/3c2c4aeb-6fde-45c5-8e45-2879ecb7ead2">
<img width="221" alt="Screenshot 2023-08-15 at 4 45 39 PM" src="https://github.com/discourse/discourse/assets/50783505/94406f13-6b20-484c-831e-1b828600cccf">
2023-09-05 12:01:39 -05:00
Roman Rizzi
7a34ea7953
DEV: Outlet for unobtrusive secondary full-page search. (#23390)
`discourse-ai` will use the outlet to perform a parallel semantic search.
2023-09-05 10:45:09 -03:00
Jarek Radosz
2dbec2e836
DEV: Apply ember-this-fallback patches sequentially (#23407) 2023-09-05 12:50:15 +02:00
Loïc Guitaut
7d0d0e48bc DEV: Add missing keyboard shortcut on cheatsheet
PR #23387 introduced a new keyboard shortcut to archive private
messages, but the new shortcut wasn’t added to the keyboard shortcuts
cheatsheet.
2023-09-05 11:59:38 +02:00
Jarek Radosz
c285f4133f
DEV: Enable ember-this-fallback in themes (#23384)
Co-authored-by: David Taylor <david@taylorhq.com>
2023-09-05 11:16:12 +02:00
Ted Johansson
752a2cc654
DEV: Handle bad parameters in TopicsController#wordpress (#23404)
We're seeing a large number of log noise from this endpoint due to malicious scanners that are trying to send clever params and seeing if they can break something.

This change simply rescues any NoMethodError during parameter parsing and re-raises a Discourse::InvalidParameters exception, which will be caught and render a 400.
2023-09-05 16:35:46 +08:00
Loïc Guitaut
cf8c3cf3f0 FEATURE: Add a shortcut to archive PM
This patch adds a new shortcut to allow archiving private messages. When
on a private message page, just type `a` to archive it. Typing `a` on an
already archived message will move it back to inbox.
2023-09-05 09:44:05 +02:00
Arpit Jalan
e5f3c26d20
FEATURE: add group filter for admin reports (#23381)
FEATURE: add group filter for admin reports

DEV: add plugin outlet for admin dashboard tabs
2023-09-05 11:17:18 +05:30
Ted Johansson
d1253bc3af
DEV: Include context question for chat reviewables (#23332)
Chat review queue flags were missing the context message above the actions.

This is probably because the (reasonably complex) logic was somewhat hard-coded to posts. After some investigation I concluded we can reuse this logic with some small amendments.
2023-09-05 10:11:39 +08:00
dependabot[bot]
29c3f1557a
Build(deps-dev): Bump terser in /app/assets/javascripts (#23397)
Bumps [terser](https://github.com/terser/terser) from 5.19.3 to 5.19.4.
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/compare/v5.19.3...v5.19.4)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: direct:development
  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>
2023-09-05 00:28:38 +02:00
dependabot[bot]
df3770fcca
Build(deps-dev): Bump the babel group (#23396)
Bumps the babel group in /app/assets/javascripts with 2 updates: [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) and [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/core` from 7.22.11 to 7.22.15
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.15/packages/babel-core)

Updates `@babel/standalone` from 7.22.14 to 7.22.15
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.15/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: babel
- dependency-name: "@babel/standalone"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 00:27:27 +02:00
David Taylor
c7dce90f43
DEV: Switch to using standard ember-cli test bundle (#23337)
Previously we were patching ember-cli so that it would split the test bundle into two halves: the helpers, and the tests themselves. This was done so that we could use the helpers for `/theme-qunit` without needing to load all the core tests. This patch has proven problematic to maintain, and will become even harder under Embroider.

This commit removes the patch, so that ember-cli goes back to generating a single `tests.js` bundle. This means that core test definitions will now be included in the bundle when using `/theme-qunit`, and so this commit also updates our test module filter to exclude them from the run. This is the same way that we handle plugin tests on the regular `/tests` route, and is fully supported by qunit.

For now, this keeps `/theme-qunit` working in both development and production environments. However, we are very likely to drop support in production as part of the move to Embroider.
2023-09-04 17:09:55 +01:00
David Taylor
f645706e6e
DEV: Cachebust workbox assets (#23383)
The changes in e1d27400f5 slightly changed the sourcemap paths of our workbox assets. The sourcemaps now have the extension `.prod.map` instead of `prod.js.map`. However, since the version number of workbox didn't change, the directory digest remained the same, and so cached versions of the JS were pointing to the now-nonexistant map files.

This commit introduces a cachebusting constant which we can bump for these kinds of changes in future.
2023-09-04 16:04:39 +01:00