Commit Graph

58838 Commits

Author SHA1 Message Date
fd6eacd93c UX: Border radius prose-mirror select node (#32292) 2025-04-14 15:10:23 -05:00
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
dcef061651 UX: Remove z-index (#32289) 2025-04-14 12:53:46 -05:00
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
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
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
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
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
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:


0fe7ccb4b7/lib/rules_block/html_block.mjs (L6-L17)
2025-04-14 13:53:26 -03:00
f03a6f3557 UX: Onebox & quote border radius (#32242) 2025-04-14 10:55:51 -05:00
f7d95a8fad DEV: [gjs-codemod] add codemod commit to git-blame-ignore-revs 2025-04-14 15:36:37 +01:00
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
3462113bd4 DEV: [gjs-codemod] merge js and hbs 2025-04-14 15:27:52 +01:00
1eb953ca57 DEV: [gjs-codemod] renamed hbs to gjs 2025-04-14 15:27:47 +01:00
3ca507e008 DEV: [gjs-codemod] renamed js to gjs 2025-04-14 15:27:45 +01:00
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
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
f0057c7353 DEV: Drop legacy topic-list and raw-handlebars compilation system (#32081) 2025-04-14 10:42:40 +01:00
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
1a10adb089 UX: Add tooltip for markdown toggle shortcut (#32278)
Followup 198dc813750d7a0de98cc94372dea1222b97743b

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
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
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
198dc81375 FEATURE: Ctrl+M to toggle between rich/markdown editor (#32266) 2025-04-12 09:01:41 -03:00
fdb805d131 UX: only toggle rich editor details on caret click (#32267) 2025-04-12 09:01:20 -03:00
bc070dcbe3 FIX: avoid double base path on push notification (#32228)
Our service worker concatenates `baseUrl` with `url` coming from the
payload:


e8f4433872/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
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
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
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
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
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](79a8d39fb4/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
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
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
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
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
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
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
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
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
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
db68fd7046 DEV: Skip prosemirror flaky (#32231)
Example of a failure is here

https://github.com/discourse/discourse/actions/runs/14345676579/job/40214833933
2025-04-10 12:54:11 +10:00
7f851c416d DEV: Add Dashboard settings tab to Reports page (#32235)
This change adds a Dashboard settings tab to the Reports page.
2025-04-10 10:41:12 +08:00
d32d0277fb DEV: Move User API admin settings into API keys page (#32232)
We used to have a User API admin page, which is just a page with the site settings. This PR moves that into a Settings tab under API keys.
2025-04-10 10:40:25 +08:00
92a9fb33e6 Build(deps-dev): Bump ember-test-selectors from 7.0.0 to 7.1.0 (#32248)
Bumps
[ember-test-selectors](https://github.com/mainmatter/ember-test-selectors)
from 7.0.0 to 7.1.0.
- [Release
notes](https://github.com/mainmatter/ember-test-selectors/releases)
-
[Changelog](https://github.com/mainmatter/ember-test-selectors/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mainmatter/ember-test-selectors/commits)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-10 03:00:55 +02:00
14a42bdafe FIX: incorrect flag message when en_GB language (#32191)
Currently, this is the order of i18n translate function:
1. Translation in required language;
2. Optional `defaultValue` provided;
3. Fallback to forum default language.

When admin set language as English GB, translation was not correctly
displayed as it went to step 2 and displayed `defaultValue` instead of
correct translation from default language.
2025-04-10 08:06:52 +08:00
af64c85670 Build(deps-dev): Bump puppeteer-core from 24.6.0 to 24.6.1 (#32249)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from
24.6.0 to 24.6.1.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
-
[Changelog](https://github.com/puppeteer/puppeteer/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v24.6.0...puppeteer-core-v24.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-10 01:45:11 +02:00
fff1ae60f1 DEV: ensures chat can work without discourse-presence
discourse presence can be disabled, given it's a plugin the `composerPresenceManager` service couldn't be present anymore and would cause an error.

No test as it's testing imbrication of multiple plugins and hard to test reliably.
2025-04-09 17:00:31 -04:00
fb162ad64d UX: make admin code editor height more flexible (#32241)
Reported here:
https://meta.discourse.org/t/issue-with-custom-css-save-button-on-smaller-screens/358505


Allows the admin code editor to adjust to the viewport regardless of
error message and nav height in both normal and maximized modes


Before:


![image](https://github.com/user-attachments/assets/657fb938-04d2-4ad8-a0c3-f5b6177d7fa2)


![image](https://github.com/user-attachments/assets/bfbf532d-d193-4387-b8c9-546fb6653ff6)


After:


![image](https://github.com/user-attachments/assets/9c2cb0ad-2eff-4171-8912-918dd5326eae)


![image](https://github.com/user-attachments/assets/fa865a13-0891-4fa6-9af6-ed2422bf676e)
2025-04-09 16:20:48 -04:00
949953d025 UX: only-emoji consistency between rich editor and cooked (#32245) 2025-04-09 16:54:05 -03:00
5ece8112da FIX: safari bug on rich editor's list item (#32243)
This fixes a bug on Safari where, for some reason, it was leaking to
affect the rich editor list item rendering. When typing, the current
list item was breaking to a next line.

With this change, it doesn't happen anymore, and the more specific `svg`
target will serve the same purpose as it's currently defined on
`InputTip`.
2025-04-09 15:03:52 -03:00