Commit Graph

55494 Commits

Author SHA1 Message Date
锦心
ac365a86a2
FIX: Trigger user_logged_out event when the user logs out (#28482)
What did this fix?
===============

Previously, we only triggered this event in the `user.logged_out` method.
This resulted in the event being triggered only when the user was logged
out by the administrator or the site had strict logout mode enabled.
This bug affected customers who managed user status via webhooks.

meta topic: https://meta.discourse.org/t/user-log-out-event-not-triggered-in-webhooks/249464
2024-08-22 21:48:27 +08:00
David Taylor
819d07469d
DEV: fixup themes:install:archive flag (#28486)
Followup to a69f3a0880
2024-08-22 13:22:37 +01:00
Osama Sayegh
67cde14a61
DEV: Use Service::Base for suspend and silence actions (#28459)
This commit moves the business logic in the `Admin::UsersController#suspend` and `Admin::UsersController#silence` actions to dedicated service classes. There's no functional changes in this commit.

Internal topic: t/130014.
2024-08-22 14:38:56 +03:00
David Taylor
58c4528a1c
DEV: Replace silent theme-install fails with exceptions (#28485)
Previously, we were silently failing when a theme hit SSRF protection, or the `git clone` command failed for some reason. This commit updates them to be exceptions, so they provide more useful error messages
2024-08-22 12:09:56 +01:00
David Taylor
a69f3a0880
DEV: Add env to themes:install:archive to allow skipping child themes (#28484) 2024-08-22 12:07:27 +01:00
Osama Sayegh
6997b3c5ce
FIX: Hide heading when there's no custom description (#28470)
In the new /about page, when there's no extended description provided by the admin, the "About" heading above the description should not be displayed.
2024-08-22 13:47:19 +03:00
Loïc Guitaut
f11f2b983f DEV: Put back the model step in HandleCategoryUpdated service
Now that `ActiveRecord` relations are properly handled in a `model`
step, putting this step back will allow the service to stops its
execution if there are no users to be removed without calling the pretty
big SQL query contained in the `CalculateMembershipsForRemoval` action.
2024-08-22 12:33:58 +02:00
dependabot[bot]
9d367cc9a1
Build(deps): Bump ace-builds from 1.35.5 to 1.36.0 (#28471)
Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.35.5 to 1.36.0.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ajaxorg/ace-builds/compare/v1.35.5...v1.36.0)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  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>
2024-08-22 12:22:31 +02:00
David Taylor
50c10de459
DEV: Update GitHub Actions runners to ubuntu 22.04 (#28481) 2024-08-22 11:09:39 +01:00
Régis Hanol
4b49e358fb
FIX: skip 1:1s when chat search returns users (#28464)
When we use CTRL/CMD + K to search, on the server we run 4 queries:

- 1 for users
- 1 for groups
- 1 for category channels
- 1 for direct message channels

The server returns up to 10 results per type and the client concatenate all the results (in the order I described) and then takes the first 10 or so.

Let's say you've had 1:1s with john1, john2, and john3. Searching for “john” would return all the johns as “users”. It doesn’t make sense to also return them as 1:1 dms.

That’s what this fixes. When the search returns some users, we skip all 1:1s because we assume they will show up as the results of the “users” query.

We’ll always return matching direct messages with more than 2 users (aka. “group chats”). All 3 other queries (users, groups, and category channels) are unaffected.

Internal ref - t/136079
2024-08-22 11:35:13 +02:00
dependabot[bot]
13938984c2
Build(deps-dev): Bump puppeteer-core from 23.1.0 to 23.1.1 (#28473)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from 23.1.0 to 23.1.1.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
- [Changelog](https://github.com/puppeteer/puppeteer/blob/main/release-please-config.json)
- [Commits](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v23.1.0...puppeteer-core-v23.1.1)

---
updated-dependencies:
- dependency-name: puppeteer-core
  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>
2024-08-22 11:00:42 +02:00
Joffrey JAFFEUX
905b4f900e
DEV: adds tag to core fabricators (#28480) 2024-08-22 10:49:00 +02:00
David Taylor
c91dcd0447
DEV: Convert core components to native class syntax (batch 1) (#28465)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-22 09:39:28 +01:00
David Taylor
3e3c051164
DEV: Convert select-kit base classes to native class syntax (#28467)
This lays the groundwork for converting SelectKit subclasses to native class syntax. This commit is designed to be entirely backwards-compatible, so it should not affect any existing subclasses.

Of interest:

- Any properties which are designed to be overridden by subclasses are implemented using a local `@protoProp` decorator. That means they are applied to the prototype, so that they can be overridden in subclasses by both legacy `.extend()` prototype extensions, and by modern native-class fields.

- New class decorators are introduced: `@selectKitOptions` and `@pluginApiIdentifiers`. These are native class versions of the legacy `concatenatedProperties` system. This follows the pattern Ember has introduced for `@className`, `@classNameBindings`, etc.
2024-08-22 09:39:03 +01:00
Martin Brennan
ebbe23e4d2
UX: Add title token for What's New admin page (#28476)
Followup e60b808f49,
I missed adding it here.
2024-08-22 14:36:32 +10:00
Martin Brennan
e60b808f49
UX: Apply new admin UI guidelines to What's New (#28454) 2024-08-22 10:28:29 +10:00
Jan Cernik
5090a56aa2
UX: Show topic map in topics without replies by default (#28468) 2024-08-21 17:41:50 -03:00
Joffrey JAFFEUX
5eca77dd70
FIX: ensures href is not set two times (#28466)
This would cause the infamous error:

```
index.js:118 Uncaught (in promise)
Error: Assertion Failed: You attempted to update `href` on `<ExtraNavItem:ember384>`, but it had already been used previously in the same computation.
```

Moreover, set didnt seem necessary here.
2024-08-21 20:27:21 +02:00
Renato Atilio
676f0897ac
FIX: subfolder account activation (#28463) 2024-08-21 13:50:38 -03:00
Kris
70ea3f8fcd
UX: improve mention colors for dark color schemes (#28462) 2024-08-21 11:45:48 -04:00
Jarek Radosz
cee2605d88
FIX: Lost outer context in #each block in hbr (#28461)
Regressed 3.5 years ago in e80332a2bc :P
2024-08-21 17:11:36 +02:00
Osama Sayegh
b69a7ea824
FIX: Specify @type arg for the image uploader in the about config area (#28460)
Specifying the type is required for the uploader to work on sites that use S3 uploads.
2024-08-21 16:35:32 +03:00
David Taylor
150f5694dc
FIX: Write stylesheet cache atomically (#28457)
In some situations, the filesystem cache will be read and persisted to the database. If the file being read is still being written, then that can lead to empty/partial caches being stored in the database.

This commit ensures that cannot happen by switching to our `atomic_write_file` helper (which writes to a temp file, and then does an atomic `mv` operation to move it to the destination)
2024-08-21 12:44:17 +01:00
Martin Brennan
9dd47ca755
UX: Fix restore info link on admin backups page (#28452)
Followup 1446596089

The link to inform admins that restore is disabled
was not correct. This fixes it and also changes it
to go to /admin/backups/settings
2024-08-21 13:23:24 +10:00
Martin Brennan
8632ea5a63
UX: Apply admin UI guidelines to custom flags (#28433)
This commit changes the custom flags admin config area
to use the AdminPageHeader component and conforms
to the new admin UI guidelines. Also makes some slight
modifications to the reusable components to handle using
a @route for an action button.
2024-08-21 10:42:00 +10:00
dependabot[bot]
8079560441
Build(deps-dev): Bump rspec-expectations from 3.13.1 to 3.13.2 (#28451)
Bumps [rspec-expectations](https://github.com/rspec/rspec-expectations) from 3.13.1 to 3.13.2.
- [Release notes](https://github.com/rspec/rspec-expectations/releases)
- [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-expectations/compare/v3.13.1...v3.13.2)

---
updated-dependencies:
- dependency-name: rspec-expectations
  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>
2024-08-21 01:04:33 +02:00
dependabot[bot]
e1855da40d
Build(deps-dev): Bump ember-cli from 5.10.0 to 5.11.0 (#28449)
Bumps [ember-cli](https://github.com/ember-cli/ember-cli) from 5.10.0 to 5.11.0.
- [Release notes](https://github.com/ember-cli/ember-cli/releases)
- [Changelog](https://github.com/ember-cli/ember-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-cli/compare/v5.10.0...v5.11.0)

---
updated-dependencies:
- dependency-name: ember-cli
  dependency-type: direct:development
  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>
2024-08-21 00:54:06 +02:00
dependabot[bot]
3d217dc6b3
Build(deps): Bump ace-builds from 1.35.4 to 1.35.5 (#28450)
Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.35.4 to 1.35.5.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ajaxorg/ace-builds/compare/v1.35.4...v1.35.5)

---
updated-dependencies:
- dependency-name: ace-builds
  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>
2024-08-21 00:52:25 +02:00
Sérgio Saquetim
649cbad216
DEV: Use the glimmer header in the Styleguide (#28427) 2024-08-20 19:44:26 -03:00
Osama Sayegh
eb0b2c9308
FIX: Use correct subtitle for Site contact name field (#28448)
A copy-and-paste error resulted in using the wrong subtitle for the "Site contact name" field in the admin config area for the /about page.
2024-08-21 01:21:49 +03:00
Kris
6c159241c9
UX: view count in topic map should always be at least 1 (#28447) 2024-08-20 17:26:09 -04:00
Osama Sayegh
10ae7ef44a
FEATURE: Add estimated number of global and EU visitors to the about page (#28382)
This commit implements 2 new metrics/stats in the /about page for the _estimated_ numbers of unique visitors from the EU and the rest of the world. This new feature is currently off by default, but it can be enabled by turning on the hidden `display_eu_visitor_stats` site settings via the rails console.

There are a number of assumptions that we're making here in order to estimate the number of unique visitors, specifically:

1. we're assuming that the average of page views per anonymous visitor is similar to the average number of page views that a logged-in visitor makes, and
2. we're assuming that the ratio of logged in visitors from the EU is similar to the ratio of anonymous visitors from the EU

Discourse keeps track of the number of both logged-in and anonymous page views, and also the number of unique logged-in visitors and where they're from. So with those numbers and the assumptions above, we can estimate the number of unique anonymous visitors from the EU and the rest of the world.

Internal topic: t/128480.
2024-08-21 00:03:42 +03:00
Mark VanLandingham
9802d4040f
DEV: Add class to span wrapping after-topic-list plugin outlet (#28445) 2024-08-20 14:08:06 -05:00
David Taylor
0b2b3f6d6f
DEV: Show ember-cli build progress when using bin/ember-cli -u (#28443)
`bin/ember-cli -u` buffers the output of ember-cli, which means progress is not shown clearly. This commit uses `TERM=dumb` to put ember-cli into a more simple mode, which outputs progress on separate lines. Also adds a `[ember-cli]` prefix to all output.
2024-08-20 19:20:47 +01:00
Tobias Eigen
5916eaac13
Update client.en.yml (#28442)
changed "contact us at email" to "contact email", which is shorter and reads well even if site is run by an individual.
2024-08-20 10:26:03 -07:00
Discourse Translator Bot
9f32bef544
Update translations (#28438) 2024-08-20 17:54:10 +02:00
Ted Johansson
948e7bd55e
DEV: Allow disabling problem checks programatically (#28440)
We need a way to disable certain checks programatically, e.g. on Discourse hosting. This PR adds a configuration option for this, and makes it so that disabled checks aren't run as part of #run_all.
2024-08-20 16:42:06 +02:00
Loïc Guitaut
0636855706 DEV: Allow using an AR relation as a model in services
This patch allows using an AR relation as a model in services without
fetching associated records. It will just check if the relation is empty
or not. In the former case, the execution will stop at that point, as
expected.
2024-08-20 16:32:46 +02:00
Osama Sayegh
db6eff7be9
DEV: Allow custom site activity items in the new /about page (#28400)
This commit introduces a new frontend API to add custom items to the "Site activity" section in the new /about page. The new API is called `addAboutPageActivity` and it works along side the `register_stat` serve-side API which serializes the data that the frontend API consumes. More details of how the two APIs work together is in the JSDoc comment above the API function definition.

Internal topic: t/128545/9.
2024-08-20 16:16:05 +03:00
Joffrey JAFFEUX
ccb1861ada
DEV: better highlighting of mentions (#28403)
This commit improves the hilight-ing of mentions in posts and chat messages.

- `@here` and `@all` will generate a `<a class="mention --wide">`
- bots will generate a `<a class="mention --bot">`
- current user will generate a `<a class="mention --current">`

To achieve this change the following value transformer has been added: "mentions-class". It will be run in posts and chat messages after the mention is rendered.

A bug were bots were not considered in mentioned users has also been fixed as part of this PR.
2024-08-20 14:37:28 +02:00
Osama Sayegh
35b748e7f4
FIX: Don't show silence button on staff users and display similar users (#28423)
This commit fixes a bug where the silence button is incorrectly displayed on the admin page of a staff user. It's not actually possible to silence a staff user because the backend correctly prevents it, but the frontend isn't checking if the button should be displayed.

Another small bug that this commit fixes is the similar users list not showing up inside the silence/suspend modals due to also a bug in the frontend.

I've also changed the way similar users are loaded so that they're not returned by the `admin/users#show` endpoint anymore and moved them into a new endpoint that the penalize modals (suspend and silence) can call directly to retrieve the list of users. This is done because the similar users list is never shown on the admin user page (`/admin/users/:user_id/:username`); they're only needed when the suspend or silence modals are opened.

Internal topic: t/130014.
2024-08-20 15:27:29 +03:00
dependabot[bot]
08463a9db2
Build(deps): Bump a11y-dialog from 8.0.4 to 8.1.0 (#28418)
Bumps [a11y-dialog](https://github.com/KittyGiraudel/a11y-dialog) from 8.0.4 to 8.1.0.
- [Release notes](https://github.com/KittyGiraudel/a11y-dialog/releases)
- [Commits](https://github.com/KittyGiraudel/a11y-dialog/compare/8.0.4...8.1.0)

---
updated-dependencies:
- dependency-name: a11y-dialog
  dependency-type: direct:production
  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>
2024-08-20 12:00:41 +02:00
锦心
070025204d
DEV: add addError method to FormKit onRegisterApi (#28436)
This commit adds the addError method to From's onRegisterApi to allow
parent components to add errors to a field.
2024-08-20 17:22:36 +08:00
Martin Brennan
e9b427ff53
FEATURE: Change default for push_notification_time_window_mins (#28431)
Currently the push_notification_time_window_mins is set to 10
minutes by default. We want to change this to 1 minute, which is the
delay it has been set to on meta and our internal site already for over
a year now.

This conforms to the expectation users have that notifications are
delivered close to immediately.
2024-08-20 15:46:07 +10:00
Alan Guo Xiang Tan
f41c4ccfc2
DEV: Switch back to Chrome for running QUnit tests (#28429)
QUnit tests are failing in different ways on Chromium in Debian
bookworm. We have no interest in figuring out why as it is not a good
use of our time and the long term plan is to switch to Chrome for Testing
anyway.
2024-08-20 13:12:33 +08:00
dependabot[bot]
b42d6faef5
Build(deps-dev): Bump @swc/core from 1.7.11 to 1.7.14 (#28424)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.11 to 1.7.14.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/swc-project/swc/compare/v1.7.11...v1.7.14)

---
updated-dependencies:
- dependency-name: "@swc/core"
  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>
2024-08-20 13:07:51 +08:00
David Taylor
dfc947a97d
PERF: Defer button actions to improve interaction-next-paint (INP) (#28019)
This is a variation on bc3e8a9963cf9a64d114ec751c875025af169690, which was reverted due to issues on iOS. Safari's "in response to user action" check cannot follow the `runAfterFramePaint` chain of interaction -> requestAnimationFrame -> messageChannel, and so some sensitive browser APIs (e.g. clipboard, upload, etc.) were blocked.

This commit is similar, but uses `next()` instead of `runAfterFramePaint()`. The result seems the same, but doesn't have the same issue on iOS.

The chat-emoji-picker change was required to resolve a test failure. The emoji picker has never closed-on-scroll on desktop, so there is no user-facing change in behavior.
2024-08-20 10:11:34 +08:00
Martin Brennan
1446596089
UX: Apply admin interface guidelines to Backups page (#28051)
This commit converts the Backups page in the admin interface
to follow our new admin interface guidelines.

As part of this work, I've also made `AdminPageHeader` and `AdminPageSubheader`
components that can be reused on any admin page for consistency, that handle
the title and action buttons and also breadcrumbs.

Also renamed `AdminPluginFilteredSiteSettings` to `AdminFilteredSiteSettings` since
it can be used generally to show a subset of filtered site settings, not only
settings for a plugin. Not sure if it's ideal to have to define a new route for this
for every config area, but not sure how else to do it right now.
2024-08-20 09:59:43 +10:00
Joffrey JAFFEUX
5b17e85fe1
FIX: broken mentioned users with capitalized usernames (#28421)
This commit fixes two codepaths which where incorrectly working with capitalized usernames as we were doing a mix of username_lower and non lower username.

Also adds two specs for these cases.
2024-08-19 20:57:45 +02:00
David Taylor
02678b3107
DEV: Use yarn-installed terser in assets.rake (#28422)
This was previously relying on a globally-installed terser, which comes from a time before Discourse had proper JS dependency management
2024-08-19 16:45:15 +01:00