3927 Commits

Author SHA1 Message Date
zogstrip
bae4cd165f
SECURITY: mutex around adding users to a group DM
Whenever you are about to reach the limit of users in a group DM, if you
send requests to add new users in parallel, they might all go through
ignoring the limit due to a race condition.

Internal - t/145895
2025-03-26 09:26:41 +08:00
David Battersby
58819d0f69
SECURITY: respect allow private messages prefernce for DMs 2025-03-26 09:26:36 +08:00
Discourse Translator Bot
37e72e9ad7
Update translations (#31994) 2025-03-25 17:22:59 +01:00
Sam
afd5975041
FIX: looking at wrong period in statsText (#31986) 2025-03-25 17:18:02 +11:00
David Taylor
b4afe124b7
DEV: Remove raw-hbs from autocomplete implementation (#31957)
We intend to replace this JQuery autocomplete implementation soon. But
before that, we'd like to drop the raw-hbs compilation/runtime system.
Therefore, this commit does a 1:1 conversion of the autocomplete
templates to vanilla JS. They're fairly small/simple, so they're still
fairly readable.
2025-03-24 19:44:07 +00:00
Osama Sayegh
a8b3e539c7
FEATURE: Add setting to prevent anonymous users from using chat (#31842)
Currently, anonymous/shadow users go through the same permission checks
for chat as normal users do. This means that if a site has chat enabled
for all users, anonymous users also get access to chat. This may be
undesirable for some communities, so we're adding a new site setting
`allow_chat_in_anonymous_mode` to block access to chat for anonymous
users.

Internal topic: t/148088.
2025-03-21 13:32:52 +03:00
David Battersby
a43ad984b1
FEATURE: allow adding members to new 1-1 DM channels (#31948)
This change allows more flexibility when starting a 1-1 direct message
with another user. If there are no messages in the new DM channel then
we should still allow them to add additional users.
2025-03-21 12:20:21 +04:00
Sam
ad992d7b2d
FIX: destroy automation not working (#31945)
We had some legacy code due to previous controller based automation

---------

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2025-03-21 15:22:33 +11:00
Osama Sayegh
f7f7642ae0
UX: Improve naming for anonymous mode settings (#31832)
This PR renames a couple of settings related to anonymous mode:

1. `allow_anonymous_posting` → `allow_anonymous_mode`. This setting is
used as a switch for the entire anonymous mode feature, so it makes
sense to give it a generic name that better reflects what the setting
does.
2. `allow_anonymous_likes` → `allow_likes_in_anonymous_mode`. The new
name is clearer and will match a new setting that we'll add to allow
anonymous users to post in chat.

Internal topic: t/148088.
2025-03-21 04:54:06 +03:00
Sam
8c8bc94ed8
FEATURE: Add automation statistics tracking to Automation (#31921)
introduces comprehensive statistics tracking for the Discourse
Automation plugin, allowing users to monitor the performance and
execution patterns of their automations:

- Add `discourse_automation_stats` table to track execution metrics
including run counts, execution times, and performance data
- Create a new `Stat` model to handle tracking and retrieving automation
statistics
- Update the admin UI to display automation stats (runs today/this
week/month and last run time)
- Modernize the automation list interface using Glimmer components
- Replace the older enable/disable icon with a toggle switch for better
UX
- Add schema annotations to existing models for better code
documentation
- Include extensive test coverage for the new statistics functionality

This helps administrators understand how their automations are
performing and identify potential bottlenecks or optimization
opportunities.

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Ted Johansson <ted@discourse.org>
2025-03-21 12:53:26 +11:00
Sam
0e62acd57f
FEATURE: enhance post created edited trigger in automation (#31900)
1. **Multiselect Support for Choice Fields**
   - Added a `multiselect` option to the choices field component
   - Updated Field model to accept arrays as values for choices fields

2. **Post Content Feature Filtering**
   - Added ability to filter posts based on content features:
     - Posts with images
     - Posts with links
     - Posts with code blocks
     - Posts with uploads

3. **Improved Group Filtering**
- Renamed `restricted_user_group` to `restricted_groups` to allow
filtering by multiple groups
- Added `excluded_groups` to replace `ignore_group_members` which was
complex for end users
- Renamed `restricted_groups` to `restricted_inbox_groups` for more
specific PM filtering and clarity.

4. **Public Topics Filter**
- Added a "Public Topics" filter option that excludes all secure
categories
2025-03-20 08:05:06 +11:00
David Taylor
a017f566a8
DEV: [gjs-codemod] convert second batch of files to gjs
Updated using `@embroider/template-tag-codemod`, plus some manual fixups.

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-03-19 10:20:56 +00:00
Alan Guo Xiang Tan
b20f6bd620
DEV: Remove flaky system test (#31899)
This commit removes a flaky system test without replacement given that
the test isn't really testing something in the critical path or
something that happens often.

### Reviewer notes

Example of flakiness:

1.
https://github.com/discourse/discourse/actions/runs/13901410315/job/38893877234
2.
https://github.com/discourse/discourse/actions/runs/12362090310/job/34500684809
2025-03-19 12:20:23 +08:00
David Taylor
9e7384298b
DEV: Introduce postcss minmax transform (#31885)
This will auto-transform media query range syntax like `width < 100px`
into the more-widely-supported min/max-width syntax
2025-03-18 19:28:52 +00:00
Discourse Translator Bot
464da9a4fb
Update translations (#31875) 2025-03-18 15:08:14 +01:00
Alan Guo Xiang Tan
f09c8f61c8
DEV: Fix flaky automation system test (#31867)
This commit updates `PageObjects::Pages::Automation#update` to check
that the button is not disabled before clicking the button.

### Reviewer notes

Instances of flakiness:
1.
https://github.com/discourse/discourse/actions/runs/13864294630/job/38801362996
2.
https://github.com/discourse/discourse/actions/runs/13392214535/job/37402368070
2025-03-18 15:13:59 +08:00
Alan Guo Xiang Tan
1fea45eb0f
DEV: Skip flaky test (#31849)
The test has been flaking in CI with the following message:

```
Failure/Error: measurement = Benchmark.measure { example.run }

  expected: "draft"
       got: ""

  (compared using ==)

[Screenshot Image]: /__w/discourse/discourse/tmp/capybara/failures_r_spec_example_groups_chat_composer_draft_when_loading_a_channel_with_a_draft_loads_the_draft_458.png

~~~~~~~ JS LOGS ~~~~~~~
~~~~~ END JS LOGS ~~~~~

./plugins/chat/spec/system/chat_composer_draft_spec.rb:31:in `block (3 levels) in <main>'
```
2025-03-17 10:39:22 +08:00
Jordan Vidrine
31aa2b3783
UX: Remove bg color on presence indicator (#31835) 2025-03-14 11:31:33 -05:00
Renato Atilio
ba4ffd6836
FIX: replace positive lookbehind on checklist inputrule (#31827)
Not supported on iOS Safari <= 16.3
2025-03-14 07:31:21 -03:00
Martin Brennan
019b22c376
FIX: Incorrect chat DM group user count (#31813)
When creating a DM to a group in chat, we show
a count of users for that group if the number of
users exceeds SiteSetting.chat_max_direct_message_users.

However, we were also counting bot users here, we should
only be counting human users, this led to confusion because
the chat group count was different from the one on
e.g. /g/:group_name
2025-03-14 11:40:30 +10:00
Joffrey JAFFEUX
2503e95900
FIX: ensures chat context is given to emoji picker (#31794)
This was preventing favorites emojis to work correctly as it was using
topic context. No tests for now as it's a very specific behavior hard to
test with acceptance test and a system spec seems heavy for this.
2025-03-13 10:36:01 +01:00
Joffrey JAFFEUX
1f2043de4e
DEV: removes code block enter edge case (#31773)
This was causing some confusion and now that we have the chat preference
to send with enter or metakey+enter it's even more confusing.

If your setting is send on enter, you need to use shift+enter for a new
line, even in codeblocks. If your setting is meta+enter you need to use
enter in the codeblock for a new line, meta+enter will send as expected.
2025-03-12 18:01:00 +01:00
David Taylor
1d0d7ddbb5
DEV: [gjs-codemod] convert first batch of files to gjs
Updated using `@embroider/template-tag-codemod`, plus some manual fixups.

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-03-12 08:54:04 +00:00
Renato Atilio
623f02aff6
FEATURE: add details (plugin) rich editor extension (#31718)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds `details` and `summary` nodes, parsers, and serializers, and a
click handler to toggle the `open` attribute.

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2025-03-11 20:15:32 -03:00
Renato Atilio
968b851c1b
FEATURE: add spoiler (plugin) rich editor extension (#31717)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds `spoiler` and `inline_spoiler` nodes, parsers, and serializers, and
a click handler to toggle its blurriness in the editor.
2025-03-11 20:13:52 -03:00
Renato Atilio
7e23096d5e
FEATURE: add check (plugin) rich editor extension (#31716)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds a `check` node, parser, and serializer, and an input rule to
convert when typing `[]`/`[ ]`/`[x]`
2025-03-11 20:13:44 -03:00
Renato Atilio
049e65ffe2
FEATURE: add poll (plugin) rich editor extension (#31715)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds a `poll` node, parser, and serializer.
2025-03-11 20:13:27 -03:00
Renato Atilio
d1870d4811
FEATURE: add local-dates (plugin) rich editor extension (#31714)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds `local_date` and `local_date_range` nodes, parsers, and
serializers.
2025-03-11 20:13:09 -03:00
Discourse Translator Bot
d3c68ef1a7
Update translations (#31747) 2025-03-11 17:47:42 +01:00
Joffrey JAFFEUX
4433a72083
DEV: attempts to fix flakey drawer spec (#31749)
The setup was happening after the page has loaded which could lead to
inconsistent results.
2025-03-11 14:57:35 +01:00
Krzysztof Kotlarek
54771b5949
FIX: remove admin_sidebar_enabled_groups setting (#31693)
Old no sidebar admin panel is deprecated and admin sidebar is not
experimental anymore. Therefore, old setting should be deleted.
2025-03-11 11:41:38 +11:00
Jarek Radosz
25048b5a8d
DEV: Update lint-configs and rubocop-discourse (#31728)
…and autofix issues

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-03-10 19:52:19 +01:00
Alan Guo Xiang Tan
19acb61834
DEV: Remove unnecessary require (#31727)
`DistributedMutex` is eager loaded in production/test and autoloaded in
development.
2025-03-10 16:56:56 +08:00
Sam
50310ea96d
FEATURE: improve post_created_edited automation triggers (#31694)
- Allow deciding if we include or exclude sub categories
- Allow filtering to only look at PMs or Topics
- Allow selection of multiple categories
- Migrations to carry all data into new structure

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-03-08 08:18:30 +11:00
David Battersby
914543dbb9
FIX: dont allow channel non-members to write messages in threads (#31697)
Prevents channel non-members from seeing the composer in threads. Since
they do not have the correct permissions to post within the channel, we
should show the join channel CTA in place of the chat composer.
2025-03-07 15:50:30 +04:00
Krzysztof Kotlarek
4bb1e0d113
FIX: loop detection works as expected and does not need logging (#31686)
Logging creates impression that something is not working while
everything is working as expected.
2025-03-07 16:41:29 +11:00
Kris
1b95a8e1e0
DEV: replace zero width space character in chat typing indicator (#31675)
We were using a zero width space added by CSS here, but have run into
occasional encoding issues for some reason? a couple people have
reported getting this instead of an empty space:


![image](https://github.com/user-attachments/assets/da39b5f5-61b0-423c-ae3e-18169e4f2f71)

I can't repro the issue, but we can avoid it by removing this space in
CSS — setting the container height to `1em` along with `line-height:
normal` should make it consistent with the height of the text within.

In the blame it seems this static height on the container was added
after the pseudo hack, and achieves the same goal when I test it across
a Firefox/Chrome/Safari
2025-03-06 15:53:50 -05:00
Joffrey JAFFEUX
fb76696f45
UX: removes per channel context of favorites emojis (#31671)
This was confusing users.
2025-03-06 16:07:58 +01:00
Jarek Radosz
28e00d9bfe
DEV: Update lint-configs and autofix issues (#31620)
This updates us to Prettier 3.x
2025-03-05 01:20:16 +01:00
Discourse Translator Bot
b467fe1347
Update translations (#31617) 2025-03-04 16:12:11 +01:00
Jarek Radosz
3aa383a4de
UX: Tweak footnote button styling (#31595)
1. remove the margin (it's displayed inline with text, so having a left
margin didn't make sense)
2. use em unit in min-height
3. slighty tighten the button (inline padding 0.5em -> 0.4em) so it's
more proportional
2025-03-04 01:24:27 +01:00
Joffrey JAFFEUX
d38acc5df1
DEV: discourse-emojis gem (#31408)
This commit moves most of emoji logic into the discourse-emojis gem:
https://github.com/discourse/discourse-emojis/

Most notably:
- images are now symlinked from the gem
- the gem provides path to the json files

Search aliases have also been made asynchronous and memoized. When you
will search for an emoji we will now load the aliases and store the list
for future use.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-03-03 13:09:08 +01:00
Ted Johansson
c0bbff598a
FEATURE: Allow admins to access group chats (#31440)
In #31366, we added the ability for admins to remove people from group chats. However, that only works as long as the admin is already in the group chat.

For forum-side group messages, admins can join any of them at will. This PR extends that same ability to chat for parity.
2025-03-03 09:20:13 +08:00
Martin Brennan
bf287b4560
FIX: Duplicate error for chat messages for upload-only messages (#31539)
This commit fixes an issue where if you tried to post
2 chat messages in quick succession which only contained
uploads (both `message` fields would be `""`), then we
would show the "You posted an identical message too recently."
error.

We should not do this for upload-only messages, they
are not identical messages.
2025-02-27 17:17:36 +10:00
Martin Brennan
e92e05b22e
FIX: Error when leaving group DM channel (#31537)
Followup b5147a4634f0fd5c98262f949a8c766bfd73d290

When we aliased `leave` to `remove` and renamed
the method in `DirectMessageChannel` in the previous
commit, this inadvertantly caused an error when
unfollowing group channels in the channel list.

When clicking the X in the channel list, we hit
ChannelsCurrentUserMembershipFollowsController for the
current user and the channel, which is supposed to only
unfollow the channel for all channel types including DMs.

Group DMs have a different Leave behaviour vs Unfollow.
Leaving the channel altogether is done from the channel
settings page, the "Leave channel" button, and that
deletes the user's membership and DM user record from that
channel.

So, we were trying to do the leave channel behaviour in the
unfollow channel controller, which was returning the wrong
record for the serializer (a User not a Membership)

This fixes the issue and removes a bit of delegate/alias indirection
which was making the code a bit harder to fllow and search, even
though it was more succinct. Also adds missing specs that would
have caught this regression.
2025-02-27 14:26:07 +10:00
Maxim Evtush
a9928e8a71
Update LICENSE (#31217)
Updated the copyright in the LICENSE file to match with https://github.com/discourse/discourse-plugin-skeleton/blob/main/LICENSE

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-02-27 00:16:59 +01:00
Joffrey JAFFEUX
699541af75
FEATURE: limits post created edited trigger to a group (#31523)
This commit allows admins to limit the post created/edited trigger
execution to a specific post user group.

It's for example useful if you want to auto tag all the topics created
by member of a specific group.
2025-02-26 10:52:40 +01:00
Martin Brennan
ed1543455d
FIX: Allow oneboxes with no description (#31518)
This behaviour was allowed in
cb82dce86a
but then inexplicably removed a few months later in
https://github.com/discourse/onebox/pull/448, but showing
title-only oneboxes is valid. The original Meta topic that
this was discussed in was
https://meta.discourse.org/t/abc-news-not-oneboxing-due-to-missing-description/155933
.

This commit re-introduces allowing this behaviour to avoid the need for
a plugin,
c.f. https://meta.discourse.org/t/allow-title-only-onebox/354306

For example
<https://en-americas-support.nintendo.com/app/answers/detail/a_id/67660>

This commit also unhides onebox descriptions in chat, it's not
clear why they were ever hidden in the first place
2025-02-26 13:16:51 +10:00
David Taylor
1d7663d63c
FEATURE: Allow chat incoming webhooks to work without .json extension (#31497)
This provides a slightly nicer-looking URL, and also helps when external
systems have strict validations on the webhook URL.
2025-02-25 15:04:57 +00:00
Discourse Translator Bot
61d8cce569
Update translations (#31501) 2025-02-25 15:11:27 +01:00