Commit Graph

9716 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan 859d61003e
DEV: API to register custom request rate limiting conditions (#30239)
This commit adds the `add_request_rate_limiter` plugin API which allows plugins to add custom rate limiters on top of the default rate limiters which requests by a user's id or the request's IP address.

Example to add a rate limiter that rate limits all requests from Googlebot under the same rate limit bucket:

```
add_request_rate_limiter(
  identifier: :country,
  key: ->(request) { "country/#{DiscourseIpInfo.get(request.ip)[:country]}" },
  activate_when: ->(request) { DiscourseIpInfo.get(request.ip)[:country].present? },
)
```
2024-12-23 09:57:18 +08:00
Keegan George 380910aedd
DEV: Cleanup todos from codebase (#30394)
This PR involves cleaning up the codebase from my (@keegangeorge's) todos. 

In particular:
- Remove Form Template related todos (these are no longer in the roadmap)
- Remove old left-over AI summarization related code after moving to AI (https://github.com/discourse/discourse-ai/pull/658)
- Update one form template related spec
2024-12-19 18:22:33 -08:00
Martin Brennan fa9606016c
UX: Site setting filter background inconsistencies (#30393)
Followup 203f93bcaf

This commit makes sure the background for all the admin
site settings filters (including the filter input and
override checkbox) is consistent no matter what the theme,
as it currently changes based on theme.
2024-12-20 10:51:35 +10:00
Martin Brennan b3fa335c7d
UX: Admin sidebar link changes (#30365)
Make all links in the admin sidebar follow https://meta.discourse.org/t/formatting-text-in-discourse-documentation-and-uis/324637

Remove the following links, and add keywords to their root links.
Email logs section is removed entirely.

* Email Settings > Preview Summary
* Email Logs > Sent
* Email Logs > Skipped
* Email Logs > Bounced
* Email Logs > Received
* Email Logs > Rejected
* Security > Error Logs
* Security > Screened Emails
* Security > Screened IPs
* Security > Screened URLs
* Security > Search Logs
* Advanced > Webhooks
2024-12-20 09:58:42 +10:00
Kris 2a3f0f3bef
UX: refactor IP lookup using DMenu to improve layout and positioning (#30374) 2024-12-19 14:49:36 -05:00
David Taylor b6002881e7
FIX: Simplify nginx config change (#30383)
The security fix in 15b43a2 also introduced some unrelated refactoring to the file, which seems to be causing issues in some environments. This commit reverts the refactoring, and applies the security fix to each block individually.
2024-12-19 19:10:00 +00:00
David Taylor d2979997e9
DEV: Introduce new 'glimmer topic list mode' site setting (#30375)
This replaces the previous group-based site setting
2024-12-19 17:38:35 +00:00
Keegan George d886c55f63
DEV: Reusable post-list component (#30312)
This update adds a  _new_ `<PostList />` component, along with it's child components (`<PostListItem/>` and `<PostListItemDetails />`). This new generic component can be used to show a list of posts.

It can be used like so:
```js
/**
 * A component that renders a list of posts
 *
 * @component PostList
 *
 * @args {Array<Object>} posts - The array of post objects to display
 * @args {Function} fetchMorePosts - A function that fetches more posts. Must return a Promise that resolves to an array of new posts.
 * @args {String} emptyText (optional) - Custom text to display when there are no posts
 * @args {String|Array} additionalItemClasses (optional) - Additional classes to add to each post list item
 * @args {String} titleAriaLabel (optional) - Custom Aria label for the post title
 * 
*/
```
```hbs
<PostList
    @posts={{this.posts}}
    @fetchMorePosts={{this.loadMorePosts}}
    @emptyText={{i18n "custom_identifier.empty"}}
    @additionalItemClasses="custom-class"
 />
```
2024-12-19 09:20:25 -08:00
Blake Erickson 17bdffc900 SECURITY: When enabled only allow Discourse Connect logins
If Discourse Connect is enabled no other methods for account creation or
authentication should be allowed.
2024-12-19 13:13:23 -03:00
Nat 15b43a205b SECURITY: Scrub headers to prevent access to files via nginx 2024-12-19 13:13:20 -03:00
Alan Guo Xiang Tan e4e5db57f0
DEV: Fix undefined method `check_email_sync_heartbeat` in unicorn conf (#30360)
This is a follow-up to 9812407f76
2024-12-19 10:10:11 +08:00
Krzysztof Kotlarek fdb6634fa9
FEATURE: settings tab for permalinks (#30192)
Setting tab should be added to permalinks so admins do not need to have left `/permalinks`.

A new component called `AreaSetting` was added to avoid duplications and
simplify adding settings to other sections.
2024-12-19 10:40:34 +11:00
Discourse Translator Bot 1631c39391
Update translations (#30319) 2024-12-18 15:19:37 +01:00
David Taylor a254577688
PERF: Cache public extra-locales requests in nginx (#30340)
extra-locales bundles have unique digests in their URLs, and include an indefinite cache-control header. Therefore we should include them in the heavily-cached group of URLs in NGINX.
2024-12-18 13:59:27 +00:00
Alan Guo Xiang Tan 9812407f76
FIX: Redo Sidekiq monitoring to restart stuck sidekiq processes (#30198)
This commit reimplements how we monitor Sidekiq processes that are
forked from the Unicorn master process. Prior to this change, we rely on
`Jobs::Heartbeat` to enqueue a `Jobs::RunHeartbeat` job every 3 minutes.
The `Jobs::RunHeartbeat` job then sets a Redis key with a timestamp. In
the Unicorn master process, we then fetch the timestamp that has been set
by the job from Redis every 30 minutes. If the timestamp has not been
updated for more than 30 minutes, we restart the Sidekiq process. The
fundamental flaw with this approach is that it fails to consider
deployments with multiple hosts and multiple Sidekiq processes. A
sidekiq process on a host may be in a bad state but the heartbeat check
will not restart the process because the `Jobs::RunHeartbeat` job is
still being executed by the working Sidekiq processes on other hosts.

In order to properly ensure that stuck Sidekiq processs are restarted,
we now rely on the [Sidekiq::ProcessSet](https://github.com/sidekiq/sidekiq/wiki/API#processes)
API that is supported by Sidekiq. The API provides us with "near real-time (updated every 5 sec)
info about the current set of Sidekiq processes running". The API
provides useful information like the hostname, pid and also when Sidekiq
last did its own heartbeat check. With that information, we can easily
determine if a Sidekiq process needs to be restarted from the Unicorn
master process.
2024-12-18 12:48:50 +08:00
Martin Brennan b5e2005d60
DEV: Unhide admin_sidebar_enabled_groups (#30336)
Followup 1bb33d15f2

Self-hosters still need access to this for now,
we will hide it on our own hosting.
2024-12-18 09:35:55 +10:00
Kris 284fe89165
UX: show correct message when creating topics is disabled by a tag (#30328) 2024-12-17 15:17:24 -05:00
Martin Brennan 0705857a47
DEV: Delete symlink when DiscourseFont path changes (#30294)
When adding new fonts to our discourse-fonts gem,
you may want to test these changes locally using the
`path` option of the gem line in bundler.

However we set a symlink for the fonts dir for public/fonts,
which does not get updated if the gem path changes. This
fix checks if the current symlink resolved path is equal to
the DiscourseFont gem path, and if not deletes + recreates it.
2024-12-17 13:57:03 +10:00
Ted Johansson c1c7ea8959
DEV: Change hide_email_address_taken default to true (#30293)
We're changing the default of hide_email_address_taken to true. This is a trade-off we want to make, as it prevents account enumeration with minimal impact on legitimate users. If you forget you have an account and try to sign up again with the same e-mail you'll receive an e-mail letting you know.
2024-12-17 10:46:04 +08:00
Sam 55a8184231
FEATURE: Reason and deleted content support in the review queue (#30295)
Add flag reason filter and improve handling of deleted content in review queue

This commit enhances the review queue with several key improvements:

1. Adds a new "Reason" filter to allow filtering flags by their score type
2. Improves UI for deleted content by:
   - Adding visual indication for deleted posts (red background)
   - Properly handling deleted content visibility for staff (category mods can not see deleted content)
3. Refactors reviewable score type handling for better code organization
4. Adds  tests for trashed topics/posts visibility

This change will help moderators more efficiently manage the review queue by
being able to focus on specific types of flags and better identify deleted
content.
2024-12-17 11:44:46 +11:00
Krzysztof Kotlarek a8bdc5f7c5
UX: display link to groups in admin sidebar (#30291)
Add groups link to admin and moderator sidebar for easy access.
Currently, the admin needs to go to `users` first.
2024-12-17 10:07:24 +11:00
David Taylor 78dacf773a
DEV: Ensure banned phrases do not occur in en translations (#30264)
This will help us keep consistency with things that we've decided to rename. Initial rules are for "color scheme" -> "color palette", and "private message" -> "personal message".

Also updates some remaining occurences of "color scheme" in our translation files.

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2024-12-13 16:02:32 +00:00
Joffrey JAFFEUX cbc0ece6e8
DEV: <DSelect /> (#30224)
`<DSelect />` is a wrapper similar to our existing `<DButton />` over the html element `<select>`. The code is ported from form kit which is now directly using `<DSelect />`. Note this component has also been used in edit topic timer modal.

This component is recommended for a small list of text items (no icons, no rich formatting...).

Usage:

```gjs
<DSelect class="my-select" @onChange={{this.handleChange}} as |select|>
  <select.Option @value="foo" class="my-favorite-option">Foo</select.Option>
  <select.Option @value="bar">Bar</select.Option>
</DSelect>
```

This commit comes with a set of assertions:

```gjs
import dselect from "discourse/tests/helpers/d-select-helper";
import { select } from "@ember/test-helpers";

assert
  .dselect(".my-select")
  .hasOption({ value: "bar", label: "Bar" })
  .hasOption({ value: "foo", label: "Foo" })
  .hasNoOption("baz");

await select(".my-select", "foo");

assert.dselect(".my-select").hasSelectedOption({value: "foo", label: "Foo"});
```
2024-12-13 10:40:06 +01:00
Jan Cernik 96417592a3
FIX: Show validation error on confirmation user fields (#30232)
* FIX: Show validation error on confirmation user fields

* test
2024-12-12 18:45:28 -03:00
Sérgio Saquetim c3e7d97048
DEV: Switch the glimmer post menu to auto and unsilence deprecations (#30161)
This commit starts the rollout of the Glimmer post menu:

- default to `auto`: after the upgrade, it will be enabled on all discourse instances that do not have incompatible customizations

- unsilence the deprecation messages in the console

- removes the setting `glimmer_post_menu_groups` as it's no longer in the test phase
2024-12-12 18:27:02 -03:00
moin-Jana 7c00c52c36
UX: Rename private to personal messages in the interface (#29679)
Rename "private messages" to "personal messages" in the interface
2024-12-12 11:44:19 +11:00
Discourse Translator Bot c65192a7a2
Update translations (#30202) 2024-12-10 20:16:34 +01:00
Sam 58e3e0cc4f
FEATURE: add support for "Flagged By" filter in reviewable (#30197)
Previous to this change there was no way to find all the flags
a user raised.

New filter allows you to find all the flags raised by a user.
2024-12-10 18:26:38 +11:00
Martin Brennan cd8e03086f
UX: Copy for feature feed toggle (#30196)
Makes it so the result of toggling a new feature
feed item is clearer.
2024-12-10 16:24:15 +10:00
Alan Guo Xiang Tan 2f65f36cae
DEV: Fix duplicated logging of unicorn worker backtraces (#30178)
In 6cafe59c76, we added a monkey patch to
`Unicorn::HtppServer#murder_lazy_workers` to log a message and send a
`USR2` signal to the Unicorn worker process when they Unicorn worker
process is 2 seconds away from being timed out by the Unicorn master
process. However, we ended up loggging multiple messages and sending
multiple USR2 signal during the 2 seconds before the Unicorn worker
process hit the time out.

To overcome this problem, we will now set an instance variable on the
`Unicorn::Worker` instance and use it to ensure that the log message is
only logged once and USR2 signal to the Unicorn worker process is only
sent one as well.
2024-12-10 06:47:33 +08:00
Jan Cernik ca0ea3d201
FIX: Improve name validation in the signup form (#30150) 2024-12-09 12:06:59 -03:00
Osama Sayegh acc180611f
FEATURE: Add an option to block IPs and emails to bulk user delete (#29993)
This commit adds an option for blocking the IP and email addresses when bulk-deleting users.

Internal topic: t/140321/11.
2024-12-09 14:25:31 +03:00
Discourse Translator Bot 4f8293e78f
Update translations (#30148) 2024-12-06 18:04:53 +01:00
Alan Guo Xiang Tan 58556ed434
DEV: Drop `experimental_topics_filter` site setting take 2 (#30142)
This is a follow-up to e6fdfcdcd2 which
did not remove the site setting from `config/site_settings.yml` and drop
the site setting value from the database.
2024-12-06 08:10:38 -05:00
Joffrey JAFFEUX 5ad09f7564
DEV: adds default option to form-kit select (#30126)
This commit will now show a "Select..." option when no value selected and a "None" option when a value is selected, as the first row. It ensures that people don't think a value is selected when it's actually just the html select showing the first available option.
2024-12-05 13:52:22 +01:00
Ella E. c817a94c89
UX: Move revoked API key status to dedicated column (#30125)
* DEV: add table heading for status

* UX: Move revoked status to its own column with a badge; remove revoked icon

* UX: Increase text contrast for revoked rows
2024-12-05 04:24:01 -07:00
Discourse Translator Bot 838d7478c1
Update translations (#30062) 2024-12-04 11:59:28 +01:00
Martin Brennan 9c5eb7952e
UX: Improve error when trying to edit globally shadowed setting (#30092)
Previously when attempting to edit a globally shadowed setting, the
error message was not very helpful, it said "You are not allowed to
change hidden settings". This commit changes the error message to
reflect the actual problem, which is that the setting is shadowed by
a global setting via ENV var.
2024-12-04 13:41:32 +10:00
Martin Brennan 45c9d1d81f
FIX: Remove some mandatory_values for reserved_usernames (#30089)
Followup 56df077931

This removes info, support, and community as mandatory
values for the reserved_usernames site setting. These
could arguably be useful for admins generally. The rest
can stay as-is as they are much more likely to be
confusing to members.

c.f. https://meta.discourse.org/t/default-reserved-usernames-can-not-be-deleted/336020
2024-12-04 10:19:15 +10:00
Mark Doerr f6df8832e2
UX: Update `allow_index_in_robots_txt` site setting description (#29901)
Update indexing site setting description to more adequately warn about the dangers of making changes
2024-12-03 11:17:13 +01:00
Gary Pendergast 2513339955
FEATURE: Show when a badge has been granted for a post (#29696)
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2024-12-03 13:43:27 +11:00
Alan Guo Xiang Tan c70816611f
DEV: Allow webp images to be served directly by nginx (#30050)
This fixes a typo that was introduced in baa5389a23
2024-12-03 06:26:13 +08:00
Martin Brennan 1bb33d15f2
DEV: Hide admin_sidebar_enabled_groups (#30025)
We are hiding this site setting because we no longer
support the old horizontal admin nav, and this setting
will be going away soon.
2024-12-02 11:06:00 +10:00
Krzysztof Kotlarek 6d4c6ee154
UX: admins users page follows admin ux guideline (#29873)
Conversion of `/admin/users` page to follow admin UX guidelines.

In addition, add the username to the title on the user admin page.
2024-12-02 10:11:23 +11:00
Bianca Nenciu 5abee8ac6b
DEV: Log number of live slots used by requests (#29884) 2024-11-28 18:25:48 +02:00
Jan Cernik 3c884e693c
FIX: Localization for custom signup form descriptions (#29982) 2024-11-28 11:48:58 -03:00
Loïc Guitaut 1e8f43ec0a DEV: Increase pool connections to 2 in test environment
In our CI env, sometimes, we see problems regarding getting a connection
from the pool. As it’s currently set to 1, increasing it a bit should
fix that kind of issues.
2024-11-28 12:23:25 +01:00
Ted Johansson 2d945e2373
DEV: Enable the normalize_emails site setting by default (#29952) 2024-11-28 10:23:00 +08:00
Jan Cernik b4ef3456d9
FEATURE: Allow to customize the signup form descriptions (#29959) 2024-11-27 14:23:14 -03:00
Guhyoun Nam f186e3e80b
DEV: Add categories_and_hot Route (#29948)
This PR adds a route to categories_and_hot and methods in categories_controller.
2024-11-27 11:11:33 -06:00