Commit Graph

55125 Commits

Author SHA1 Message Date
Krzysztof Kotlarek
b64d01bc10
FIX: store information about the login method in the database. (#28054)
Previously in these 2 PRs, we introduced a new site setting `SiteSetting.enforce_second_factor_on_external_auth`.

https://github.com/discourse/discourse/pull/27547
https://github.com/discourse/discourse/pull/27674

When disabled, it should enforce 2FA for local login with username and password and skip the requirement when authenticating with oauth2.

We stored information about the login method in a secure session but it is not reliable. Therefore, information about the login method is moved to the database.
2024-07-24 17:19:58 +10:00
Joffrey JAFFEUX
0c13c91f84
DEV: migrates footer-nav from widget to gjs (#28024)
This commit also attempts to promote more declarative patterns. The route history logic has been replaced by using the history-store service.

---------

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
Co-authored-by: David Taylor <david@taylorhq.com>
2024-07-24 07:54:15 +02:00
Martin Brennan
db8c1f20ed
DEV: Convert group SMTP settings form to FormKit (#27965)
This commit changes the group SMTP settings form (at
`/g/:name/manage/email`) to use
FormKit, our magical new form component system  

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-07-24 09:52:52 +10:00
Vinoth Kannan
d681decf01
FEATURE: use new site setting for onebox custom user agent. (#28045)
Previously, we couldn't change the user agent name dynamically for onebox requests. In this commit, a new hidden site setting `onebox_user_agent` is created to override the default user agent value specified in the [initializer](c333e9d6e6/config/initializers/100-onebox_options.rb (L15)).

Co-authored-by: Régis Hanol <regis@hanol.fr>
2024-07-24 04:45:30 +05:30
Régis Hanol
73ce3589ad
PERF: improves TextSentinel's seems_unpretentious check (#28044)
by scanning the text for the first word that is bigger than `max_word_length` instead of extracting (segmenting) all the words, computing their size, and comparing the maximum with `max_word_length`.

Idea from @mentalstring in https://meta.discourse.org/t/body-seems-unclear-error-when-users-are-typing-in-chinese/88715/14
2024-07-23 17:12:29 +02:00
David Taylor
c333e9d6e6
FIX: Improve topic/header integration when navigating away (#28040)
- Ensure main title is set as 'not visible' when removed from DOM

- `deactivate` -> `willTransition` to ensure proper behavior when navigating between multiple topics

Followup to bdec564d14
2024-07-23 14:57:15 +01:00
chapoi
5b693c61af
UX: change sidebar background to secondary (#28043) 2024-07-23 15:56:21 +02:00
dependabot[bot]
04db941b76
Build(deps-dev): Bump mocha from 2.4.2 to 2.4.4 (#28039) 2024-07-23 15:28:36 +02:00
dependabot[bot]
ab4e69500f
Build(deps): Bump public_suffix from 6.0.0 to 6.0.1 (#28038) 2024-07-23 15:28:24 +02:00
Discourse Translator Bot
5b5d5b4b4a
Update translations (#28041) 2024-07-23 15:23:42 +02:00
dependabot[bot]
424a67778e
Build(deps-dev): Bump @floating-ui/dom from 1.6.7 to 1.6.8 (#28027)
Bumps [@floating-ui/dom](https://github.com/floating-ui/floating-ui/tree/HEAD/packages/dom) from 1.6.7 to 1.6.8.
- [Release notes](https://github.com/floating-ui/floating-ui/releases)
- [Changelog](https://github.com/floating-ui/floating-ui/blob/master/packages/dom/CHANGELOG.md)
- [Commits](https://github.com/floating-ui/floating-ui/commits/@floating-ui/dom@1.6.8/packages/dom)

---
updated-dependencies:
- dependency-name: "@floating-ui/dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-23 14:21:57 +02:00
dependabot[bot]
989dec421d
Build(deps): Bump ace-builds from 1.35.3 to 1.35.4 (#28029)
Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.35.3 to 1.35.4.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ajaxorg/ace-builds/compare/v1.35.3...v1.35.4)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-23 14:21:11 +02:00
dependabot[bot]
a7fb4e368e
Build(deps-dev): Bump lefthook from 1.7.4 to 1.7.5 (#28028)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.7.4 to 1.7.5.
- [Release notes](https://github.com/evilmartians/lefthook/releases)
- [Changelog](https://github.com/evilmartians/lefthook/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evilmartians/lefthook/compare/v1.7.4...v1.7.5)

---
updated-dependencies:
- dependency-name: lefthook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-23 11:52:47 +02:00
David Taylor
bdec564d14
DEV: Refactor header topic-info handling (#27989)
- Move topic-title on-screen detection to intersection-observer (via new modifier), and add a boolean to header service which indicates whether it's on-screen

- Move scroll-direction from Mixin to dedicated service. Teach it to pause scroll monitoring while transitions are in progress, to avoid reporting false changes in scroll direction. Also resets to a 'neutral' state after each navigation, which indicates the the user has not yet scrolled

- When entering a topic view, notify the header service which post is being targeted. It can then make an educated guess about whether the topic title is likely to be in-view

- Update header service `topicInfoVisible` to be a declarative getter, based on the three refactored sources of truth mentioned above

- Update legacy widget header to use the header service for topic info

All of these changes mean that the header no longer 'flickers' when navigating into topics on mobile. As well as the improved UX, this should also improve our Cumulative Layout Shift (CLS) web vital metrics.
2024-07-23 10:24:44 +01:00
Joffrey JAFFEUX
e954eb234e
FIX: return is invalid inside a block (#28036)
Fixed using next instead. It was causing this kind of errors:

```
Job exception: unexpected return

/var/www/discourse/app/controllers/topics_controller.rb:1304:in `block in defer_topic_view'
/var/www/discourse/lib/scheduler/defer.rb:115:in `block in do_work'
rails_multisite-6.0.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
rails_multisite-6.0.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/lib/scheduler/defer.rb:109:in `do_work'
/var/www/discourse/lib/scheduler/defer.rb:97:in `block (2 levels) in start_thread'
```
2024-07-23 09:56:38 +02:00
锦心
a749387c80
FEATURE: Clean up previously logged information after permanently deleting posts (#28033)
* FEATURE: Clean up previously logged information after permanently deleting posts

When soft deleteing a topic or post, we will log some details in the
staff log, including the raw content of the post. Before this commit, we
will not clear the information in these records. Therefore, after
permanently deleting the post, `UserHistory` still retains copy of the
permanently deleted post. This is an unexpected behaviour and may raise
some potential legal issues.

This commit adds a behavior that when a post is permanently deleted, the
details column of the `UserHistory` associated with the post will be
overwritten to "(permanently deleted)". At the same time, for permanent
deletion, a new `action_id` is introduced to distinguish it from soft
deletion.

Related meta topic: https://meta.discourse.org/t/introduce-a-way-to-also-permanently-delete-the-sensitive-info-from-the-staff-logs/292546
2024-07-23 15:27:11 +08:00
Martin Brennan
129eb4ba59
FIX: Missing model return in admin-backups route (#28035)
Followup dd30463276

We missed the explicit `return` when we changed to
async/await, so the model ends up being null on admin
backups.

This means we also have no tests for the backup UI, that
will be fixed in a subsequent PR.
2024-07-23 16:24:29 +10:00
Jan Cernik
a4692609e4
FIX: Ensure topic steam is loaded before rendering the map (#28031) 2024-07-23 01:16:58 -03:00
Krzysztof Kotlarek
e020888b0a
FIX: flag valid type inclusion should be lambda (#28030)
There is a bug with chat type flags - "An error occurred: Applies to is not included in the list"

Flag.valid_applies_to_types is a set of core types and types registered by plugins `Set.new(DEFAULT_VALID_APPLIES_TO | DiscoursePluginRegistry.flag_applies_to_types)`

Using lamba should ensure that valid values are calculated dynamically.
2024-07-23 11:47:50 +10:00
Martin Brennan
fc09236c0c
UX: FormKit error message followup (#28009)
We don't need this extra description, whole number
should be enough
2024-07-23 11:40:20 +10:00
Martin Brennan
0b413e2aa1
FEATURE: Use new topic bulk actions menu for all sites (#28003)
This commit promotes the new topic bulk action
menu introduced in 89883b2f51
to the main method of bulk selecting and performing
actions on topics. The site setting flag gating this
feature is deleted, and the old bulk select code is
deleted as well.

The new modal shows a loading spinner while operations
are taking place, allows selecting the action from a dropdown
instead of having a 2-step modal flow,
and also supports additional options for some operations, e.g.
allowing Close silently.
2024-07-23 11:39:27 +10:00
Jan Cernik
a027ec4663
UX: Merge the simplified topic map (#27964)
Replaces the existing topic map with the experimental-topic-map made by @awesomerobot.

---------

Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2024-07-22 19:42:29 -03:00
Osama Sayegh
6039b513fe
DEV: Initial parts for a redesigned /about page (#27996)
This commit introduces the foundation for a new design for the /about page that we're currently working on.  The current version will remain available and still be the default until we finish the new version and are ready to roll out. To opt into the new version right now, add one or more group to the `experimental_redesigned_about_page_groups` site setting and members in those groups will get the new version.

Internal topic: t/128545.
2024-07-23 01:35:18 +03:00
Alan Guo Xiang Tan
2d59795e28
DEV: Log sidekiq job opts as string instead of hash (#28012)
This ensures that elasticsearch doesn't parse it as an object. There are
too many combination of job opts so we don't want elasticsearch to be
parsing and indexing this field as an object.
2024-07-23 06:27:43 +08:00
Daniel Waterworth
6fb91b85ba
PERF: Shortcircuit Topic.similar_to if max_similar_results is 0 (#28023) 2024-07-22 15:03:34 -05:00
Sérgio Saquetim
8ef69f4c56
DEV: Added enter hints for the quick search and sidebar filter (#28022) 2024-07-22 15:33:50 -03:00
David Taylor
a267c0727d
Revert "DEV: Defer button actions with layout change to the next frame paint (#27967)" (#28020)
This is causing issues with some buttons on iOS. Reverting while we investigate.

This reverts commit 352d6f9dfb.
2024-07-22 17:35:23 +01:00
carson chang
747fe63db3
UX: Remove automatic composer prompt when draft exists (#28017) 2024-07-22 09:16:37 -07:00
Régis Hanol
23aa88d203
FIX: Allow all caps within CJK text (#28018)
This improves the `TextSentinel` so that we don't consider CJK text as being uppercase and thus failing the validator.

It also optimizes the entropy computation by using native ruby `.bytes` to get all the bytes from the text.

It also tweaks the `seems_pronounceable?` and `seems_unpretentious?` check to use the `\p{Alnum}` unicode regexp group to account for non-latin languages.

Reference - https://meta.discourse.org/t/body-seems-unclear-error-when-users-are-typing-in-chinese/88715

Inspired by https://github.com/discourse/discourse/pull/27900

Co-authored-by: Paulo Magalhaes <mentalstring@gmail.com>
2024-07-22 17:35:52 +02:00
dependabot[bot]
f0487aa768
Build(deps-dev): Bump selenium-webdriver from 4.22.0 to 4.23.0 (#27999)
Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 4.22.0 to 4.23.0.
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
- [Commits](https://github.com/SeleniumHQ/selenium/compare/selenium-4.22.0...selenium-4.23.0)

---
updated-dependencies:
- dependency-name: selenium-webdriver
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 16:39:26 +02:00
dependabot[bot]
53ae390835
Build(deps-dev): Bump qunit from 2.21.0 to 2.21.1 (#27998)
Bumps [qunit](https://github.com/qunitjs/qunit) from 2.21.0 to 2.21.1.
- [Release notes](https://github.com/qunitjs/qunit/releases)
- [Changelog](https://github.com/qunitjs/qunit/blob/main/History.md)
- [Commits](https://github.com/qunitjs/qunit/compare/2.21.0...2.21.1)

---
updated-dependencies:
- dependency-name: qunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 16:34:44 +02:00
dependabot[bot]
b231238743
Build(deps-dev): Bump mocha from 2.4.1 to 2.4.2 (#27982)
Bumps [mocha](https://github.com/freerange/mocha) from 2.4.1 to 2.4.2.
- [Changelog](https://github.com/freerange/mocha/blob/main/RELEASE.md)
- [Commits](https://github.com/freerange/mocha/compare/v2.4.1...v2.4.2)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 15:55:42 +02:00
dependabot[bot]
e389658059
Build(deps): Bump ws from 7.5.9 to 7.5.10 (#27990)
Bumps [ws](https://github.com/websockets/ws) from 7.5.9 to 7.5.10.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.9...7.5.10)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 15:39:35 +02:00
Mark VanLandingham
30c4c29946
DEV: Improve TagGroup.resolve_permissions method arg type handling (#28016) 2024-07-22 08:37:12 -05:00
dependabot[bot]
215b1951e4
Build(deps-dev): Bump lefthook from 1.7.2 to 1.7.4 (#27997)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.7.2 to 1.7.4.
- [Release notes](https://github.com/evilmartians/lefthook/releases)
- [Changelog](https://github.com/evilmartians/lefthook/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evilmartians/lefthook/compare/v1.7.2...v1.7.4)

---
updated-dependencies:
- dependency-name: lefthook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 14:13:02 +01:00
dependabot[bot]
04253177b0
Build(deps-dev): Bump @embroider/compat in the embroider group (#27979)
Bumps the embroider group with 1 update: [@embroider/compat](https://github.com/embroider-build/embroider/tree/HEAD/packages/compat).


Updates `@embroider/compat` from 3.5.7 to 3.6.0
- [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)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 14:12:27 +01:00
David Taylor
eb8a224fd2
FIX: Improve error handling for messageformat compilation (#28015)
We are investigating reports of errors with messageformat compilation following 301713ef. This commit does not fix the issue, but it introduces some basic error handling to avoid completely breaking affected sites.

We will have a fix for the root cause soon.
2024-07-22 13:15:10 +01:00
锦心
dfd4da9656
UX: Use localized time format in embedded comments (#28014)
Previously, the time format for embedded comments was hardcoded. This
commit changes it to the time format defined in I18n.

Related meta topic: https://meta.discourse.org/t/embed-dates-are-not-localized/27997/
2024-07-22 18:42:36 +08:00
锦心
0eeebeb6b1
DEV: add @submit hook for ace editor (#28010)
* DEV: add @commit hook for ace editor

Add @commit hook to AceEditor to handle "save and run" in Data Explorer
2024-07-22 15:53:30 +08:00
Krzysztof Kotlarek
fb7cc2d375
FIX: stop memoize PostActionTypes (#28005)
Memoizing all_flags on PostActionType was a mistake. This commit brings back the cache on the serialize level.
2024-07-22 17:35:49 +10:00
Alan Guo Xiang Tan
5105fce899
DEV: Recover @timestamp in unicorn logs when logstash logger is enabled (#28008)
This is a regression introduced in 28f5550886
2024-07-22 15:21:41 +08:00
Martin Brennan
e0f066bed3
DEV: Skip flaky topic map (#28007)
Followup 72fd509fd4

Also skips the like counter part of this
spec which is flaky
2024-07-22 17:07:19 +10:00
Martin Brennan
5ac8888980
UX: Change copy for FormKit "not an integer" error (#28006)
Most people will not know what an integer is,
refer to this as a whole number for the human-readable
error message.
2024-07-22 09:00:18 +02:00
锦心
199f980e6a
FEATURE: Add creator and logging for CustomEmoji (#28004)
* FEATURE: Add logging for CustomEmoji

We didn't provide any logs for CustomEmoji before, nor did we record the
person who added any emoji in the database. As a result, the staff had
no way to trace back who added a certain emoji.

This commit adds a new column `user_id` to `custom_emojis` to record the
creator of an emoji. At the same time, a log is added for staff logs to
record who added or deleted a custom emoji.
2024-07-22 14:44:49 +08:00
Ted Johansson
23d7800ff1
DEV: Redirect to actionable page if routing is restricted (#28002)
If a user has a required action, e.g. adding a 2FA method or filling in new required fields, we disable client-side routing except to allowed pages.

This led to a situation where a user might navigate away from e.g. the profile page to look at the new ToS, and then being "stuck" due to not knowing how to get back to accept the new terms.

This PR makes it so that if you click any restricted link, instead of doing nothing we transition the user back to the page where they can take the required action.
2024-07-22 12:24:05 +08:00
Natalie Tay
352d6f9dfb
DEV: Defer button actions with layout change to the next frame paint (#27967)
User actions can trigger functions that render changes to the screen within the same cycle (e.g. pressing the reply button will cause the login modal to pop up), potentially impacting performance and causing some jank on slower devices.

This change inserts runAfterFramePaint where certain actions are triggered. Below are some screenshots indicating an improved INP for some of the buttons affected on controls with the highest INPs. The two places where this is added help with several actions, e.g. user + group cards, generic button action usage.
2024-07-22 10:59:39 +08:00
Krzysztof Kotlarek
f41716d532
FIX: drop fragment cache for flags (#28001)
Flags are stored in the memory of the process and a fragment cache is not necessary.
2024-07-22 12:37:33 +10:00
David Battersby
43aa47b118
FIX: experimental topics filter should allow tags with underscore (#27994)
When tags contain an underscore we should allow filtering in the same way, previously due to the regex those with underscores were not being found when filtering.
2024-07-20 00:58:29 +04:00
Joffrey JAFFEUX
8b18fd1556
FIX: do not reload identical route in drawer (#27992)
This is a performance optimisation to prevent the same route to keep reloading the same endpoint.

No tests as it's not changing behavior and is also quite complex to test efficiently.
2024-07-19 22:27:32 +02:00
Natalie Tay
346c9116b5
DEV: Allow system tests to assert on values at the correct time (#27988)
This adds some more assertions in system tests at certain instances during the test to minimise flakiness.
2024-07-20 00:39:22 +08:00