Commit Graph
58848 Commits
Author SHA1 Message Date
Ted Johansson fc6aaa3e49 DEV: Wizard step tweaks (#32304)
This makes two tweaks to the setup wizard:

1. Move the branding (site logo) step to after styling (look & feel).
2. Remove the corporate (your organization) step.
2025-04-15 13:53:01 +08:00
Martin Brennan 735bef9ea0 UX: Remove Ctrl+F search shortcut (#32281)
This commit removes the Ctrl+F search shortcut, which hijacks the
browser search shortcut in Discourse. We are doing this because there
has been many years of complaints around this behaviour, and now that
we have the new header search it has become even more annoying.

We originally added this because we lazy load posts in a topic, and it
might not have been immediately clear to users that they are not
searching
all the posts in the topic when pressing Ctrl+F. However, that was 10+
years
ago, most people are very familiar with lazy loading now, it doesn't
make sense
to keep this additional hijack for this one topic use case.

Search is still accessible by pressing the `/` shortcut.
2025-04-15 15:14:54 +10:00
Martin Brennan 7a6006f7aa FIX: Escape regex symbols when replaceText is called for ProseMirror (#32280)
When we do replaceText in the ProseMirror TextManipulation lib,
we are creating a regex for the provided markdown. However this markdown
can have things like * (which is valid for a markdown list), which also
doubles as a regex symbol. We can escape the markdown provided to
the regex first to fix the issue.
2025-04-15 14:04:33 +10:00
Krzysztof Kotlarek 077649fafd FIX: bugs with refresh page after save fonts (#32282)
It takes a moment to sync site settings. Therefore, it is better to pass
new values to `refreshPage` function.

Also, it was not working for some fonts like `JetBrains Mono`.
SiteSetting key is `jet_brains_mono` but font family value should be
`JetBrains Mono`.
2025-04-15 12:02:28 +08:00
Ted Johansson 8b9da12bf2 FIX: Wizard logo step JS error (#32303)
`PreviewBase#drawPills` expects a `homepageStyle` option, but on the logo wizard page we weren't passing any. In this change we pass one of the possible values: `hot`.
2025-04-15 10:54:46 +08:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2cd82abbe3 Build(deps-dev): Bump parser from 3.3.7.4 to 3.3.8.0 (#32300)
Bumps [parser](https://github.com/whitequark/parser) from 3.3.7.4 to
3.3.8.0.
-
[Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/whitequark/parser/compare/v3.3.7.4...v3.3.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 01:17:47 +02:00
Renato Atilio c78a79bbf5 UX: keep content on rich editor footnote inputrule (#32296)
Instead of using the matched string, this PR uses the actual sliced
content from the ProseMirror document range as the content when creating
the footnote node.
2025-04-14 19:36:18 -03:00
Jordan Vidrine 79c642a446 UX: Quick mobile fix for quote styles (#32297) 2025-04-14 17:28:03 -05:00
Renato Atilio d8d341ebf6 FIX: remove newline from rich editor's pasted img title/alt (#32295)
New lines on `alt`/`title` embedded media are not allowed, causing an
invalid serialized Markdown which is not supposed to contain new lines
for these attributes.

This PR removes them during HTML parsing – we are not creating this new
line scenario otherwise.
2025-04-14 19:24:21 -03:00
Jordan Vidrine 1da41e62cc UX: Use mixin for quote border radius (#32294) 2025-04-14 16:33:21 -05:00
Jordan Vidrine fd6eacd93c UX: Border radius prose-mirror select node (#32292) 2025-04-14 15:10:23 -05:00
Gabriel Grubba 12f05181c7 FIX: Add helpers for title and content for application.html.erb and crawler.html.erb (#32290)
Previously, there was only those helpers in `crawler.html.erb` as we
added it in https://github.com/discourse/discourse/pull/32259

However, to keep it consistent, we need to add it in
`application.html.erb` as well.
2025-04-14 16:34:23 -03:00
Jordan Vidrine dcef061651 UX: Remove z-index (#32289) 2025-04-14 12:53:46 -05:00
Renato Atilio 224d6f85ec FIX: rich editor insertBlock implementation (#32288)
Our `insertBlock` implementation was only taking the `firstChild` into
consideration.

We didn't notice this before because there's only one use of this in
core, quoting from a post, which has a single child.

This fix is necessary to support the `insert-block` call that the
https://github.com/discourse/discourse-templates plugin makes when
inserting a template.
2025-04-14 14:27:15 -03:00
Renato Atilio fe20b52180 UX: keep the whisper editor font/color style consistent between editors (#32287)
Adds the whisper styling to the Markdown editor as well, keeping it
consistent with the preview and the rich editor.
2025-04-14 14:27:05 -03:00
Renato Atilio 29ca0ae0b1 FEATURE: add footnote (plugin) rich editor extension (#31719)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds a `footnote` node, parser, `^[inline]` input rule, toolbar button
item, and serializer.

Also adds a NodeView with an internal ProseMirror editor to edit the
footnote content.
2025-04-14 14:25:36 -03:00
Renato Atilio a0a5b2889f DEV: replace rich editor input rules regex lookbehind (#31909)
Refactors the rich editor input rules matches that rely on a lookbehind,
it breaks on iOS <= 16.3.
2025-04-14 14:25:17 -03:00
Renato Atilio 381f6e64e8 FIX: click handler position on rich editor details node (#32268)
`pos` is the exact position of the click in the entire document

`nodePos` is the position of the clicked node itself

The idea is that we want the click to be the first position **within the
node**.

The previous code was checking for the first 2 positions of the entire
document.

I'd love to add a test for this, but it's very tricky.
2025-04-14 14:06:54 -03:00
Renato Atilio b9cef22c2f UX: rich editor html_block without escaping and avoiding \n\n (#32269)
When using a html block within the rich editor (currently only possible
after parsing it from Markdown), it would get serialized with the
default escape=true processing.

Additionally, html blocks are a continuous block, if a `\n\n` is seen
during cooking the block is closed, so we make sure at most one
continuous `\n` is seen in the html block node on the ProseMirror doc.

EDIT: It turns out, it's not so simple. I'm merging this as is, but it's
important to link the actual behavior to close a paragraph from
markdown-it:


https://github.com/markdown-it/markdown-it/blob/0fe7ccb4b7f30236fb05f623be6924961d296d3d/lib/rules_block/html_block.mjs#L6-L17
2025-04-14 13:53:26 -03:00
Jordan Vidrine f03a6f3557 UX: Onebox & quote border radius (#32242) 2025-04-14 10:55:51 -05:00
David Taylor f7d95a8fad DEV: [gjs-codemod] add codemod commit to git-blame-ignore-revs 2025-04-14 15:36:37 +01:00
David TaylorandJarek Radosz 7b2b08cf89 DEV: [gjs-codemod] Convert automation/styleguide/other to gjs
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-14 15:36:16 +01:00
David Taylor 3462113bd4 DEV: [gjs-codemod] merge js and hbs 2025-04-14 15:27:52 +01:00
David Taylor 1eb953ca57 DEV: [gjs-codemod] renamed hbs to gjs 2025-04-14 15:27:47 +01:00
David Taylor 3ca507e008 DEV: [gjs-codemod] renamed js to gjs 2025-04-14 15:27:45 +01:00
Renato Atilio b3f0c85d82 UX: avoid leading space when serializing some nodes from rich editor (#32270)
On some cases during serialization (like with headings), the previous
node is still "open" when it's the "turn" of the node we're serializing.

In this case, checking the boundaries before writing was getting the
wrong state, because the `write` call uses `flushClose()`, which makes
sure we have the newlines from closing the previous node.

This would create scenarios like (notice the space before each node
below the heading)

```markdown
# Heading

 🎉

# Heading

 @mention

# Heading

  #hashtag
```

This PR makes sure we call flushClose() before checking boundaries, and
adds tests for that.
2025-04-14 10:57:34 -03:00
Natalie Tay d1ce861a6b DEV: Add usage example for anon cache cookie registration (#32283)
Adding an example for the plugin api `register_anonymous_cache_key`.
2025-04-14 21:03:05 +08:00
David Taylor f0057c7353 DEV: Drop legacy topic-list and raw-handlebars compilation system (#32081) 2025-04-14 10:42:40 +01:00
Osama Sayegh 13cb472ec8 FIX: Refresh disabled state when switching between site texts (#32262)
Repro steps:

1. Go to `/admin/customize/site_texts`
2. Click edit on any translation
3. Go back by clicking on "Back to search"
4. Click edit on another translation
5. Change the text field in any way

Expected results:

The disabled state on the "Save changes" button is removed and you're
able to click it

Actual results:

The "Save changes" button remains disabled

This happens because the computed property for the button's disabled
state doesn't get re-evaluated when navigating between translation
strings because it doesn't include on the `siteText` property in its
dependent properties, so changing the site text doesn't invalidate the
old value for the disabled state and it always stays the same.

Meta topic:
https://meta.discourse.org/t/i-cant-save-edit-on-site-texts/360990?u=osama
2025-04-14 08:00:08 +03:00
Martin Brennan 1a10adb089 UX: Add tooltip for markdown toggle shortcut (#32278)
Followup 198dc81375

Indicate the shortcut in the tooltip for the rich/markdown
editor toggle, and also add the control translation for mac
in `translateModKey`
2025-04-14 13:12:52 +10:00
Krzysztof Kotlarek ee035582e2 FIX: Rename branding to logo and fonts (#32264)
Change branding page into logo and fonts.

In addition, icon for email setting and email appearance were changed.
2025-04-14 10:49:47 +08:00
Yuriy Kurant 8b5da219d8 UX: header search mobile support (#31711)
## Requirements

Initially defined in
https://meta.discourse.org/t/software-engineer-frontend-ember-js-yuriy-kurant/353612/14?u=yaran.

1. On mobile devices and tablets, users can open the search input field
by tapping the search icon
2. When opened, the search input takes over the entire header area:
    - Users can tap the sliders icon to navigate to the advanced search page
(/search)
    - Users can tap Cancel to close search input
3. After submitting a search, results area will take over the entire
screen:
    - Users can tap the X icon to clear the search term from the input field
    - Users can tap Cancel to close search results area and return to their
previous page (i.e. search area overlays content)

## Implementation

1. When opened, the search input takes over the entire header area:
    - changed panel width from `90vw` to `100vw`
    - on initial render (when search input is empty), search panel hovers over the header section only (doesn't cover main content below)
    - quick tip and recent searches lists are not displayed on mobile view
2. Tap on the sliders icon navigates to the advanced search page
(`/search`)
3. Tap on the **Cancel** button:
    - closes search menu
    - if the search term is present, it is cleared
4. Tap on the left-hand side **Search** icon triggers a topics search

## Dev notes

1. Added `// TODO` questioning `search` service `noResults` default value of `false`
2. Added animation on toggling header search panel (created `delayed-destroy` custom modifier)
3. Extracted in-context search filters into a standalone component `search-menu/active-filters`:
    - mobile: active filters below search input
    - desktop: active filters inside search input
3. Removed unnecessary top padding when search results are empty
4. Added `data-test-` attrs for Ember tests. Benefits:
    - semantically `data-test-` attrs indicate that these parts of the layout are covered with tests
    - decouples selector dependency on `id/class` names for testing purposes - eliminates risk of broken tests due to `id/class` name changes
2025-04-14 10:27:48 +08:00
Renato Atilio 198dc81375 FEATURE: Ctrl+M to toggle between rich/markdown editor (#32266) 2025-04-12 09:01:41 -03:00
Renato Atilio fdb805d131 UX: only toggle rich editor details on caret click (#32267) 2025-04-12 09:01:20 -03:00
Renato Atilio bc070dcbe3 FIX: avoid double base path on push notification (#32228)
Our service worker concatenates `baseUrl` with `url` coming from the
payload:


https://github.com/discourse/discourse/blob/e8f4433872f075db6400ab53c94d8d117422b93b/app/views/static/service-worker.js.erb#L96

This PRs strips the base path before sending `url` to the push
notification to avoid having a URL with the base path duplicated,
causing a 404.
2025-04-12 08:16:53 +10:00
Gabriel Grubba c484d2fd88 FEATURE: add override for crawler title and description tags (#32259)
In https://github.com/discourse/discourse/pull/32159 we overrode the
`og:` and `twitter:` title and description but for some crawlers, we
need to override the `title` and `description` meta tag as well.
2025-04-11 09:38:11 -03:00
David Battersby 7103078fa1 FIX: switch to search icon on narrow desktop (#32215)
Ensures the search field reverts to the search icon on small desktop
screen sizes
2025-04-11 15:17:12 +04:00
David Taylor 36f364fe11 FIX: Ensure discovery queryParams do not persist invisibly (#32178)
Sharing a controller seems to make query params behave more weirdly than
normal. This change lets Ember create a separate controller instance for
each route, even though they will still share the same class.
2025-04-11 09:44:32 +01:00
Gary Pendergast 05e0491902 FIX: Ensure uploaded watched word CSVs are converted to utf-8. (#32263)
When a watched words CSV file is uploaded, we assume it's utf-8 encoded, but that's not always going to be the case. This change loads the CSV and converts it to utf-8 before processing it.
2025-04-11 16:12:45 +10:00
Osama Sayegh d416b64af0 FIX: Move CORE_SVG_SPRITES constant to a method (#32261)
Changing the `CORE_SVG_SPRITES` constant to a method enables us to
detect SVG files that are written to the vendor directory during plugin
initialization (as done by the [FontAwesome pro
plugin](https://github.com/discourse/discourse-fontawesome-pro/blob/79a8d39fb46d0f28543680a45acf988fd7b87194/plugin.rb#L31))
which happens after all the ruby classes/files are read and loaded into
memory.

Internal topic: t/151476.
2025-04-11 06:25:04 +03:00
Ted Johansson 414419b43d DEV: Add Settings tab to admin Users page (#32255)
This PR adds a Settings tab to the admin Users page, grouping relevant site settings.
2025-04-11 11:10:53 +08:00
Krzysztof Kotlarek 6e654bc596 FIX: relax automation restrictions (#32238)
Relaxed restrictions:
- Automation posts are not validated for similarity. This was causing
error when PMs were created by regular user with same content and sent
to different users.
- Don't create warning logs when PM target does not exist anymore. When
for example spammer was deleted, delayed PM is not sent, but it is
correct behaviour;
- Allow tags to be applied even if an automation user is not allowed to
tag;
- Restricted category tags should be visible in configuration UI. Still,
they will be applied only when specific topic belongs to correct
category.
2025-04-11 07:27:43 +08:00
Penar Musaraj 6fc5ce9688 UX: Improve associated accounts in user preferences (#32247)
Before

![CleanShot 2025-04-09 at 16 57
09@2x](https://github.com/user-attachments/assets/73609f67-355b-4e43-b4d8-eb163ce2b3cc)


After

![CleanShot 2025-04-09 at 16 56
10@2x](https://github.com/user-attachments/assets/90b05af0-649d-43ce-87c2-2a36dd8a2caa)
2025-04-10 12:01:07 -04:00
Selase Krakani 9bfb4c005d FIX: Set last_read_post_number for imported watching topic users (#32229)
Ensure `last_read_post_number` is set to the latest post for imported
topic users with a `watching` notification level, even if they haven't
engaged with the topic
2025-04-10 12:35:51 +00:00
Gabriel GrubbaandPenar Musaraj 181606e0bd FIX: Prioritize the author when replying to topic (#32244)
Added in https://github.com/discourse/discourse/pull/32086 this
prioritization did not accounted for when the user was replying to the
topic/OP.

Now when replying to the topic, the author will be prioritized in the
list.

All other cases are the same as before.

Added testing for all cases and changed `replyingToUser` to
`replyingToUserId` for clarity and consistency with API.

---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2025-04-10 09:02:32 -03:00
David Battersby 7c4787256d FIX: category badge style missing data attr (#32253)
The style type data attribute is missing for cooked posts prior to
#31795 which meant that older posts with category hashtags were not
displaying correctly. We already have a default style type at the
database level, but for hashtag styling it is handled based on stored
markup at the point in time when the post was last cooked.

Simply rebuilding html solves this but a good workaround is to set a
proper default when the data attr is missing.
2025-04-10 13:20:50 +04:00
Joffrey JAFFEUX 01ce003b8e FIX: logs time even when automation raises (#32254)
The previous code could attempt to log a `nil` `run_time` if the block
would raise an exception. This commit adds two safeguards:

- rescue any exception to still compute `run_time`
- defaults to `0` if we still don't have any `run_time`
2025-04-10 11:05:53 +02:00
Sam da088a24c3 FEATURE: allow searching for whispers and bots (#32252)
Add new advanced search filters for post types

- `in:bot` or `in:bots`: Filters for posts made by bot users (user_id <
0)
- `in:human` or `in:humans`: Filters for posts made by human users
(user_id >= 0)
- `in:whisper` or `in:whispers`: Filters for whisper posts (respects
permissions)
- `in:regular`: Filters for regular posts only
2025-04-10 16:21:46 +10:00
David Battersby 7de9f79f55 FIX: hide search field on invites page (#32236)
Prevents rendering the search field on the invites page.
2025-04-10 09:54:17 +04:00
Ted Johansson db214a38a2 DEV: Add Content admin config page (#32194)
This PR adds a dedicated page for Content related site settings. It has four different site setting tabs.
2025-04-10 11:20:22 +08:00