This test file fails locally if `tmp/theme-transpiler.js` does not
exists.
Since the test file stubs the production env, we have to ensure that
`DiscourseJsProcessor::Transpiler.build_production_theme_transpiler` is
run first to mirror the production environment where the theme
transpiler file is built as part of assets precompilation.
### Review notes:
Example failure:
https://github.com/discourse/discourse/actions/runs/14529161497/job/40766003075
To repro locally, run the following steps:
1. In your Discourse directory, run `rm -rf tmp`
2. `rspec spec/requests/qunit_controller_spec.rb`
This is to try fix this error by sending the keys
on the element itself:
```
Failure/Error: page.send_keys([PLATFORM_KEY_MODIFIER, "v"])
Selenium::WebDriver::Error::StaleElementReferenceError:
stale element reference: stale element not found in the current frame
(Session info: chrome=135.0.7049.84); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#stale-element-reference-exception
```
Avoid auto-linking URLs within code marks
Avoid auto-linking URLs when there's a `` ` `` just before the matched
URL, assuming the user is about to type a closing `` ` `` to create a
code mark instead.
This PR allows for other code to force the sidebar, but making the
language not admin-specific. There is a general problem to solve of "how
can I force the sidebar to appear, while keeping the hamburger menu in
the header as-is". This problem is solved for admin interface, but the
variable naming made it seem like the logic was directly tied to the
admin UI.
It is easy with this change, to have another sidebar manager force the
sidebar to be open for a route. Technically it was easy before, but it
would look like you were doing awful hacks.
---------
Co-authored-by: Isaac Janzen <isaac.janzen@discourse.org>
Without the `useCapture` as `true` on this `ComposerUpload`'s
`addEventListener`, if the clipboard contained both a Files array and a
`text/html` item, the paste event would be captured by ProseMirror
before being captured by the `ComposerUpload` setup and its
`preventDefault` call.
Adds support for a tag-chooser in form templates. It supports single tag
and multi tags. The source of the displayed tags has to be a tag_group
name.
---------
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit adds a `:sidekiq_job_error` event which is
triggered when an error is encountered while running a Sidekiq job. The
intent of this change is to complement the `:sidekq_job_ran` event which
can be used with the `:sidekiq_job_error` event to calculate the error
rate for each job.
Allow admins to edit user custom flags. Because changing
name/description will update name/description for old reviewables,
warning has to be displayed.
Still, system flags can never be edited or deleted (only disabled).
The test being fixed in this commit was flaking with the following
error:
```
Capybara::Ambiguous:
Ambiguous match, found 2 elements matching visible css ".stream-topic-title .title a[href*='/2']"
```
The regexp match on the `href` attribute has the potential to match
multiple elements if both urls contain the `/#{topic.id}` substring. For
example, both `/t/-/2/2` and `/t/-/1/2` will satisfy the regexp.
It was using `<<` that caused the SiteSetting to get modified
Updated the spec to use the same pattern as other modifiers and used
`next` to return the correct value of the modifer
State seems to be leaking into other specs. Minimal repro:
```
bin/rspec --order defined spec/helpers/application_helper_spec.rb:783 spec/lib/wizard/wizard_builder_spec.rb:38
```
```
Failures:
1) Wizard::Builder introduction should not prefill default site setting values
Failure/Error: expect(description_field.value).to eq("")
expected: ""
got: " - modified by plugin"
```
Don't require password to create users with previous authentication in
the session, regardless of email/email verification during user creation
Before my changes we were calling `user.password_required!` in
`UserAuthenticator.authenticated?` based on whether authentication
session data contained a matching email address and email verified
externally. I believe `authenticated?` is intended for our own email
validation during the activation process, but shouldn't be a gate for
password requirement.
Even when we were setting `user.password_required`, then during user
creation we were creating random passwords to get around the blank
password restriction when creating accounts with external auth.
After my change we can remove the random password creation because we no
longer require a password when the session has previous authentication
info at all.
Looks like this extra password requirement may have been introduced as a
side effect during a previous refactor of `UserController` here:
51eff92170
Before that change, password requirement was simply based on whether
session[:authentication] existed, but after that change it was based on
the email/email_valid fields as well.
This commits changes the language for components that aren't used on any themes to be "used/unused" instead of "active/inactive" throughout the new components listing page.
When an installed component doesn't have a description in its locale
files, we should fallback to the description that core has for the
component if it's one of the popular components that core features.
On sites with many components, serializing and rendering all components
in one-go on a page can take quite a bit of time. The new components
listing page that was introduced in
https://github.com/discourse/discourse/pull/32164 currently loads all
components in one-go, so this commit implements infinite-scrolling
pagination for the page to address this performance issue for sites with
many components.
Theme/component description is fetched via the `locale_fields` and
`theme_translation_overrides` associations on the `Theme` model. We're
currently not preloading these associations when serializing
themes/components, which causes an N+1 performance issue when accessing
the themes/components listing pages.
Adding some changes to site.rb, and seeing this error:
```
Failure/Error: raise "Clearing modifiers during a plugin spec run will affect all future specs. Use unregister_modifier instead."
```
This is a standalone PR to update the usage here so that my future PR
won't be affected.
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.
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.
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`.
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.
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.
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.
## 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
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.
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.
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.
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.
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>
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
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.
Added button to remove password from account if user has a linked
external account or passkey
The button only displays if the user has at least one associated account
or a passkey set up. Uses the ConfirmSession dialog in addition to a
warning about deleting the password.
Users can still reset their password via the Reset Password button
(which will now display "Set Password" if they've removed it).
Also prevent user from removing their last remaining associated account
or passkey if they have no password set.
Replaces PR #31489 from my personal repo, with some fixes for conflicts
since then.