Commit Graph

32858 Commits

Author SHA1 Message Date
Osama Sayegh
5dbf812d32
DEV: Add site age and site activities section to the redesigned about page (#28214)
This commit continues on work laid out by 6039b513fe to redesign the /about page. In this commit, we add the site age and a section on the right hand side to show site activities/statistics such as topics, posts, sign-ups, likes etc.
2024-08-07 11:11:41 +03:00
Alan Guo Xiang Tan
1a09d6b246
FEATURE: Add live_slots_(start|finish) for Sidekiq perf logging (#28260)
This information is helpful in debugging memory spikes when Sidekiq
processes jobs.
2024-08-07 15:48:24 +08:00
Kris
66a23180d4
UX: fix issue with long usernames wrapping in mobile user cards (#28256) 2024-08-06 17:47:59 -04:00
Kris
76b28ed836
UX: fix user profile button wrap, clean up styles (#28255) 2024-08-06 17:47:51 -04:00
Isaac Janzen
8aff94dadb
DEV: Add addLogSearchLinkClickedCallbacks to plugin API (#28254)
- Added `addLogSearchLinkClickedCallbacks` which allows plugins/TCs to register a callback when a search link is clicked and before a search log is created
2024-08-06 16:08:40 -05:00
David Taylor
66de6a43a8
FIX: Ensure do-not-disturb icon updates correctly (#28253)
`currentUser.do_not_disturb_until` is a string, so we need to parse it before comparing to the current timestamp
2024-08-06 19:13:13 +01:00
Kris
fe307ea2f0
UX: remove extra margin from flag description links (#28251) 2024-08-06 11:11:38 -04:00
Kris
746d8e613e
UX: break long words to prevent overflow in activity stream (#28250) 2024-08-06 10:49:49 -04:00
Loïc Guitaut
97cd03d41a FIX: Return additional message types properly
Following a recent refactor, some methods from `FlagSettings` have been
renamed (`custom_types` -> `additional_message_types`). The
`PostActionType` model was using `custom_types` but when the renaming
was done, it was renamed to `with_additional_message` instead of
`additional_message_types`, which under the right circumstances will
raise an error.
2024-08-06 16:01:38 +02:00
Joffrey JAFFEUX
584106b752
UX: link edit text to search in badges form (#28248)
During our refactoring of admin badges we decided to link to:

`adminSiteText.edit locale=locale`

Instead of:

`adminSiteText q=key`

After feedback from the community we are reverting this change.
2024-08-06 16:01:20 +02:00
David Taylor
998e035614
DEV: Convert core controllers to native class syntax (batch 4) (#28225)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-06 12:47:05 +01:00
Joffrey JAFFEUX
ad8c5e7f80
FIX: use CheckboxGroup for admin badges form (#28239)
A recent change in FormKit has changed the syntax of this specific component. It's also better to use `<CheckboxGroup />` for this use case too.

Im mixed on writing tests for labels, it's a lot of tests to write for a rather low value.

This commit also slightly tweaks the width of the icon picker, from medium to small.
2024-08-06 10:45:09 +02:00
Krzysztof Kotlarek
2b6c754779
Revert "FIX: Cache all flags multisite-safe (#28204)" (#28236)
This reverts commit 2225c03455.
2024-08-06 10:59:10 +10:00
Krzysztof Kotlarek
fc2259d1c8
FIX: limit the number of custom flags to 50 (#28221)
Admin can create up to 50 custom flags. It is limited for performance reasons.

When the limit is reached "Add button" is disabled and backend is protected by guardian.
2024-08-06 10:50:12 +10:00
dependabot[bot]
0514044cf2
Build(deps-dev): Bump @floating-ui/dom from 1.6.8 to 1.6.9 (#28235)
Bumps [@floating-ui/dom](https://github.com/floating-ui/floating-ui/tree/HEAD/packages/dom) from 1.6.8 to 1.6.9.
- [Release notes](https://github.com/floating-ui/floating-ui/releases)
- [Changelog](https://github.com/floating-ui/floating-ui/blob/master/packages/dom/CHANGELOG.md)
- [Commits](https://github.com/floating-ui/floating-ui/commits/@floating-ui/dom@1.6.9/packages/dom)

---
updated-dependencies:
- dependency-name: "@floating-ui/dom"
  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-06 08:48:17 +08:00
Martin Brennan
2225c03455
FIX: Cache all flags multisite-safe (#28204)
This fixes an N1 in topics when loading all flags
and also makes the cache multisite-safe, followup
to fb7cc2d375
2024-08-06 09:59:49 +10:00
Alan Guo Xiang Tan
2492fe7715
FIX: Set sane default for Net::HTTP when processing a request (#28141)
This commit patches `Net::HTTP` to reduce the default timeouts of 60
seconds when we are processing a request. There are certain routes in
Discourse which makes external requests and if the proper timeouts are
not set, we risk having the Unicorn master process force restarting the
Unicorn workers once the `30` seconds timeout is reached. This can
potentially become a vector for DoS attacks and this commit is aimed at
reducing the risk here.
2024-08-06 07:12:42 +08:00
Renato Atilio
48ac62dfef
UX: respect current locale on topic map views date format (#28199)
* UX: respect current locale on topic map views date format

* DEV: linting
2024-08-05 13:18:48 -03:00
marstall
e7f976a106
DEV: add description parameter to discourse-tag component (#28213)
* DEV: add description parameter to discourse-tag component

* prettier
2024-08-05 12:04:54 -04:00
dependabot[bot]
f9b44361b2
Build(deps-dev): Bump @swc/core from 1.7.4 to 1.7.6 (#28216)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.4 to 1.7.6.
- [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.4...v1.7.6)

---
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-05 13:57:26 +02:00
David Taylor
595c43c5e5
DEV: Enable glimmer header by default (#28222)
https://meta.discourse.org/t/316549
2024-08-05 12:08:52 +01:00
David Taylor
1b28b8e169
DEV: Upgrade babel & remove vendored safari-bugfix transformation (#28208)
The Safari 15 bugfix has been rolled into @babel/preset-env in the most recent version, so we no longer need to carry our vendored copy.

This commit updates @babel/preset-env, runs npx yarn-deduplicate yarn.lock, and removes the vendored transform.

This commit also refactors our theme transpiler to use @babel/preset-env, with the same list of target browsers as our ember-cli build uses. This means we no longer need to maintain a separate list of babel transforms for themes.
2024-08-05 10:35:26 +01:00
Ted Johansson
6d1c2a3d5a
FIX: Don't clear inline problems when loading admin dashboard (#28220)
We support a low-level construct called "inline checks", which you can use to register a problem ad-hoc from within application code.

Problems registered by inline checks never show up in the admin dashboard, this is because when loading the dashboard, we run all realtime checks and look for problems. Because of an oversight, we considered inline checks to be "realtime", causing them to be run and clear their problem status.

To fix this, we don't consider inline checks to be realtime, to prevent them from running when loading the admin dashboard.
2024-08-05 11:45:55 +08:00
Krzysztof Kotlarek
300ef67481
UX: move admin flag form to form-kit (#28187)
Rewrite the admin flag form to use FormKit. This is a draft because waiting for Checkbox improvements.
2024-08-05 11:01:25 +10:00
Sérgio Saquetim
4167862a05
DEV: Catch transformer errors and improve warnings (#28205) 2024-08-02 15:58:13 -03:00
David Taylor
1b2e0e86f8
FIX: Further improvements to // handling (#28211)
Followup to f70a65ea02

1. Update a second regex in `routeTo` to avoid stripping domain/protocol from middle of string

2. Update `URL.handleURL` to strip double-slashes in paths, before calling the ember router. This mimics what Ember does on initial page-load

Additional tests are added for both
2024-08-02 18:11:11 +01:00
Keegan George
18ac600352
DEV: Add stacked line chart mode (#28203) 2024-08-02 09:40:27 -07:00
David Taylor
f70a65ea02
FIX: Do not strip // from the middle of URLs in discourse-url (#28210)
Protocol/domain should only be stripped when they occur at the beginning of a URL
2024-08-02 16:23:54 +01:00
Natalie Tay
624dc87321
DEV: Avoid initializing max_image_size_kb in initializer (#28209)
Since this might initialize to the default db's values
rather than that of the site.
2024-08-02 23:15:14 +08:00
David Battersby
6ec8728ebf
DEV: refactor live notifications setting in user preferences (#28145)
This change is mainly a refactor of the desktop notifications service to improve readability and have standardised values for tracking state for current user in regards to the Notification API and Push API.

Also improves readability when handling push notification jobs, especially in scenarios where the push_notification_time_window_mins site setting is set to 0, which will allow sending push notifications instantly.
2024-08-02 17:25:15 +04:00
David Taylor
7977ae61f7
FIX: Update do-not-disturb icon in real-time on glimmer header (#28200)
To achieve this, a new notifications service is set up with an `isInDoNotDisturb` tracked property. While a user is in do-not-disturb mode, it runs a regular timer until do-not-disturb is over.
2024-08-02 08:55:51 +01:00
David Taylor
11369018b6
DEV: Stop storing theme-transpiler on filesystem in development (#28198)
We were writing theme-transpiler JS files to the filesystem on a per-process basis, and then immediately reading them back in. Plus, there was no cleanup mechanism, so the tmp directory would grow indefinitely.

This commit refactors things so that the `build.js` script outputs the theme-transpiler source to stdout. That way, we can read it directly into the process, and then into mini-racer, without needing to go via the filesystem. No cleanup required!

In production, the theme-transpiler is still cached in a file during `assets:precompile`
2024-08-01 17:59:34 +01:00
David Taylor
87450f677b
DEV: Resolve observes deprecation in full-page-search (#28196) 2024-08-01 15:47:33 +01:00
Joffrey JAFFEUX
8b61aafe74
FIX: correct return isForever value (#28194)
Following a refactor we forgot to return the value.
2024-08-01 16:06:26 +02:00
Joffrey JAFFEUX
a6eba4b203
DEV: prevents chrome to ask for fav search engine (#28192) 2024-08-01 15:49:07 +02:00
Joffrey JAFFEUX
4998c7be50
DEV: typo in variable name (#28193)
Note this had no behavior impact, as the computed property was correct.
2024-08-01 15:47:02 +02:00
Martin Brennan
77081de027
FIX: Badge image uploader (#28188)
In the formkit conversion in 2ca06ba236
we missed setting a type for the UppyImageUploader for badges. Also,
we were not passing down the `image_url` as form data, so when we used
`data.image` for that field the badge was not updating in the UI after
page loads and the image URL was not loading for preview.

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-08-01 15:36:17 +02:00
David Taylor
492a45da37
DEV: Introduce home-logo-image-url value transformer (#28189)
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-08-01 13:43:18 +01:00
Joffrey JAFFEUX
5357f0175e
DEV: moves version to the top (#28190)
The version is a very important info of the file and it's currently lost in the middle of the file. I think it makes sense to have it at the top.
2024-08-01 14:29:45 +02:00
dependabot[bot]
4c13ad5f60
Build(deps-dev): Bump @swc/core from 1.7.3 to 1.7.4 (#28182)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.3 to 1.7.4.
- [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.3...v1.7.4)

---
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-01 12:06:12 +01:00
David Taylor
fc02b4904d
DEV: Convert core controllers to native class syntax (batch 2) (#28179)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-01 12:03:17 +01:00
David Taylor
608e5682e2
DEV: Drop unused legacy modal controller/mixin (#28175) 2024-08-01 10:18:50 +01:00
David Taylor
8c4db0d2f8
DEV: Convert core controllers to native class syntax (batch 1) (#28177)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-01 10:18:36 +01:00
Sérgio Saquetim
7b14cd98c7
DEV: Add behavior transformers (#27409)
This commit introduces the `behaviorTransformer` API to safely override behaviors defined in Discourse.

Two new plugin APIs are introduced:

- `addBehaviorTransformerName` which allows plugins and theme-components to add a new valid transformer name if they want to provide overridable behaviors;
- `registerBehaviorTransformer` to register a transformer to override behaviors.

It also introduces the function `applyBehaviorTransformer` which can be imported from `discourse/lib/transformer`. This is used to mark a callback containing the desired behavior as overridable and applies the transformer logic.

How does it work?

## Marking a behavior as overridable:
 
To mark a behavior as overridable, in Discourse core, first the transformer name must be added to `app/assets/javascripts/discourse/app/lib/transformer/registry.js`. For plugins and theme-components, use the plugin API `addBehaviorTransformerName` instead.

Then, in your component or class, use the function `applyBehaviorTransformer` to mark the Behavior as overridable and handle the logic:

- example:

```js
  ...
  @action
  loadMore() {
    applyBehaviorTransformer(
      "discovery-topic-list-load-more",
      () => {
        this.documentTitle.updateContextCount(0);
        return this.model
          .loadMore()
          .then(({ moreTopicsUrl, newTopics } = {}) => {
            if (
              newTopics &&
              newTopics.length &&
              this.bulkSelectHelper?.bulkSelectEnabled
            ) {
              this.bulkSelectHelper.addTopics(newTopics);
            }
            if (moreTopicsUrl && $(window).height() >= $(document).height()) {
              this.send("loadMore");
            }
          });
      },
      { model: this.model }
    );
  },
  ...	
```

## Overriding a behavior in plugins or themes

To override a behavior in plugins, themes, or TCs use the plugin API `registerBehaviorTransformer`:

- Example:

```js
withPluginApi("1.35.0", (api) => {
  api.registerBehaviorTransformer("example-transformer", ({ context, next }) => {
    console.log('we can introduce new behavior here instead', context);

    next(); // call next to execute the expected behavior
  });
});
```
2024-07-31 16:39:22 -03:00
David Taylor
5388f0a48f
DEV: Convert components/admin-user-field-item to native class (#28174)
This was the last classic class in the `admin/` section 🎉
2024-07-31 19:06:59 +01:00
David Taylor
fa6dbbed1b
DEV: controllers/admin-site-text-edit to native class syntax (#28173) 2024-07-31 17:37:24 +01:00
David Taylor
d4479eab73
DEV: Remove object-property-decorators from admin mixins (#28172)
Ember's legacy mixin system does not support native-class syntax, so we have to use the non-decorator syntaxes for `action()` and `computed()`.

Eventually, we will need to refactor things to remove these mixins... but today is not that day.
2024-07-31 17:37:15 +01:00
Joffrey JAFFEUX
9383143bc6
FIX: system badges can be disabled (#28169)
A previous commit mistakenly assumed system badges couldn't be disabled.
2024-07-31 15:28:59 +02:00
carson chang
46b296527b
DEV: Add user-stream-item-above and bookmark-list-before-link plugin outlets (#28151)
* DEV: Add `user-stream-item-above` and `bookmark-list-before-link` plugin outlets

* Lint
2024-07-30 20:43:51 -07:00
carson chang
fa3f50efd0
UX: Hide/show preview button title attribute fix (#28155) 2024-07-30 20:43:12 -07:00