Commit Graph
100 Commits
Author SHA1 Message Date
Jarek Radosz 7c74e4882a FIX: Don't set categoryId on PM drafts (#20475) 2023-03-01 11:32:12 +01:00
Jarek Radosz ddbe6cf3b5 DEV: Remove site setting "diags" (#20481)
Added almost exactly 10 years ago (in a2cca2540e), I don't think they're useful anymore 😅
2023-03-01 11:31:57 +01:00
Jarek Radosz 007cce62e6 DEV: Clean up settings component (#20485)
Async, modern syntax, no `on()` component hooks, const extraction, sorted props, template tweaks, and a small filtering bugfix (filtering could throw errors after saving a category-selection setting)
2023-03-01 10:12:39 +01:00
Jarek Radosz c81d4f60af UX: Fix large onebox avatars in img chat messages (#20469)
When you included an image and a full-line (github) onebox in a single message the user avatar in the inbox would be incorrectly embiggened.
2023-02-27 23:03:02 +01:00
Jarek Radoszanddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 116781c748 DEV: Update ember-cli-htmlbars to 6.2.0 (#20467)
* Build(deps): Bump ember-cli-htmlbars in /app/assets/javascripts

Bumps [ember-cli-htmlbars](https://github.com/ember-cli/ember-cli-htmlbars) from 6.1.1 to 6.2.0.
- [Release notes](https://github.com/ember-cli/ember-cli-htmlbars/releases)
- [Changelog](https://github.com/ember-cli/ember-cli-htmlbars/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-cli-htmlbars/compare/v6.1.1...v6.2.0)

---
updated-dependencies:
- dependency-name: ember-cli-htmlbars
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Load additional files

* Update code

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-27 18:43:28 +01:00
Jarek Radosz f63d18d6ca DEV: Update syntax_tree to 6.0.1 (#20466) 2023-02-27 17:20:00 +01:00
Jarek Radosz badd40090f DEV: Clean up d-modal (#20443) 2023-02-27 13:06:06 +01:00
Jarek Radosz 5a384e60ac DEV: Clean up showModal() calls (#20442) 2023-02-24 15:53:04 +01:00
Jarek Radosz d5cf128dbd DEV: Fix an error in topic deletion (#20440)
Spotted as log entry in tests:

```
TypeError: Cannot read properties of undefined (reading 'force_destroy')
```
2023-02-24 13:48:08 +01:00
Jarek Radosz 04659b0e41 DEV: Fix decorator deprecations (#20438)
…and correctly fix the decorateCookedElement id arg
2023-02-24 10:50:52 +01:00
Jarek Radosz 2867c5b8f5 DEV: Add digest to licensed's default gems list (#20355) 2023-02-18 11:34:13 +01:00
Jarek Radosz 3c6e3173cd FIX: Glimmer component arg access (#20354)
This regressed in b94fa3b87a as the component was migrated to a glimmer component.
2023-02-18 10:59:28 +01:00
Jarek Radosz 9519747a01 FIX: Correctly update _subscribedTo* props (#20351)
`_subscribedToChat` was previously a never-true, and `_subscribedToCore` once set to false could no longer be flicked back to true.
2023-02-17 21:45:21 +01:00
Jarek Radosz c541bd05a8 DEV: Add missing decorateCookedElement id (#20330)
Fixes "`decorateCooked` should be supplied with an `id` option to avoid memory leaks in test mode. The id will be used to ensure the decorator is only applied once." warnings
2023-02-16 13:58:23 +01:00
Jarek Radosz 2d99e508c6 DEV: Add a plugin outlet for admin upgrade-header (#20274) 2023-02-14 00:03:46 +01:00
Jarek RadoszandDavid Taylor 0dbb089b47 FIX: Don't spam presence requests when getting 429 (#20084)
The presence service would retry `/presence/update` requests every second (or immediately in tests) in case where server returns 429 (rate limit) errors. That could lead to infinite spamming (until user refreshed tab/tabs)

Co-authored-by: David Taylor <david@taylorhq.com>
2023-01-31 09:49:23 +01:00
Jarek Radosz 7c1e1ef72b DEV: Convert presence service tests to actual unit tests (#20076) 2023-01-30 23:31:39 +01:00
Jarek Radosz 17deb79fcb DEV: Fix random typos (#19973) 2023-01-24 15:41:01 +01:00
Jarek Radosz 5cc4424f4b DEV: Update .editorconfig to match new hbs rules (#19816) 2023-01-10 16:21:16 +01:00
Jarek Radosz ff508d1ae5 FIX: Correctly support DiscourseEvent kwargs (#19788)
Fixes the support for kwargs in `DiscourseEvent.trigger()` on Ruby 3, e.g.

```rb
DiscourseEvent.trigger(:before_system_message_sent, message_type: type, recipient: @recipient, post_creator_args: post_creator_args, params: method_params)
```

Fixes https://github.com/discourse/discourse-local-site-contacts
2023-01-09 11:26:39 +01:00
Jarek Radosz 1174a94867 DEV: Update json5, remove an unused lockfile (#19732) 2023-01-04 23:15:49 +01:00
Jarek Radosz 60402f2b34 DEV: Label and ignore all default gems (#19617)
`licensed` fails to find gem's license if it's a default gem (see: https://stdgems.org) and the version you're requiring comes with the ruby version you're using.

A ruby upgrade or any change to Gemfile could trigger `licensed` failures, so it's better to ignore all default gems we're using.
2022-12-24 11:59:08 +01:00
Jarek Radosz 6f4cf81401 DEV: Update bundler licensed config (#19607)
1. Add `cgi` (ruby terms)
2. Move `strscan`, ~~`ruby2_keywords`, and `openssl`~~ to "reviewed" section (update: two of those are postponed, need to debug stuff in our docker image)
3. Sort
2022-12-23 14:04:03 +01:00
Jarek Radosz 953b823c5a DEV: Deprecate controllerFor test helper (#19606)
After all the test changes it was only used in a single place in core 🤷

(also updated the recommendation in `assert.not` deprecation message)
2022-12-23 11:33:42 +01:00
Jarek Radosz dc3473fe06 DEV: Modernize chat's component tests (#19577)
1. `test()` and `render()` instead of `componentTest()`
2. Angle brackets
3. `strictEqual()`/`true()`/`false()` assertions

This removes all remaining uses of `componentTest` from core
2022-12-22 14:35:18 +01:00
Jarek Radosz 263cd02a27 DEV: Get rid of all discourseModule uses (#19576)
QUnit's `module` and `setupTest` is the way
2022-12-22 13:13:28 +01:00
Jarek Radosz dc13e8ecfd DEV: Fix TurboTests::Runner fail_fast condition (#19540)
It fast-failed after the first failure regardless of the param…
2022-12-21 02:33:52 +01:00
Jarek Radosz e775ed1c36 DEV: Properly include spec examples (#19532)
It was redefining rather than including them. It was causing this warning:

```
WARNING: Shared example group suspension of active user possible was defined without a block and will have no effect. Please define a block or remove the definition
```
2022-12-21 05:28:03 +08:00
Jarek Radosz fd405179a7 DEV: Modernize the remaining admin-webhooks parts (#19438) 2022-12-13 13:32:34 +01:00
Jarek Radosz 0671a95cd6 FIX: GitHub onebox ellipsis styling regressed in 9d03f20 (#19441) 2022-12-13 12:01:48 +01:00
Jarek Radosz f9bdda84ca DEV: Admin webhooks interface issues (#19360)
1. The events table had broken styling, making each row overflow
2. It had confusing routes: `/:id` for "edit" and `/:id/events` for "show" (now it's `/:id/edit` and `/:id` respectively)
3. There previously was an unused backend action (`#edit`) - now it is used (and `web_hooks/:id/events` route has been removed)
4. There was outdated/misplaced/duplicated CSS
5. And more
2022-12-13 01:53:08 +01:00
Jarek Radosz 19214aff18 DEV: Clean up all message bus subscriptions (#19268)
1. "What Goes Up Must Come Down" – if you subscribe to message bus, make sure you also unsubscribe
2. When you unsubscribe - remove only your subscription, not **all** subscriptions on given channel

Attempt #2. The first attempt tried to extend a core `@bound` method in new-user-narrative plugin which did not work. I reworked that plugin in the meantime. This new PR also cleans up message bus subscriptions in now core-merged chat plugin.
2022-12-12 16:32:25 +01:00
Jarek Radosz 93a4012ecb DEV: Drop helper context setup in tests (#19423) 2022-12-12 15:20:48 +01:00
Jarek Radosz 2a4fea4372 FIX: Multipart uppy upload regression in 80e422c (#19424) 2022-12-12 13:39:40 +01:00
Jarek Radosz 0464f9d2be DEV: Prefer site injection over import (#14982)
And in helpers use `helperContext().site`
2022-12-12 12:53:55 +01:00
Jarek Radosz 80e422cea3 DEV: Update uppy to 3.x (#18219) 2022-12-12 12:08:57 +01:00
Jarek Radosz 22cae0022a FIX: Admin webhook regression in 321b14d (#19379)
In the meantime, before #19360 lands.
2022-12-08 11:57:04 +01:00
Jarek Radosz d3649873a2 DEV: Replace preferences/username route with a component (#19318)
That was a weird UX (why hide the preferences navigation?) and a deprecated implementation (manually rendering a template into a named outlet)

This PR replaces it with an inline component.
2022-12-07 11:16:01 +01:00
Jarek Radosz 5c9bb73ffe DEV: Remove discobot pm scrolling code (#19300)
1. Originally the feature did "Scroll to new posts when user is near bottom of PM" (74e1889924)
2. Then that feature was limited to "Only scroll to posts that are not your own in PMs." (4a26561927)
3. It was limited further to "Only scroll PMs on new message" (eaf7746ec9)
4. And later to "only scroll to bottom for discobot" (267d129f38)
5. And the code was relegated to new-user-narrative plugin (48b7696dbc)

I don't think it's worth it to keep this scrolling code just for this very small specific case.

This did potentially confict with other post scrolling code, and also using `modifyClass` is something we'd like to avoid.
2022-12-03 18:35:54 +01:00
Jarek Radosz ef31c7df63 DEV: Remove unused new-user-narrative code (#19299)
This method override was misnamed from the beginning and nobody noticed that this special bookmark handling was missing so…
2022-12-02 17:46:49 +01:00
Jarek Radosz 49e0fc04f7 Revert "DEV: Clean up all message bus subscriptions (#18675)" (#19267)
This reverts commit b0839ccf27.
2022-11-30 16:29:10 +00:00
Jarek Radosz 6a389fd15a FIX: ScrollingPostStream regressed in #15313 (#18584)
regression commit: bec76f937c

In case when the user navigates away between async actions that code would error out on a missing element. This adds a simple sanity check.
2022-11-30 16:55:30 +01:00
Jarek Radosz b0839ccf27 DEV: Clean up all message bus subscriptions (#18675)
1. "What Goes Up Must Come Down" – if you subscribe to message bus, make sure you also unsubscribe
2. When you unsubscribe - remove only your subscription, not **all** subscriptions on given channel
2022-11-30 16:49:51 +01:00
Jarek Radosz 321b14d40c DEV: Remove unused render() calls (#19224)
`Route#render` and `Route#renderTemplate` have been deprecated and are removed in Ember 4.x (see: https://deprecations.emberjs.com/v3.x#toc_route-render-template)

The templates of modified routes in this PR are already automatically inserted into `{{outlet}}`s.
2022-11-30 16:49:23 +01:00
Jarek Radosz 57a573eee3 DEV: Update terser (#19109)
The `decodedMap` prop comes from https://github.com/terser/terser/pull/1190

> This also exposes a new `decodedMap` property on the result object. Decoded maps are free to create (it's a shallow clone of the `GenMapping` instance), and passing them to `@jridgewell/trace-mapping` is copy-free. With Babel [recently](https://github.com/babel/babel/pull/14497) adding a `decodedMap` field, a dev could pass from the Babel transpilation to Terser without any added memory use for sourcemaps.
2022-11-24 17:15:46 +01:00
Jarek Radosz 4f12fd0339 DEV: Modernize model tests (#19104)
Uses `module()` instead of `discourseModule()`, native getters instead of `.get()`, fixes some assertions, uses the store instead of creating models directly
2022-11-18 20:36:32 +01:00
Jarek Radosz 0f36fcdecd DEV: Move the recently added dev-deps to deps (#19103)
Fixes the production build
2022-11-18 11:45:52 +01:00
Jarek Radosz 213adab1ea DEV: Update ember-qunit to 6.0.0 (#19080)
Long story short - bumping ember-qunit upgrades webpack, and sinon is not compatible with webpack v5. It uses node's `util` module and that is no longer polyfilled by webpack by default.

This PR adds the `util` polyfill (😑, but what can you do) and also injects a stub of `process` (so polyfill + sinon actually work)
2022-11-18 10:45:39 +01:00
Jarek Radosz 032a4f5dce DEV: Bump chrome-launcher (#19082) 2022-11-18 07:03:05 +08:00
Jarek Radosz 4548ddf560 DEV: Bump chrome-remote-interface (#19083) 2022-11-18 06:21:10 +08:00
Jarek Radosz cccb6e9b0b DEV: Bump Dependabot's bundler PR limit (#19081) 2022-11-17 21:48:13 +01:00
Jarek Radosz 4cbb811988 DEV: Add dark theme support to QUnit (#19014) 2022-11-17 18:44:44 +01:00
Jarek RadoszandDavid Taylor 59f1d01381 DEV: Convert SiteSettings to a tracked object (#19015)
TrackedObject allows us to reference SiteSettings in autotracking contexts (e.g. JS getters referenced from a Glimmer template) without the need for EmberObject's `get()`  function. TrackedObject is backwards-compatible with Ember's legacy reactivity model, so it can be referenced in things like computed properties.

Co-authored-by: David Taylor <david@taylorhq.com>
2022-11-17 18:44:23 +01:00
Jarek Radosz 33816bbaa9 DEV: Bump @mixer/parallel-prettier (#19053) 2022-11-16 21:38:57 +01:00
Jarek Radosz d2a8884127 DEV: Bump pikaday (#19060) 2022-11-16 18:59:15 +01:00
Jarek Radosz a7b033d642 DEV: Update node-fetch (#19059)
node-fetch is now a ES module, so it has to either imported with `import/from` syntax (which can't be used in addon's index.js) or using the dynamic `import()`
2022-11-16 18:58:38 +01:00
Jarek Radosz d85f53fa94 DEV: Update moment-timezone (#19052) 2022-11-16 16:57:40 +01:00
Jarek Radosz 99dfdf70e8 DEV: Make dialog-holder a monorepo package (#19051) 2022-11-16 16:43:45 +01:00
Jarek Radosz cfd610cc7c DEV: Make bootstrap-json a monorepo package (#19048) 2022-11-16 11:58:10 +01:00
Jarek Radosz 9bf95d472d DEV: Move shouldLoadPluginTestJs() (#19045)
A first step in the effort to depend only on explicitly declared dependencies in package.json.
2022-11-16 11:07:58 +01:00
Jarek Radosz 25aa0bc10d DEV: Deprecate create-store test helper (#19021)
Use the regular Store service instead.
2022-11-16 10:54:46 +01:00
Jarek Radosz 8e60c50f60 DEV: Fix a flaky spec (#18995)
topic.posts is not ordered by any column by default
2022-11-16 10:46:30 +01:00
Jarek Radosz 5b16546358 DEV: Refactor _warnCannotSeeMention() (#19042) 2022-11-16 10:33:47 +01:00
Jarek Radosz bd38b6dcc1 DEV: Fix a theme_js spec (#19043)
It was failing in the local env
2022-11-16 16:12:17 +08:00
Jarek Radosz 5c4a2d428a DEV: Make the setupTests a regular import (#19046) 2022-11-16 16:11:18 +08:00
Jarek Radosz 4a49c22780 DEV: Make more dependencies explicit (#19047) 2022-11-16 16:10:58 +08:00
Jarek Radosz 2325bec3c9 DEV: Skip a flaky FF test (#18996)
On Firefox Evergreen this upload test often fails, because the order of uploads in markdown is somehow reversed.
2022-11-14 12:16:00 +01:00
Jarek Radosz e54a3d5ea9 DEV: Add START_ID to uploads:downsize task (#18992) 2022-11-11 22:51:48 +01:00
Jarek Radosz dc8a7e74f4 FIX: Allow attr updates of over-size-limit uploads (#18986) 2022-11-11 17:56:11 +01:00
Jarek Radosz bc22fe4fdf DEV: Convert the downsizing script to a rake task (#18976)
…to make it testable!
2022-11-11 13:00:44 +01:00
Jarek Radosz 3e0196cbbf FIX: Shrinking images where smaller image upload exists (#18965) 2022-11-10 12:43:56 +01:00
Jarek Radosz a5099c72a7 DEV: Use store to create Post records in tests (#18920) 2022-11-08 18:13:45 +01:00
Jarek Radosz d2ea39c932 Revert "FEATURE: when entering a topic scroll to last visited line marker (#18440)" (#18917)
This reverts commit 136174e0ee.

That worked only 50% of the time (at best), as it was conflicting with other topic-view scrolling code. The reverted feature will eventually be restored as I continue to fix scroll-related issues.
2022-11-08 10:32:21 +01:00
Jarek Radosz 6e5e696c0b DEV: Make modifyClass native class-aware, add tests (#16111) 2022-11-03 18:10:08 +01:00
Jarek Radosz f61e36384f DEV: Use store.createRecord for Topic models (#18837)
…where possible
2022-11-03 12:32:20 +01:00
Jarek Radosz fc107be63f FIX: Correct the post numbers in lastUnreadUrl (#18831)
Previously when a topic had e.g. 10 posts and you read them all, the link to the "first unread" would be `/11`, even when we knew there are only 10. (the topic route/controller would then fix that in the location bar after a second if you followed that URL)
2022-11-02 10:49:10 +01:00
Jarek Radosz c32fe340f0 DEV: Fix mocha deprecations (#18828)
It now supports strict keyword argument matching by default.
2022-11-02 10:47:59 +01:00
Jarek Radosz b9bcb225f2 DEV: Fix qunit hook issue (#18829) 2022-11-02 10:46:52 +01:00
Jarek Radosz 45e8995eb1 DEV: Force testem upgrade (#18834)
1. Add `"testem": "latest"` to package.json
2. `yarn`
3. `npx yarn-deduplicate`
4. Remove the line from package.json
5. `yarn`
2022-11-02 10:45:17 +01:00
Jarek Radosz fa5f43e7c0 DEV: Delete old buffered-render attributes (#18786)
That mixin was removed in 1a31a403ce (January 2020)
2022-10-28 08:30:14 +08:00
Jarek Radosz a727476fb7 DEV: Revert topic loading async changes (#18757)
This reverts commits 2c5e8f1763 (#18585) and 589a249a65 (#18727)

Those changes caused race conditions with scroll-to-post/lockOn code.
2022-10-26 20:16:01 +02:00
Jarek Radosz f822a933fa DEV: Clean up pre-initializers (#18680) 2022-10-26 09:19:54 +08:00
Jarek Radosz 3949efb45f FIX: Reset error props on Topic model (#18739)
If there's an error loading a topic, and later you load it successfully - the the stale error message would still briefly show up every time you navigate to that topic
2022-10-25 12:17:00 +02:00
Jarek Radosz df56ab172a DEV: Remove remaining hardcoded ids (#18735) 2022-10-25 15:29:09 +08:00
Jarek Radosz 589a249a65 FIX: Correctly reset controllerReady prop (#18727) 2022-10-24 23:00:37 +02:00
Jarek Radosz ab330a98ad UX: Fix user status display in autocomplete (#18726)
A follow-up to c421dc0b28
2022-10-24 21:34:41 +02:00
Jarek Radosz c421dc0b28 UX: Improve autocomplete styling (#18723)
1. Restore the original text color (`--primary-high`)
2. Fix the double bottom border
3. Make the padding around icons even
2022-10-24 19:37:01 +02:00
Jarek Radosz 8304f40f84 FIX: Correctly debounce various functions (#18673)
Debouncing inline anonymous functions does not work.

This fixes all instances of that error by extracting the function or using the new `@debounce(delay)` decorator
2022-10-20 13:28:09 +02:00
Jarek Radosz 09e4eb4137 DEV: Introduce a @debounce(delay) decorator (#18667)
An example from tests:

```js
class TestStub {
  counter = 0;

  @debounce(50)
  increment() {
    this.counter++;
  }
}

const stub = new TestStub();

stub.increment();
stub.increment();
stub.increment();
await settled();

assert.strictEqual(stub.counter, 1);
```
2022-10-19 20:43:58 +02:00
Jarek Radosz a53eb0882a DEV: Prevent potential site state leaks in tests (#18663)
If one were to modify nested objects in `Site.current()` those changes would be carried over subsequent tests.
2022-10-19 11:46:01 +02:00
Jarek Radosz 43c2841a69 DEV: Switch back to mainline licensed gem (#18641)
The bundler issue has been fixed
2022-10-18 14:34:44 +02:00
Jarek Radosz b6297f5dd4 DEV: Remove the router testing hack (#18640)
Doesn't seem to be needed anymore (and it doesn't work anymore with some stuff I'm updating)
2022-10-18 14:34:33 +02:00
Jarek Radosz bdd0a98f38 DEV: Fix testem output (#18609)
Failed tests list we're displaying at the end had incorrect ids. e.g

```
(…)
ok 2160 Chrome 106.0 - [54 ms] - Integration | Component | select-kit/category-drop: caretUpIcon
ok 2161 Chrome 106.0 - [20 ms] - Unit | Service | store: find embedded

Used JS Heap Size: 7.304GB

1..2161
# tests 2161
# pass  2152
# skip  7
# todo  0
# fail  2

Failures:

not ok 2162 Chrome 106.0 - [36 ms] - Acceptance: Unknown: Permalink URL to a static page
    ---
        actual: >
            null
        message: >
            Promise rejected during "Permalink URL to a static page": no no
        negative: >
            false
        browser log: |
    ...
not ok 2163 Chrome 106.0 - [238 ms] - Unit | Utility | text: parseAsync
    ---
        actual: >
            null
        message: >
            Promise rejected during "parseAsync": nope
        negative: >
            false
        browser log: |
    ...
Testem finished with non-zero exit code. Tests failed.
```
2022-10-16 19:38:20 +02:00
Jarek Radosz a5156d18ff DEV: Modernize controller unit tests (#17412)
Aligns controller tests with the Ember standard, by using `module` and `setupTest` instead of our custom `discourseModule`)
2022-10-14 13:15:58 +02:00
Jarek RadoszandDavid Taylor 2c5e8f1763 DEV: Asyncify loadTopicView (#18585)
See https://github.com/discourse/discourse/pull/14838#issuecomment-1271935405 for details about `controllerReady` logic.

Co-authored-by: David Taylor <david@taylorhq.com>
2022-10-14 12:44:31 +02:00
Jarek Radosz 67e422c2d4 DEV: Remove noop CSS (#18564)
The lint warnings were:

```
inline-block is ignored due to the float. If 'float' has a value other than 'none', the box is floated and 'display' is treated as 'block'

scss(propertyIgnoredDueToDisplay)
```
2022-10-12 16:35:51 +02:00
Jarek Radosz a4437ab30b DEV: Fix FakeLogger compat (#18562)
TaggedLogger requires these methods (see plugin backend failures in #18534)
2022-10-12 16:06:00 +02:00
Jarek Radosz 4170b9bb58 DEV: Use more css vars (#18561)
Followup to #18518

This time it's mostly line-height vars and a couple of other uncommon vars.
2022-10-12 16:05:42 +02:00
Jarek Radosz ea326906e3 DEV: Use css var font sizes (#18518)
For consistency and and the ability to change all font sizes at once in the dev tools
2022-10-12 15:31:59 +02:00
Jarek Radosz b5005e3574 DEV: Always use non-builtin net-* and digest gems (#18560)
This will possibly fix the issue we're having with Dependabot. It seems it now uses a different ruby version (i.e. 3.1+)
2022-10-12 15:22:22 +02:00