Commit Graph

31184 Commits

Author SHA1 Message Date
David Taylor
40e4fe4423
FIX: Remove old 'wizard' js script (#24986)
This was causing errors for admins. Followup to cbc28e8e33
2023-12-20 14:01:43 +00:00
David Taylor
cbc28e8e33
Enable Embroider/Webpack code spliting for Wizard (#24919)
(extracted from #23678)

* Move Wizard back into main app, remove Wizard addon
* Remove Wizard-related resolver or build hacks
* Install and enable `@embroider/router`
* Add "wizard" to `splitAtRoutes`

In a fully optimized Embroider app, route-based code splitting more
or less Just Work™ – install `@embroider/router`, subclass from it,
configure which routes you want to split and that's about it.

However, our app is not "fully optimized", by which I mean we are
not able to turn on all the `static*` flags.

In Embroider, "static" means "statically analyzable". Specifically
it means that all inter-dependencies between modules (files) are
explicitly expressed as `import`s, as opposed to `{{i18n ...}}`
magically means "look for the default export in app/helpers/i18n.js"
or something even more dynamic with the resolver.

Without turning on those flags, Embroider behaves conservatively,
slurps up all `app` files eagerly into the primary bundle/chunks.
So, while you _could_ turn on route-based code splitting, there
won't be much to split.

The commits leading up to this involves a bunch of refactors and
cleanups that 1) works perfectly fine in the classic build, 2) are
good and useful in their own right, but also 3) re-arranged things
such that most dependencies are now explicit.

With those in place, I was able to move all the wizard code into
the "app/static" folder. Embroider does not eagerly pull things from
this folder into any bundle, unless something explicitly "asks" for
them via `imports`. Conversely, things from this folder are not
registered with the resolver and are not added to the `loader.js`
registry.

In conjunction with route-based code splitting, we now have the
ability to split out islands of on-demand functionalities from the
main app bundle.

When you split a route in Embroider, it automatically creates a
bundle/entrypoint with the relevant routes/templates/controllers
matching that route prefix. Anything they import will be added to
the bundle as well, assuming they are not already in the main app
bundle, which is where the "app/static" folder comes into play.

The "app/static" folder name is not special. It is configured in
ember-cli-build.js. Alternatively, we could have left everything
in their normal locations, and add more fine-grained paths to the
`staticAppPaths` array. I just thought it would be easy to manage
and scale, and less error-prone to do it this way.

Note that putting things in `app/static` does not guarantee that
it would not be part of the main app bundle. For example, if we
were to add an `import ... from "app/static/wizard/...";` in a
main bundle file (say, `app.js`), then that chunk of the module
graph would be pulled in. (Consider using `await import(...)`?)

Overtime, we can build better tooling (e.g. lint rules and babel
macros to make things less repetitive) as we expand the use of
this pattern, but this is a start.

Co-authored-by: Godfrey Chan <godfreykfc@gmail.com>
2023-12-20 13:15:06 +00:00
David Taylor
2f40d9b07b
DEV: Correct ember-5 lockfile generation (#24983)
The regen_ember_5_lockfile script was actually just duplicating the ember3 lockfile without changes 🤦‍♂️. This commit fixes that, and updates the ember-version-enforcement workflow to detect lockfile issues in future.
2023-12-20 11:45:01 +00:00
Isaac Janzen
043fa28fab
FIX: Add missing user search result name and styling (#24974)
Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
2023-12-19 23:14:00 -06:00
Mark VanLandingham
6d5dd92ea1
DEV: Half-revert search-menu flicker fix (#24975) 2023-12-19 16:22:30 -06:00
David Taylor
29107b3429
DEV: Stop exporting internal routeAction function (#24946)
Consumers should use the default export. This function doesn't work directly (unless you manually construct its arguments) - the default export helper handles all that automatically.
2023-12-19 12:47:22 +00:00
David Taylor
6e259a5f25
DEV: Allow 'emails disabled' notices to be temporarily dismissed (#24952)
This makes it much easier to see what a production site will look like before launch. The notices return on the next pageload, so there is minimal risk of this affecting visibility of an email configuration problem.
2023-12-19 12:06:17 +00:00
Martin Brennan
b83d4953da
FIX: Admin problem notification minor issues (#24963)
* Icon was a gift and not exclamation-triangle...these admin problems
  are not usually a gift :P
* Added missing title translation
2023-12-19 18:37:31 +10:00
dependabot[bot]
4dceac8bda
Build(deps): Bump content-tag from 1.2.1 to 1.2.2 in /app/assets/javascripts (#24955)
* Build(deps): Bump content-tag in /app/assets/javascripts

Bumps [content-tag](https://github.com/embroider-build/content-tag) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/embroider-build/content-tag/releases)
- [Changelog](https://github.com/embroider-build/content-tag/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/content-tag/commits)

---
updated-dependencies:
- dependency-name: content-tag
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* Update lockfiles for ember version flag

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: discoursebuild <build@discourse.org>
2023-12-19 08:58:23 +01:00
Alan Guo Xiang Tan
38abc0d922
DEV: Change default of cross_origin_opener_policy_header (#24940)
Why this change?

This is part of our efforts to harden the security of the Discourse
application. Setting the `CROSS_ORIGIN_OPENER_POLICY` header to `same-origin-allow-popups`
by default makes the application safer. We have opted to make this a
hidden site setting because most admins will never have to care about
this setting so we're are opting not to show it. If they do have to
change it, they can still do so by setting the
`DISCOURSE_CROSS_ORIGIN_OPENER_POLICY` env.
2023-12-19 11:46:44 +08:00
Blake Erickson
3380d283c9
FEATURE: Add API scope for /logs route (#24956)
Adds an API scope for accessing Logster's routes. This one is a bit
different than routes from core because it is mounted like

```
mount Logster::Web => "/logs"
```

and doesn't have all the route info a traditional rails app/engine does.
2023-12-18 19:45:04 -07:00
Joffrey JAFFEUX
53b96638c5
DEV: implements <Chat::Navbar /> (#24917)
This new navbar component is used for every navbar in chat, full page or drawer, and any screen.

This commit also uses this opportunity to correctly decouple drawer-routes from full page routes. This will avoid having this kind of properties in components: `@includeHeader={{false}}`. The header is now defined in the parent template using a navbar. Each route has now its own template wrapped in a div of the name of the route, eg: `<div class="c-routes-threads">..</div>`.

The navbar API:

```gjs
<Navbar as |navbar|>
 <navbar.BackButton />
 <navbar.Title @title="Foo" />
 <navbar.ChannelTitle @channel={{@channel}} />
 <navbar.Actions as |action|>
   <action.CloseThreadButton />
 </navbar.Actions>
</navbar>
```

The full list of components is listed in `plugins/chat/assets/javascripts/discourse/components/navbar/index.gjs` and `plugins/chat/assets/javascripts/discourse/components/navbar/actions.gjs`.

Visually the header is not changing much, only in drawer mode the background has been removed.

This commit also introduces a `<List />` component to facilitate rendering lists in chat plugin.
2023-12-18 17:49:58 +01:00
Blake Erickson
a08691a599
FIX: Ensure file size restriction types are ints (#24947)
Settings that are using the new `file_size_restriction` types like the
`max_image_size_kb` setting need to have their values saved as integers.
This was a recent regression in 00209f03e6
that caused these values to be saved as strings.

This change also removes negatives from the validation regex because
file sizes can't be negative anyways.

Bug report: https://meta.discourse.org/t/289037
2023-12-18 09:22:50 -07:00
chapoi
1f9e6425c6
UX: align topic notification button + text vertically (#24948) 2023-12-18 16:59:03 +01:00
Bianca Nenciu
680cf443f4
FIX: Better infinite scrolling on categories page (#24831)
This commit refactor CategoryList to remove usage of EmberObject,
hopefully make the code more readable and fixes various edge cases with
lazy loaded categories (third level subcategories not being visible,
subcategories not being visible on category page, requesting for more
pages even if the last one did not return any results, etc).

The problems have always been here, but were not visible because a lot
of the processing was handled by the server and then the result was
serialized. With more of these being moved to the client side for the
lazy category loading, the problems became more obvious.
2023-12-18 16:46:09 +02:00
Penar Musaraj
092633c14f
FIX: Modal flash tracking (#24923)
Super minor, without tracking, these error messages weren't being shown.
2023-12-18 09:34:19 -05:00
Jarek Radosz
8207e59c00
DEV: Remove unused code (#24915)
`input:focus + label.alt-placeholder` css is used for styling active input's label
2023-12-18 11:26:38 +01:00
chapoi
7fe5a6986b
UX: fullscreen modal > add missing modifier + sticky header (#24920)
* UX: table builder add missing modal modifier

* UX: fullscreen-table sticky header fix

* UX: fullscreen table > autosize width
2023-12-18 11:18:54 +01:00
David Taylor
31c2a4717b
DEV: Allow plugins/themes to add global notices at any time (#24922)
Previously, `addGlobalNotice` would have to be called before the GlobalNotice component was rendered. By using a TrackedArray, we can improve that so that plugins can call the function at any time and the notice will be rendered immediately
2023-12-18 09:56:23 +00:00
Natalie Tay
e24c015b9c
FIX: Correct urls to account for subfolder setup (#24941) 2023-12-18 16:49:06 +08:00
Ted Johansson
0edf39409c
DEV: Convert min_trust_level_to_allow_ignore to groups (#24894)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_level_to_allow_ignore  site setting to ignore_allowed_groups.

This PR maintains backwards compatibility until we can update plugins and themes using this.
2023-12-18 13:04:37 +08:00
Kelv
1f6d778561
DEV: enable grant badge utils test and force boolean type return value for isBadgeGrantable (#24928) 2023-12-18 10:47:13 +08:00
Martin Brennan
6de00f89c2
FEATURE: Initial admin sidebar navigation (#24789)
This is v0 of admin sidebar navigation, which moves
all of the top-level admin nav from the top of the page
into a sidebar. This is hidden behind a enable_admin_sidebar_navigation
site setting, and is opt-in for now.

This sidebar is dynamically shown whenever the user enters an
admin route in the UI, and is hidden and replaced with either
the:

* Main forum sidebar
* Chat sidebar

Depending on where they navigate to. For now, custom sections
are not supported in the admin sidebar.

This commit removes the experimental admin sidebar generation rake
task but keeps the experimental sidebar UI for now for further
testing; it just uses the real nav as the default now.
2023-12-18 11:48:25 +10:00
Martin Brennan
194c84b217
FIX: Sort plugin list by name properly (#24839)
Some plugins have discourse- prefixed on their name
and some don't, so sorting in the list was inconsistent.

---------

Co-authored-by: Ted Johansson <ted@discourse.org>
2023-12-18 11:42:55 +10:00
marstall
6f3c498b83
FIX: when showing edit invite form, display saved invite data in fields (#24907)
https://meta.discourse.org/t/lets-talk-suggestion-for-improvement-invite-feature/284655/11?u=yigit
2023-12-16 09:49:21 -05:00
Ty Correll
e30da10486
UX: fix overlap obstructed anon topic reply (#24927) 2023-12-15 17:15:38 -05:00
Mark VanLandingham
fe06a76cab
REVERT: "UX: fix overlap obstructed anon topic reply (#24921)" (#24925)
This reverts commit 368f4ef24d.
2023-12-15 15:08:34 -06:00
Blake Erickson
7a7c53894d
FIX: Excessive video data downloading from service worker (#24924)
This bug appears to only be on Chrome due to the service worker fetching
the video content on page load instead of on play. For some reason
though the service worker would fetch around 4x more than the size of
the video resulting in excessive data being downloaded especially for
larger videos.

meta https://meta.discourse.org/t/287817
internal /t/111387/52
2023-12-15 13:29:50 -07:00
Ty Correll
368f4ef24d
UX: fix overlap obstructed anon topic reply (#24921)
This commit addresses the overlap between the anonymous reply button in a topic and the related or new and unread topics component.
2023-12-15 13:24:33 -06:00
Keegan George
388a2c5274
DEV: Add outlets and actions to move topic modal (#24913) 2023-12-15 08:50:29 -08:00
Kelv
2477bcc32e
DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
Penar Musaraj
8a4ab79be2
DEV: Improve header offset calculation (#24910) 2023-12-15 15:29:17 +01:00
chapoi
ed4840200b
UX: revert icon colour change in alerts (#24916) 2023-12-15 13:32:35 +01:00
Osama Sayegh
eff6e4b405
FIX: Position Float Kit elements correctly in RTL mode (#24908)
Float-kit elements (menus/tooltips) are positioned where they should be by setting an inline `left` property in JavaScript when they're rendered. For some reasons, we also set `left: 0` on float-kit elements here:

25d9927785/app/assets/stylesheets/common/float-kit/d-menu.scss (L11-L15)

This property is overridden by the inline property that the library sets in JavaScript. However, in RTL mode, all of our scss files are flipped where everything left becomes right and vice versa. In this case, the `left: 0` property in the scss file above becomes `right: 0`.

This results in a conflict specific to RTL mode where both the `left` and `right` properties are defined on the same absolute-positioned element; the `right` property will always be set to 0 because it comes from the (flipped) scss file above, and the inline `left` property will be set to some px amount determined in JavaScript.

The `right` property will take precedence over the inline `left` property due to the page being right-to-left (source: https://developer.mozilla.org/en-US/docs/Web/CSS/right#description) and this causes float-kit elements to incorrectly always stick to the right.

This commit removes the `left: 0` property altogether for float-kit elements from our scss files. It's not clear from git history why the property was added, and removing it doesn't seem to cause any issues.

Meta topic: https://meta.discourse.org/t/positioning-issues-with-rtl-locales-after-recent-updates/280220?u=osama
2023-12-15 13:16:31 +03:00
Keegan George
46eec95719
DEV: Add outlet and changes to support AI proofread (#24909) 2023-12-14 19:30:30 -08:00
Jarek Radosz
9f00c16a7a
DEV: Make DatePicker placeholder customizable (#24911) 2023-12-15 03:28:57 +01:00
Mark VanLandingham
25d9927785
DEV: Remove DefaultNotificationItem widget (#24906)
These are no longer used anymore because we use glimmer notification items everywhere 🎉
2023-12-14 13:45:59 -06:00
Daniel Waterworth
d7a09fb08d
DEV: Add true_fields method for CustomFields (#24876)
This is useful for plugins that might otherwise rely on the
CUSTOM_FIELD_TRUE constant.
2023-12-14 11:06:21 -06:00
Mark VanLandingham
74f964f2b4
DEV: Add current menu-panel tab ID as data attribute to panel (#24901) 2023-12-14 10:36:51 -06:00
David Taylor
f51f467030
DEV: Throw error if renderInOutlet component has no template (#24900) 2023-12-14 15:51:47 +00:00
Jarek Radosz
057778b710
DEV: Update content-tag to 1.2.1 (#24888) 2023-12-14 12:00:36 +01:00
Ted Johansson
48116186af
DEV: Convert tl4_delete_posts_and_topics to groups (#24866)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the tl4_delete_posts_and_topics  site setting to delete_all_posts_and_topics_allowed_groups.

This one is a bit different from previous ones, as it's a boolean flag, and the default should be no group. Pay special attention to the migration during review.
2023-12-14 09:56:42 +08:00
Blake Erickson
00209f03e6
DEV: Add file_size_restriction site setting type (#24704)
This change will allow admins to configure file sizes in mb instead of
having to convert to kb.

Co-authored-by: Ella <ella.estigoy@gmail.com>
2023-12-13 16:22:48 -07:00
dependabot[bot]
d993c38f3c
Build(deps-dev): Bump the embroider group in /app/assets/javascripts with 2 updates (#24877)
* Build(deps-dev): Bump the embroider group

Bumps the embroider group in /app/assets/javascripts with 2 updates: [@embroider/compat](https://github.com/embroider-build/embroider/tree/HEAD/packages/compat) and [@embroider/core](https://github.com/embroider-build/embroider/tree/HEAD/packages/core).


Updates `@embroider/compat` from 3.4.0 to 3.4.2
- [Release notes](https://github.com/embroider-build/embroider/releases)
- [Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/compat)

Updates `@embroider/core` from 3.4.2 to 3.4.3
- [Release notes](https://github.com/embroider-build/embroider/releases)
- [Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/core)

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

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

* Update lockfiles for ember version flag

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: discoursebuild <build@discourse.org>
2023-12-13 22:32:35 +01:00
dependabot[bot]
bb2d3ab300
Build(deps): Bump ember-auto-import from 2.7.0 to 2.7.1 in /app/assets/javascripts (#24878)
* Build(deps): Bump ember-auto-import in /app/assets/javascripts

Bumps [ember-auto-import](https://github.com/ef4/ember-auto-import/tree/HEAD/packages/ember-auto-import) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/ef4/ember-auto-import/releases)
- [Changelog](https://github.com/embroider-build/ember-auto-import/blob/main/packages/ember-auto-import/CHANGELOG.md)
- [Commits](https://github.com/ef4/ember-auto-import/commits/HEAD/packages/ember-auto-import)

---
updated-dependencies:
- dependency-name: ember-auto-import
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* Update lockfiles for ember version flag

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: discoursebuild <build@discourse.org>
2023-12-13 22:30:51 +01:00
Mark VanLandingham
c051bfc2fc
DEV: Plugin-api methods for user-notifications route customizations (#24873) 2023-12-13 15:15:42 -06:00
Daniel Waterworth
f7aefffea7
DEV: Concerns can use class_methods (#24875) 2023-12-13 14:12:03 -06:00
chapoi
7392e0e8a2
UX: have svg icons inherit colour (#24871) 2023-12-13 15:34:29 +01:00
David Taylor
fadcfd1451
DEV: Add safe_mode=deprecation_errors mode (#24870)
This commit adds an additional toggle to our safe-mode system. When enabled, it will cause all deprecation messages to become exceptions. This gives admins a way to test their themes/plugins against upcoming Discourse changes without needing to use the browser developer tools.
2023-12-13 14:06:59 +00:00
David Taylor
5e4a730366
DEV: Remove development-only DiscourseURL global (#24869)
I don't think anyone is actually using this, and the change won't affect production because it was only happening in development/test.
2023-12-13 12:41:36 +00:00