Commit Graph

53437 Commits

Author SHA1 Message Date
Joffrey JAFFEUX 76953cc356
FEATURE: allows to force a thread (#25987)
Forcing a thread will work even in channel which don't have `threading_enabled` or in direct message channels.

For now this feature is only available through the `ChatSDK`:

```ruby
ChatSDK::Message.create(in_reply_to_id: 1, guardian: guardian, raw: "foo bar baz", channel_id: 2, force_thread: true)
```
2024-03-06 12:03:42 +01:00
Alan Guo Xiang Tan 898b71da88
PERF: Add indexes to speed up notifications queries by user menu (#26048)
Why this change?

There are two problematic queries in question here when loading
notifications in various tabs in the user menu:

```
SELECT "notifications".*
FROM "notifications"
LEFT JOIN topics ON notifications.topic_id = topics.id
WHERE "notifications"."user_id" = 1338 AND (topics.id IS NULL OR topics.deleted_at IS NULL)
ORDER BY notifications.high_priority AND NOT notifications.read DESC,
  NOT notifications.read AND notifications.notification_type NOT IN (5,19,25) DESC,
  notifications.created_at DESC
LIMIT 30;
```

and

```
EXPLAIN ANALYZE SELECT "notifications".*
FROM "notifications"
LEFT JOIN topics ON notifications.topic_id = topics.id
WHERE "notifications"."user_id" = 1338
AND (topics.id IS NULL OR topics.deleted_at IS NULL)
AND "notifications"."notification_type" IN (5, 19, 25)
ORDER BY notifications.high_priority AND NOT notifications.read DESC, NOT notifications.read DESC, notifications.created_at DESC LIMIT 30;
```

For a particular user, the queries takes about 40ms and 26ms
respectively on one of our production instance where the user has 10K notifications while the site has 600K notifications in total.

What does this change do?

1. Adds the `index_notifications_user_menu_ordering` index to the `notifications` table which is
   indexed on `(user_id, (high_priority AND NOT read) DESC, (NOT read)
DESC, created_at DESC)`.

1. Adds a second index `index_notifications_user_menu_ordering_deprioritized_likes` to the `notifications`
   table which is indexed on `(user_id, (high_priority AND NOT read) DESC, (NOT read AND notification_type NOT IN (5,19,25)) DESC, created_at DESC)`. Note that we have to hardcode the like typed notifications type here as it is being used in an ordering clause.

With the two indexes above, both queries complete in roughly 0.2ms. While I acknowledge that there will be some overhead in insert,update or delete operations. I believe this trade-off is worth it since viewing notifications in the user menu is something that is at the core of using a Discourse forum so we should optimise this experience as much as possible.
2024-03-06 16:52:19 +08:00
Ella E f935b2ca6d
UX: Add sidebar icon (#26046) 2024-03-06 18:24:37 +10:00
Alan Guo Xiang Tan 7f7ef60a7b
FIX: Update Discobot's `UserProfile#bio_raw` when default locale changes (#26045)
Why this change?

When a site's default locale is changed, Discobot's `UserProfile#bio_raw` is not
changed and we have gotten reports about this.

What does this change do?

This change adds a `DiscourseEvent.on(:site_setting_changed)` callback
which watches for changes to the `default_locale` site setting and
updates Discobot's `UserProfile#bio_raw` when it changes.
2024-03-06 11:42:20 +08:00
Alan Guo Xiang Tan 3491642f98
DEV: Make `discourse_narrative_bot` use Rails autoload (#26044)
Why this change?

Instead of manually loading files, we should just structure the plugin
so that it relies on Rails autoload strategy and avoid all the manual
`require_relative`s.

What does this change do?

1. Structure the plugin to use Rails autoloading convention
2. Remove onceff jobs that were added 5-6 years ago. There is no need to
   carry these jobs anymore after such a long time.
3. Move setting of `SiteSetting.discourse_narrative_bot_enabled` to
   `false` in the test environment from core into the plugin.
2024-03-06 11:14:53 +08:00
Kelv 6b46b9ab78
DEV: convert TopicMapExpanded widget to glimmer component (#26027)
* DEV: add topic-map-expanded glimmer component

* DEV: remove topic-map-expanded widgets from topic-map

* DEV: add noreferrer for _blank target and add table grouping to template

* DEV: negate base styling of tbody element so expanded topic map retains current look

* DEV: pass in title to TopicParticipants as internationalized string instead of renderable HTML and set TRUNCATED_LINKS_LIMIT constant
2024-03-06 08:38:35 +08:00
Chris Pelatari b3dce458d2
DEV: Support `yarn dev` 2024-03-06 08:25:46 +08:00
Alan Guo Xiang Tan 94b09f3331
DEV: Open theme settings objects editor from admin customize theme page (#26006)
Why this change?

The `/admin/customize/themes/:id/schema/name` route is a work in
progress but we want to be able to start navigating to it from the
`/admin/customize/themes/:id` route.

What does this change do?

1. Move `adminCustomizeThemes.schema` to a child route of
   `adminCustomizeThemes.show`. This is because we need the model
   from the parent route and if it isn't a child route we end up
   having to load the theme model again from the server.

1. Add the `objects_schema` attribute to `ThemeSettingsSerializer`

1. Refactor `SiteSettingComponent` to be able to render a button
   so that we don't have to hardcode the button rendering into the
   `SiteSettings::String` component
2024-03-06 08:24:29 +08:00
Sérgio Saquetim 81ede05005
DEV: Added `has_option_value` test to SelectKit system spec component (#26041) 2024-03-06 07:04:05 +08:00
dependabot[bot] 475333c787
Build(deps-dev): Bump puppeteer-core from 22.3.0 to 22.4.0 (#26038)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from 22.3.0 to 22.4.0.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
- [Changelog](https://github.com/puppeteer/puppeteer/blob/main/release-please-config.json)
- [Commits](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v22.3.0...puppeteer-core-v22.4.0)

---
updated-dependencies:
- dependency-name: puppeteer-core
  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-03-06 07:02:24 +08:00
dependabot[bot] 74db5b3232
Build(deps-dev): Bump html-entities from 2.4.0 to 2.5.2 (#26021)
Bumps [html-entities](https://github.com/mdevils/html-entities) from 2.4.0 to 2.5.2.
- [Release notes](https://github.com/mdevils/html-entities/releases)
- [Changelog](https://github.com/mdevils/html-entities/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mdevils/html-entities/compare/v2.4.0...v2.5.2)

---
updated-dependencies:
- dependency-name: html-entities
  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-03-05 22:56:43 +01:00
dependabot[bot] 3ff1f762b6
Build(deps-dev): Bump parallel_tests from 4.5.1 to 4.5.2 (#26036)
Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 4.5.1 to 4.5.2.
- [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md)
- [Commits](https://github.com/grosser/parallel_tests/compare/v4.5.1...v4.5.2)

---
updated-dependencies:
- dependency-name: parallel_tests
  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-03-05 22:43:56 +01:00
dependabot[bot] bdf429cce8
Build(deps-dev): Bump lefthook from 1.6.4 to 1.6.5 (#26020)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.6.4 to 1.6.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.6.4...v1.6.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-03-05 22:43:38 +01:00
Ella E 822ebb9642
FIX: <td> spacing on expanded table (#26037) 2024-03-05 14:36:00 -07:00
Gerhard Schlager bc98740205
DEV: Improve generic import script (#25972)
* FEATURE: Import into `category_users` table
* FIX: Failed to import `user_options` unless `timezone` was set
* FIX: Prevent reusing original `id` from intermediate DB in `user_fields`
* FEATURE: Order posts by `post_nuber` if available
* FEATURE: Allow `[mention]` placeholder to reference users by"id" or "name" (username)
* FEATURE: Support `[quote]` placeholders in posts
* FEATURE: Support `[link]` placeholders in posts
* FEATURE: Support all kinds of permalinks and remove support for `old_relative_url`
* PERF: Speed up pre-cooking by removing DB lookups
2024-03-05 22:23:36 +01:00
Kris 5c1147adf3
UX: Move top dismiss button from `topics` to `d-navigation` (#26032) 2024-03-05 15:43:07 -05:00
Joffrey JAFFEUX 0c827980e6
FIX: do not show threads with no replies (#26033)
Prior to this fix if a user had started to reply to a message without actually sending a message, the thread would still be created and we would end up listing it in the threads list of a channel.

This commit also improves adds thread and thread_replies_count to the 4th parameter of the chat_message_created event.
2024-03-05 20:26:35 +01:00
chapoi f99687e10d
UX: fix fontsize and weight for prioritize username setting (#26034) 2024-03-05 19:42:24 +01:00
Isaac Janzen bf02657dbf
DEV: Add system test for soft loading topic search results (#25525)
Follow up to: https://github.com/discourse/discourse/pull/25504
2024-03-05 09:10:09 -07:00
Discourse Translator Bot 6791eb1a94
Update translations (#26030) 2024-03-05 16:47:46 +01:00
Blake Erickson 6702babd5e
DEV: More bulk select modal enhancements (#25979)
* Add cancel button

* Add loading spinner

* Add toast message
2024-03-05 08:30:26 -07:00
Gerhard Schlager 38ff1a38bd
DEV: Improve uploads_importer script (#25971)
* Print instructions when the `sqlite3` gem can't be loaded
* Use `display_filename` instead of `filename` if available
* Support uploading for a multisite
2024-03-05 16:27:45 +01:00
David Taylor ccf0b61fe3
DEV: Convert truth-helpers to a v2 addon and simplify imports (#26029)
No need for a build step here, since the helpers are all simple js.
2024-03-05 15:24:47 +00:00
chapoi 180e6c6188
UX: chat message creator scss cleanup + design tweak to username display (#25928)
* UX: chat message creator scss cleanup + design tweak to username display

* add user status with live updates to modal

* show user status description in modal

* add tests for user status

* UX: add user-status styling to chat message creator


---------

Co-authored-by: David Battersby <info@davidbattersby.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-03-05 12:49:29 +01:00
David Taylor 2f9db62e1c
DEV: Skip babel for qunit and sinon (#26028)
Skipping babel for qunit is part of the default embroider blueprint. Adding these doesn't seem to have a measurable effect on build time, but it does stop this message from being printed in the build log:

```
The code generator has deoptimised the styling of /Users/david/discourse/discourse/node_modules/sinon/pkg/sinon-esm.js as it exceeds the max of 500KB
```
2024-03-05 11:34:51 +00:00
Joffrey JAFFEUX 27407a25b4
FIX: correctly shows as disabled a user who can't chat (#26010)
Prior to this fix we were checking if user was not part of a group which allows to chat, but we were not checking if this user was part of groups who can use direct messages.
2024-03-05 09:13:42 +01:00
Jeff Wong 00e76efb7c
FEATURE: site setting to include post in penalty messages (#26025)
Adds a site setting to include a post's content in penalty message.
When silencing/suspending a user from a post, or a reviewable with
a post, adds an option to include a post's content in the email
message by default.
2024-03-04 18:35:21 -08:00
Krzysztof Kotlarek 28af4031ae
FIX: active webhook types exclude inactive plugins (#26022)
Bug introduced when webhooks were granularized in this PR - c468110929

Only active webhooks should be available when webhooks is configured.

https://meta.discourse.org/t/i18n-keys-showing-on-webhooks-edit-page/297701
2024-03-05 12:47:04 +11:00
dependabot[bot] 447ed2c06c
Build(deps-dev): Bump rubocop-rspec from 2.27.0 to 2.27.1 (#26017)
Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.27.0 to 2.27.1.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.27.0...v2.27.1)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  dependency-type: indirect
  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-03-05 10:04:24 +11:00
Kris ce3ff7d7f5
UX: always show image controls on touch devices (#26018) 2024-03-04 17:19:09 -05:00
Blake Erickson 40b707a690
FEATURE: Add onebox for loom (#26016)
Loom share links will now onebox and use the embedded loom player.
2024-03-04 15:12:08 -07:00
David Taylor b788c08712
FEATURE: Introduce APIs for manipulating header icons (#25916) 2024-03-04 12:51:49 -07:00
Isaac Janzen 405bfba3c0
DEV: Convert `home-logo` widget to a glimmer component (#25989)
Part of the larger effort to upgrade the header from widgets to glimmer components: https://github.com/discourse/discourse/pull/25214
2024-03-04 10:02:23 -07:00
Mark VanLandingham 04b0f40db8
DEV: Modifier for Chat::Mailer to skip summary email for users (#26011) 2024-03-04 09:21:02 -06:00
Loïc Guitaut f7d7092a7a DEV: Update rubocop-discourse to latest version
The lastest version of rubocop-discourse enables rules regarding
plugins.
2024-03-04 15:08:35 +01:00
Joffrey JAFFEUX 7a6ba47e7b
DEV: quit session asap (#26009) 2024-03-04 11:50:13 +01:00
Joffrey JAFFEUX 3be5daae37
DEV: skip flakey last read spec (#26008) 2024-03-04 11:35:49 +01:00
Alan Guo Xiang Tan 7036a4295d
DEV: Fix migration that adds index to `incoming_emails` `topic_id` (#26007)
Why this change?

Follow up to f880f1a42f. When adding an
index concurrently where the database transaction is disabled, we have
to ensure that we drop the index first if it exists because an invalid
index can be created if the migration has failed before.
2024-03-04 16:52:20 +08:00
Alan Guo Xiang Tan 955339668b
FIX: `ThemeSettingsObjectValidator` not allowing URL paths for string (#26005)
Why this change?

Prior this change, we were using `URI.regexp` which was too strict as it
doesn't allow a URL path.

What does this change do?

Just parse the string using `URI.parse` and if it doesn't raise an error
we consider the string to be a valid URL
2024-03-04 13:22:14 +08:00
Michael Fitz-Payne f880f1a42f
DEV: add topic_id index to incoming_emails table (#26004)
This table may grow to be large, and an index on this column improves
performance for SELECT queries.
2024-03-04 13:50:01 +10:00
Martin Brennan 718a91c297
UX: Site setting descriptions initial pass (#25829)
This commit changes the wording of the 50 site settings that
previously had the shortest descriptions (e.g. City for Disputes
was described as City for Disputes...) using AI-generated and then
human curated descriptions based on the Forum Helper persona
on Discourse Meta.

In future we may want to do more of these, this is only a first pass.

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2024-03-04 13:48:39 +10:00
Martin Brennan eca10e56b8
FEATURE: Allow specific groups to view raw email (#26003)
When a post is created by an incoming email, we show
an envelope icon on it which then opens a modal with the
raw email contents. Previously this was staff (admin+mod)
only, but now this commit adds the `view_raw_email_allowed_groups`
site setting, so any group can be added to give users permission
to see this.
2024-03-04 13:48:16 +10:00
Martin Brennan fef52c2ab7
DEV: Delete old enable_bookmarks_with_reminders setting (#25982)
This setting has not been used for a long time, get rid
of it and also update the historical migration to not
rely on the SiteSetting model.
2024-03-04 13:48:04 +10:00
Kelv 1a76c4e099
DEV: convert PrivateMessageMap widget to glimmer components (#25837)
* DEV: add map system test for private message map
* DEV: convert PrivateMessageMap to glimmer components
2024-03-04 10:24:25 +08:00
dependabot[bot] 13230ae4c2
Build(deps): Bump json_schemer from 2.1.1 to 2.2.0 (#25998)
Bumps [json_schemer](https://github.com/davishmcclurg/json_schemer) from 2.1.1 to 2.2.0.
- [Changelog](https://github.com/davishmcclurg/json_schemer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/davishmcclurg/json_schemer/compare/v2.1.1...v2.2.0)

---
updated-dependencies:
- dependency-name: json_schemer
  dependency-type: direct:production
  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-03-04 09:05:22 +08:00
dependabot[bot] 5a1892479b
Build(deps-dev): Bump rubocop-rspec from 2.26.1 to 2.27.0 (#25999)
Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.26.1 to 2.27.0.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.26.1...v2.27.0)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  dependency-type: indirect
  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-03-04 09:05:03 +08:00
dependabot[bot] 1e7525e818
Build(deps-dev): Bump rubocop-ast from 1.31.0 to 1.31.1 (#26000)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.31.0 to 1.31.1.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-ast/compare/v1.31.0...v1.31.1)

---
updated-dependencies:
- dependency-name: rubocop-ast
  dependency-type: indirect
  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-03-04 09:04:18 +08:00
dependabot[bot] 70748cf276
Build(deps-dev): Bump xss from 1.0.14 to 1.0.15 (#26001)
Bumps [xss](https://github.com/leizongmin/js-xss) from 1.0.14 to 1.0.15.
- [Changelog](https://github.com/leizongmin/js-xss/blob/master/CHANGELOG.md)
- [Commits](https://github.com/leizongmin/js-xss/compare/v1.0.14...v1.0.15)

---
updated-dependencies:
- dependency-name: xss
  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-03-04 09:04:07 +08:00
Krzysztof Kotlarek 41f78b31a9
FIX: down downgrade trust level if all requirements are met. (#25953)
Currently, the trust level method  is calculating trust level based on maximum value from:
- locked trust level
- group automatic trust level
- previously granted trust level by admin

https://github.com/discourse/discourse/blob/main/lib/trust_level.rb#L33

Let's say the user belongs to groups with automatic trust level 1 and in the meantime meets all criteria to get trust level 2.

Each time, a user is removed from a group with automatic trust_level 1, they will be downgraded to trust_level 1 and promoted to trust_level 2

120a2f70a9/lib/promotion.rb (L142)

This will cause duplicated promotion messages.

Therefore, we have to check if the user meets the criteria, before downgrading.
2024-03-04 09:30:30 +11:00
Lilly b5199eac80
Update a typographer markdown settings text on server.en.yml (#25996)
Remove (c) from enable_markdown_typographer_settings text
2024-03-03 02:48:44 -08:00