Commit Graph

28103 Commits

Author SHA1 Message Date
0a33c507d9 DEV: Improve colocated component rootName logic (#18708)
The complex regex-based detection was based on Ember CLI's implementation, which is necessarily generic and needs to auto-detect the name. In our case, we know the name of the plugin so we can just pass it in - no need for dynamic detection. This resolves issues when there are other files in the `discourse/plugins/{name}` directory which are sorted before `discourse/`
2022-10-21 20:20:46 +01:00
db0dbdf89a DEV: add plugin outlet to sidebar footer (#18707) 2022-10-21 15:07:12 -04:00
414d3b8185 A11Y: Add title to drafts remove icon button (#18706) 2022-10-21 14:32:58 -04:00
28bb81b50a A11Y: Add for attributes for location, website in profile (#18705) 2022-10-21 14:32:45 -04:00
c937b6dd36 FIX: set max-width on category logo img (#18703) 2022-10-21 12:01:26 -04:00
7e23662a44 DEV: Remove unneeded templateOnly() stubs (#18701)
Lone hbs files in the `/components` are automatically assumed to be template-only Glimmer components. The `templateOnly()` stub is only required when templates are in the `/templates/components` directory.
2022-10-21 15:12:53 +01:00
5827d1eecc Build(deps): Bump @babel/standalone from 7.19.3 to 7.19.6 in /app/assets/javascripts (#18689)
Bumps [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone) from 7.19.3 to 7.19.6.
- [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.19.6/packages/babel-standalone)

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

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

* Tweak whitespace expectations in tests

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Taylor <david@taylorhq.com>
2022-10-21 14:48:27 +01:00
290da76981 Build(deps): Bump @babel/core in /app/assets/javascripts (#18687)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.19.3 to 7.19.6.
- [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.19.6/packages/babel-core)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-21 14:47:04 +01:00
d379edec8d FIX: Clientside checks for personal_message_enabled_groups (#18691)
The clientside allowPersonalMessages function introduced
in e62e93f83a77adfa80b38fbfecf82bbee14e12fe sometimes did not
work correctly, because the currentUser.groups property
only contained **visible** groups for the current user, which
could exclude auto groups that had their permissions set to
be owner-only visible.

It was unnecessary to add this anyway since we already have
can_send_private_messages on the CurrentUserSerializer. It's
better the backend does this calculation anyway. Use that
in the clientside code instead and get rid of allowPersonalMessages
2022-10-21 14:38:33 +10:00
a14825836f UX: Show category edit button when in tag intersection (#18679)
Given that the category structure is generally speaking the backbone of most Discourse instances, it makes sense to show the edit button for the category even when the user is in a category/tag intersection route.
2022-10-20 15:04:21 -04:00
ab217d8ae0 FIX: set width on category logo img, not container (#18676) 2022-10-20 13:20:17 -04:00
3e6b22db69 A11Y: Sortable header elements should have pointer (#18672) 2022-10-20 09:28:03 -07:00
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
ce53152e53 DEV: Include theme_uploads and theme_uploads_local objects in theme tests (#18645)
Our theme system injects a magical `settings` object at the top of themes JS modules to allow theme authors to access the settings as configured by admins in the UI. Within this `settings` object, there are a couple of special objects `theme_uploads` and `theme_uploads_local` that contain URLs for all the assets/uploads that the theme has.

For test modules/files, the theme system also injects a `settings` object at the top of tests modules, but it's not the same object as the object that's injected in non-test files. The difference is that in tests we want the settings to have their default values as opposed to any custom values that may exist in the site's database. This ensures that test results are consistent no matter the site that runs them.

However, the `settings` object in tests files currently doesn't have the special objects `theme_uploads` and `theme_uploads_local` which means that if a theme includes an asset that's lazy-loaded, it's not possible to write tests for anything that depends on the lazy-loaded asset because the theme will not be able to load the asset during the tests since `theme_uploads_local` and `theme_uploads` don't exist. This PR adds these special objects inside the `settings` object for test files.

Internal topic: t/71825/52.
2022-10-20 08:00:29 +03:00
505aec123f FEATURE: Hide welcome topic if it hasn't been edited (#18632) 2022-10-19 20:01:36 -06:00
66904f2cd2 FEATURE: Add button to reset seen popups (#18586) 2022-10-20 09:06:39 +08:00
f1f2c1acd4 UX: extend horizontal user nav to all user pages (#18674) 2022-10-20 09:05:51 +08:00
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
9a4072fe31 DEV: Load plugin CSS in tests (#18668) 2022-10-19 18:10:06 +01:00
a96f22cd67 FIX: Calculate header offset once on load (#18669)
Multiple things in the app need the height of the header to be correct (for example, scrolling to a post), so we need the header offset calculation. However, we shouldn't be calculating it on scroll, it's too resource intensive and it causes flickering on iPads (and possible other devices too).

This commit removes header offset calculation on scroll and adds a one-time calculation as soon as the header is first rendered. This ensures that users get scrolled to the correct post even if they open it in a new tab.
2022-10-19 12:07:44 -04:00
58e59e3579 DEV: Remove all use of Ember/jQuery globals in core (#18670) 2022-10-19 17:04:49 +01:00
91b991320c DEV: Enable ember-qunit's TestIsolationValidation feature (#18666)
This ensures ember's runloop is settled before starting the next test.
2022-10-19 12:07:04 +01:00
8d3fe3ddc5 DEV: Bump theme compiler version for connector fix (#18665)
This should have been included in c185043590f931c7185ccbec33eb0bd2d77d764d
2022-10-19 10:52:39 +01:00
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
a705e4815f FIX: do not include group less emojis in standard list (#18659) 2022-10-19 09:53:56 +02:00
437de6338e DEV: add currentPath arg to above-site-header plugin outlet 2022-10-18 21:25:46 -07:00
7c25597da2 FEATURE: Generic hashtag autocomplete part 1 (#18592)
This commit adds a new `/hashtag/search` endpoint and both
relevant JS and ruby plugin APIs to handle plugins adding their
own data sources and priority orders for types of things to search
when `#` is pressed.

A `context` param is added to `setupHashtagAutocomplete` which
a corresponding chat PR https://github.com/discourse/discourse-chat/pull/1302
will now use.

The UI calls `registerHashtagSearchParam` for each context that will
require a `#` search (e.g. the topic composer), for each type of record that
the context needs to search for, as well as a priority order for that type. Core
uses this call to add the `category` and `tag` data sources to the topic composer.

The `register_hashtag_data_source` ruby plugin API call is for plugins to
add a new data source for the hashtag searching endpoint, e.g. discourse-chat
may add a `channel` data source.

This functionality is hidden behind the `enable_experimental_hashtag_autocomplete`
flag, except for the change to `setupHashtagAutocomplete` since only core and
discourse-chat are using that function. Note this PR does **not** include required
changes for hashtag lookup or new styling.
2022-10-19 14:03:57 +10:00
45bdfa1c84 FIX: sidebar_list_destination on CurrentUserSerializer (#18660)
Before, `sidebar_list_destination` was an attribute on UserOptionSerializer. The problem was that this attribute was added to user model only when the user entered the preferences panel. We want that attribute to be available all the time, therefore it was moved to CurrentUserSerializer.
2022-10-19 11:48:36 +11:00
99d9c933c6 FIX: ensure dropdown is above sibling labels (#18658) 2022-10-18 18:18:23 -04:00
dcbfbbf19d A11Y: Add aria-label to topic post badges (#18657) 2022-10-18 15:14:27 -07:00
a8af510636 A11Y: Return focus to header search button upon escape of search (#18656) 2022-10-18 15:01:09 -07:00
799fa8d6f9 FIX: sidebar list destination for tracked and tags (#18639)
Follow up for https://github.com/discourse/discourse/pull/18594

Same solution for tracked and tag links.
2022-10-19 08:19:50 +11:00
8791b6d5ee A11Y: Improve group search accessibility (#18651) 2022-10-18 12:55:44 -07:00
d25ca2a468 FIX: Exclude hidden topic posts and small actions from the RSS feed. (#18649)
This commit excludes posts from hidden topics from the latest posts and user activity RSS feeds. Additionally, it also excludes small actions from the first one.
2022-10-18 15:19:54 -03:00
5c7d951330 FIX: User card focus state appearing on click (#18650) 2022-10-18 11:15:42 -07:00
83c43bae2a A11Y: Improve user card appearance in WHCM (#18648) 2022-10-18 11:05:14 -07:00
a2596fb306 A11Y: Add aria labels for posts in group activity (#18601)
This view can show multiple posts from the same topic and the aria labels
will now include the post number to more easily differentiate posts in
screen readers.
2022-10-18 13:58:26 -04:00
897bcacdda A11Y: Improve topic timeline in WHCM (#18647) 2022-10-18 10:35:01 -07:00
be3d6a56ce DEV: Introduce minification and source maps for Theme JS (#18646)
Theme javascript is now minified using Terser, just like our core/plugin JS bundles. This reduces the amount of data sent over the network.

This commit also introduces sourcemaps for theme JS. Browser developer tools will now be able show each source file separately when browsing, and also in backtraces.

For theme test JS, the sourcemap is inlined for simplicity. Network load is not a concern for tests.
2022-10-18 18:20:10 +01:00
e23b247690 UX: Fix alt text cancel button in dark mode (#18644) 2022-10-18 09:40:29 -07:00
f7fdaa97d1 DEV: Replace mini-loader with Ember's loader.js library (#18643)
We already have this as a dependency, so it makes sense to use it rather than using our own not-quite-spec-compliant implementation
2022-10-18 14:53:06 +01:00
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
cb87067c77 DEV: Introduce support for template colocation in themes 2022-10-18 10:10:49 +01:00
65a5c84a92 DEV: perform theme extra_js compilation all together
Previously, compiling theme 'extra_js' was done with a number of steps. Each theme_field would be compiled into its own value_baked column, and then the JavascriptCache content would be built by concatenating all of those compiled values.

This commit streamlines things by removing the value_baked step. The raw value of all extra_js theme_fields are passed directly to the ThemeJavascriptCompiler, and then the result is stored in the JavascriptCache.

In itself, this commit should not cause any behavior change. It is designed to open the door to more advanced compilation features which have interdependencies between different source files (e.g. template colocation, sourcemaps).
2022-10-18 10:10:49 +01:00
9879cb0e68 FIX: Clarify security key copy (#18636)
In user preferences, we want to make it more obvious
that a security key is a physical device, and also
you can use your phone.
2022-10-18 16:30:48 +10:00
243efa8931 FEATURE: allow user to set preferred sidebar list destination (#18594)
User can choose between latest or new/unread and that preference will affect behavior of sidebar links.
2022-10-18 13:21:52 +11:00
daa8aedccf Revert "UX: Simplify bootstrap mode visuals (#18626)" (#18638)
This reverts commit 868ab26fb3fd9be83c7925d96b500896a0065835.
2022-10-18 13:19:15 +11:00
a6d5b82886 Revert "UX: Change button to grey (#18635)" (#18637)
This reverts commit 0fe9095bad30ee9a4a15d60b95da77f291e6acaa.
2022-10-18 13:18:11 +11:00
4907b7fa1d DEV: Listen for escape key on hamburger & user menu (#18629) 2022-10-18 09:36:18 +08:00
b8fcf1932e A11Y: Bookmarks modal (#18630)
* A11Y: Add label to delete button

* A11Y: Add title attribute to options button
2022-10-18 09:34:02 +08:00