Commit Graph

54348 Commits

Author SHA1 Message Date
Osama Sayegh
361992bb74
FIX: Apply crawler rate limits to cached requests (#27174)
This commit moves the logic for crawler rate limits out of the application controller and into the request tracker middleware. The reason for this move is to apply rate limits to all crawler requests instead of just the requests that make it to the application controller. Some requests are served early from the middleware stack without reaching the Rails app for performance reasons (e.g. `AnonymousCache`) which results in crawlers getting 200 responses even though they've reached their limits and should be getting 429 responses.

Internal topic: t/128810.
2024-05-27 16:26:35 +03:00
Juan David Martínez Cubillos
7992d7a65a
DEV: Refactor to add Custom emoji sanitization (#24368)
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-05-27 15:24:55 +02:00
Anatolii Prybylovych
51e02e0d31
DEV: Add reviewable id data attribute and plugin outlet for reviewable actions (#25311) 2024-05-27 15:15:18 +02:00
Krzysztof Kotlarek
f5516b8088
DEV: clean after replacing flags spec (#27194)
After flags are replaced, we need to bring the state back to the original. Otherwise, it causes flaky specs.
2024-05-27 19:57:41 +08:00
Alan Guo Xiang Tan
3c0e672fc4
PERF: PostTiming.pretend_read to not update TopicUser cache columns (#27201)
This commit splits out the updating of `TopicUser#last_read_post_number` in
`TopicUser.ensure_consistency!` to a new
`TopicUser.update_last_read_post_number` method` which
`PostTiming.pretend_read` will now call instead. Previously,
`PostTiming.pretend_read` calls `TopicUser.ensure_consistency!` which in
turn calls `TopicUser.update_post_action_cache` but that is
unnecessary for `PostTiming.pretend_read` since `PostTiming.pretend_read` does not
affect the `TopicUser#liked` or `TopicUser.bookmarked` columns which
`TopicUser.update_post_action_cache` updates. As the query in
`TopicUser.update_post_action_cache` can be expensive, we should avoid
calling it when it isn't necessary.

One such scenario where it is unnecessary is when we are closing a
topic.
2024-05-27 19:56:33 +08:00
dependabot[bot]
f9df40cc5c
Build(deps-dev): Bump webmock from 3.23.0 to 3.23.1 (#27192)
Bumps [webmock](https://github.com/bblimke/webmock) from 3.23.0 to 3.23.1.
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bblimke/webmock/compare/v3.23.0...v3.23.1)

---
updated-dependencies:
- dependency-name: webmock
  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-05-27 11:42:32 +02:00
dependabot[bot]
0a11327704
Build(deps-dev): Bump rubocop from 1.63.5 to 1.64.0 (#27191)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.63.5 to 1.64.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.63.5...v1.64.0)

---
updated-dependencies:
- dependency-name: rubocop
  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-05-27 11:42:14 +02:00
dependabot[bot]
4789536d55
Build(deps): Bump google-protobuf from 4.26.1 to 4.27.0 (#27190)
Bumps [google-protobuf](https://github.com/protocolbuffers/protobuf) from 4.26.1 to 4.27.0.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

---
updated-dependencies:
- dependency-name: google-protobuf
  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-05-27 11:42:03 +02:00
dependabot[bot]
ed21f34eeb
Build(deps-dev): Bump glob from 10.3.16 to 10.4.1 (#27186)
Bumps [glob](https://github.com/isaacs/node-glob) from 10.3.16 to 10.4.1.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.3.16...v10.4.1)

---
updated-dependencies:
- dependency-name: glob
  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-05-27 11:41:43 +02:00
dependabot[bot]
a2bbf571a8
Build(deps): Bump zeitwerk from 2.6.14 to 2.6.15 (#27189)
Bumps [zeitwerk](https://github.com/fxn/zeitwerk) from 2.6.14 to 2.6.15.
- [Changelog](https://github.com/fxn/zeitwerk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fxn/zeitwerk/compare/v2.6.14...v2.6.15)

---
updated-dependencies:
- dependency-name: zeitwerk
  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-05-27 11:40:07 +02:00
dependabot[bot]
1a04f1cf33
Build(deps-dev): Bump puppeteer-core from 22.9.0 to 22.10.0 (#27188)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from 22.9.0 to 22.10.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.9.0...puppeteer-core-v22.10.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-05-27 11:39:55 +02:00
dependabot[bot]
4b061c4a8c
Build(deps-dev): Bump esbuild from 0.21.3 to 0.21.4 (#27187)
Bumps [esbuild](https://github.com/evanw/esbuild) from 0.21.3 to 0.21.4.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.21.3...v0.21.4)

---
updated-dependencies:
- dependency-name: esbuild
  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-05-27 11:38:37 +02:00
dependabot[bot]
4d7869d731
Build(deps): Bump the babel group with 2 updates (#27185)
Bumps the babel group with 2 updates: [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) and [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/core` from 7.24.5 to 7.24.6
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-core)

Updates `@babel/standalone` from 7.24.5 to 7.24.6
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
- dependency-name: "@babel/standalone"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-27 11:25:56 +02:00
Discourse Translator Bot
9d8044a2ee
FEATURE: Add Uyghur language (#27183)
Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2024-05-27 09:58:18 +02:00
Gerhard Schlager
5e61d55940
FIX: Updating avatar didn't trigger a rebake of posts with quotes of the user (#27184) 2024-05-27 09:57:48 +02:00
Gerhard Schlager
9aede9c8d8
FIX: "Replace Text" didn't list "Welcome Topic" when "General" category is missing (#27182)
Replacing the text of seeded topics doesn't require categories to exist, so this change removes that requirement for updates.
2024-05-27 09:57:30 +02:00
Sam
d1191b7f5f
FEATURE: topic_view_stats table with daily fidelity (#27197)
This gives us daily fidelity of topic view stats

New table stores a row per topic viewed per day tracking
anonymous and logged on views

We also have a new endpoint `/t/ID/views-stats.json` to get the statistics for the topic.
2024-05-27 15:25:32 +10:00
Alan Guo Xiang Tan
6cafe59c76
DEV: Add DISCOURSE_DUMP_BACKTRACES_ON_UNICORN_WORKER_TIMEOUT env (#27199)
This commit adds a `DISCOURSE_DUMP_BACKTRACES_ON_UNICORN_WORKER_TIMEOUT`
environment that will allow us to dump all backtraces for all threads of
a Unicorn worker 2 seconds before it times out. In development,
backtraces are dumped to `STDOUT` and in production we will dump it to
`unicorn.stdout.log`.

We want to dump all the backtraces to make it easier to identify the
cause of a Unicorn worker timing out.
2024-05-27 12:20:38 +08:00
Martin Brennan
3a91a92563
DEV: Remove hashtag deprecations (#27195)
Introduced in
c7860173c1,
they are no longer necessary once https://github.com/discourse/discourse-encrypt/pull/317
is merged
2024-05-27 14:00:36 +10:00
Ted Johansson
cb592ae4ac
DEV: Remove deprecated User#saw_notification_id method (#27175) 2024-05-27 11:10:46 +08:00
Juan David Martínez Cubillos
581dbca97f
DEV: Update Reviewables agree and edit action test (#27162) 2024-05-24 12:20:30 -07:00
Joffrey JAFFEUX
0260415664
FIX: correctly handle notifications for channels (#27178)
Prior to this fix we had too logic to detect if a user is active or not:

- idle codepath on the frontend
- online user ids on the backend

The frontend solution is not very reliable, and both solution are just trying to be too smart. Making a lot of people questioning why they receive a notification sometimes and sometimes not. This commit removes all this logic and replaces it with a much more simpler logic:

- you can't receive notifications for channel you are actually watching
- we won't play a sound more than once every 3seconds
2024-05-24 19:59:24 +02:00
Joffrey JAFFEUX
14b8894ddb
FIX: missing appEvents param for onNotification (#27180)
The `onNotification` signature is:

```
onNotification(data, siteSettings, user, appEvents)
```

And we were not passing `appEvents`.

Also explicitly inject `currentUser` in `chat-notification-manager` service.
2024-05-24 18:39:54 +02:00
Régis Hanol
bc089dc52b FIX: bypass fast edit when selected text isn't editable
When selected some text inside a post, we offer the ability to "fast edit" the selected text without opening the composer.

However, there are certain cases where this isn't working quite a expected, due to the fact that we have some text in the "cooked" version of the post that isn't literally in the "raw" version of the post.

This ensures that whenever someone selects the within

- a quote
- a onebox
- an encrypted message
- a "cooked" date

we directly show the composer instead of showing the fast edit modal and then leaving the user with an invisible error.

Internal ref. t/128400
2024-05-24 18:19:28 +02:00
dependabot[bot]
a658465b7d
Build(deps): Bump racc from 1.7.3 to 1.8.0 (#27119)
updated-dependencies:
- dependency-name: racc
  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-05-24 18:05:37 +02:00
dependabot[bot]
414086e9a5
Build(deps-dev): Bump glob from 10.3.15 to 10.3.16 (#27121)
updated-dependencies:
- dependency-name: glob
  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-05-24 18:05:18 +02:00
Joffrey JAFFEUX
5134e74e91
UX: also plays notification sounds in group channels (#27176)
Prior to this fix we were limiting this to 1:1 channels.
2024-05-24 17:48:07 +02:00
Mark VanLandingham
971b66e440
DEV: Move webhook event header modifier for redelivery-recalucation (#27177) 2024-05-24 10:37:10 -05:00
Ted Johansson
69205cb1e5
DEV: Catch missing translations during test runs (#26258)
This configuration makes it so that a missing translation will raise an error during test execution. Better discover there than after deploy.
2024-05-24 22:15:53 +08:00
Arpit Jalan
9db83c37e4
FIX: When creating new message via URL do not redirect (#27153)
* FIX: When creating new message via URL do not redirect

If a user clicks on `/new-message` route from inside the instance we're
redirecting the user to `/latest` page which is only intended if the
user is coming from an external site. This commit checks for this
condition and only redirects when user is coming from external source.

This also makes the behavior consistent with `new-topic` route.

Internal topic reference: `/t/-/129523/`
2024-05-24 17:25:37 +05:30
Selase Krakani
949c70372c
DEV: Add support for various fields in generic bulk importer (#27114)
* user_profiles - `location`
* users - `date_of_birth`
* topics - `pinned_at`, `pinned_until`, `pinned_globally`

This also include changes to correctly import PMs. Currently PM topics
are skipped because of a check in `import_users` step which requires `category_id`
to be present.
2024-05-24 13:46:06 +02:00
Joffrey JAFFEUX
d5066336ec
UX: reduces idle time to 0 on chat (#27158)
We consider that you should always receive a notification sound when someone speaks directly with you in chat.

This commit also refactors the way we play audio in chat to make it simpler and throttle it to 3 seconds.

We also added a safeguard to ensure we won't play sounds for old messages, this case can happen when message bus is catching up the backlog (eg: in an inactive tab for example).
2024-05-24 11:18:11 +02:00
David Battersby
c39a4de139
FIX: load existing chat dm channel via url (#26998)
When users click a link that points to an existing group chat, we should reopen that chat instead of creating a new group chat so users can more easily continue ongoing conversations.
2024-05-24 12:12:49 +04:00
Krzysztof Kotlarek
89401d5fc1
FIX: flaky user_merger_spec.rb (#27169)
Flag guardian spec needs to clean state after evaluation. Each created flag is adding PostActionType.
2024-05-24 15:23:59 +10:00
Krzysztof Kotlarek
99e27c4fd5
FIX: change around to after in flag spec (#27168) 2024-05-24 12:55:21 +10:00
Alan Guo Xiang Tan
df16ab0758
FIX: S3Inventory to ignore files older than last backup restore date (#27166)
This commit updates `S3Inventory#files` to ignore S3 inventory files
which have a `last_modified` timestamp which are not at least 2 days
older than `BackupMetadata.last_restore_date` timestamp.

This check was previously only in `Jobs::EnsureS3UploadsExistence` but
`S3Inventory` can also be used via Rake tasks so this protection needs
to be in `S3Inventory` and not in the scheduled job.
2024-05-24 10:54:06 +08:00
Krzysztof Kotlarek
a4c5f85b10
FIX: flaky post action counts specs (#27165)
After flags were moved to the database, with each save they are changing available PostActionTypes. Therefore, flag specs should clear the state before and after each example not just before.

In addition, we need to clear `nil` counts for dynamically created flags from serializer.
2024-05-24 11:55:32 +10:00
Jeff Wong
3a3ee5e04a
DEV: replace .each with .find_each for paginated queries (#27159)
Large batches of reviewables may require paginated queries.
2024-05-23 15:42:21 -07:00
Penar Musaraj
f9192835a7
FIX: Do not reset sidebar defaults in wizard (#27156)
We removed the option to enable/disable the sidebar in the wizard in
https://github.com/discourse/discourse/pull/26926, but these lines of
code were resetting it quietly to `header_dropdown`.
2024-05-23 16:45:47 -04:00
Jeff Wong
755f8de6d4
FEATURE: add agree and edit (#27088)
* FEATURE: add agree and edit

adds agree and edit - an alias for agree and keep -- but with a client action to
edit the post in the composer before the flag is agreed with

---------

Co-authored-by: Juan David Martinez <juan@discourse.org>
2024-05-23 11:21:42 -07:00
David Battersby
3f099ad268
UX: add space to following list (#27154)
Adds vertical spacing between follower/following list.
2024-05-23 17:26:15 +04:00
Jan Cernik
1ed1a1f96a
FIX: Add onebox support for x.com (#27140) 2024-05-23 10:25:42 -03:00
Jan Cernik
ebc3af90eb
DEV: More system specs for signup/login (#27150) 2024-05-23 10:01:05 -03:00
Ted Johansson
7b437c9401
FEATURE: Implement new required options in admin user fields UI (#27079)
We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
2024-05-23 19:18:25 +08:00
Joffrey JAFFEUX
f5e41f0627
FIX: correctly generate pm path on user (#27152)
Before this fix when generating a pm path leading to a group messages inbox we would blindly take the first group of the pm, however, it's possible our current user doesn't have access to this group.

This commit will now try to find the first group the user has access to, and generate a path to this group’s inbox.
2024-05-23 11:17:43 +02:00
Joffrey JAFFEUX
b3802e12f0
FIX: correct in_thread? message logic (#27151)
A message is in a thread if:
- it has a thread_id
- it is in threading_enabled channel OR the associated thread is marked as `force`
2024-05-23 11:08:55 +02:00
Alan Guo Xiang Tan
f84eda7c8d
FIX: Post#each_upload_url yielding external URLs (#27149)
This commit updates `Post#each_upload_url` to reject URLs that do not
have a host which matches `Discourse.current_hostname` but follows the
`/uploads/short-url` uploads URL format. This situation most commonly
happen when users copy upload URL link between different Discourse
sites.
2024-05-23 15:15:16 +10:00
Krzysztof Kotlarek
13848594d2
FIX: don't load database flag when database is disabled (#27148)
When the database is disabled, flags cannot be loaded. In that case, we should fallback to static FlagSetting.
2024-05-23 13:24:13 +10:00
chapoi
3655b41ee4
UX: add ellipsis to usernames in topic post map (PMs) (#27137) 2024-05-23 12:40:52 +10:00
Krzysztof Kotlarek
cfbbfd177c
DEV: move post flags into database (#27125)
This is preparation for a feature that will allow admins to define their custom flags. Current behaviour should stay untouched.
2024-05-23 12:19:07 +10:00