1930 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
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
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
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
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
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
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
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
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
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
Joffrey JAFFEUX
3d5a1858e5
FIX: exclude bots of inaccessible/unreachable mentions (#31458)
It will prevent to show a notice saying the bot is not part of the
channel.

---------

Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
2025-02-25 10:19:51 +01:00
Jarek Radosz
3d2a6322d0
DEV: Update lint-configs and auto-fix issues (#31485) 2025-02-24 23:32:31 +01:00
David Battersby
342ab6f082
FIX: delayed chat summary email (#31255)
Updates the chat summary email to account for:

- unread mentions in category channels (same as before)
- unread direct messages (now excluding threads)
- unread watched thread replies (for both channels and DM channels)

We have also reduced the window from 1 week down to 1 day for all 3
criteria. The DM unreads query is now properly selecting the first
unread message within the window (rather than the first message
regardless of read status).
2025-02-24 14:25:52 +04:00
Discourse Translator Bot
122e1384bc
Update translations (#31470) 2025-02-24 15:11:55 +11:00
Joffrey JAFFEUX
cb257ff658
DEV: allows to add a draft without persisting it (#31457)
On chat setup we get the initial state of drafts for the current users,
we need to add them to the drafts manager, but we don't need to store
them again on the backend.

This commit adds a persist (boolean) parameter to the
`ChatDraftsManager.add` service which when set to true will only add the
draft on the frontend and not send it to the backend.

No test, as the behavior is already tested and unchanged, this is only a
performance improvement.
2025-02-22 01:29:12 +01:00
David Taylor
c22ce1385f
DEV: Remove unneeded -webkit prefixes from css (#31448)
Now we have autoprefixer, we don't need to do this manually
2025-02-21 14:48:20 +00:00
Gary Pendergast
d0881e6fef
FEATURE: Type reactions in chat (#31439)
This change allows you to add a reaction to the most recent message, by sending a reaction message.

A reaction message can be formatted as `+{emoji}` (eg, `+❤️`), or as `+{emoji_code}` (eg, `+❤️`).
2025-02-21 17:43:28 +11:00
Martin Brennan
e26a1175d7
FEATURE: Initial version of experimental admin search (#31299)
This feature allows admins to find what they are
looking for in the admin interface via a search modal.
This replaces the admin sidebar filter
as the focus of the Ctrl+/ command, but the sidebar
filter can also still be used. Perhaps at some point
we may remove it or change the shortcut.

The search modal presents the following data for filtering:

* A list of all admin pages, the same as the sidebar,
   except also showing "third level" pages like
   "Email > Skipped"
* All site settings
* Themes
* Components
* Reports

Admins can also filter which types of items are shown in the modal,
for example hiding Settings if they know they are looking for a Page.

In this PR, I also have the following fixes:

* Site setting filters now clear when moving between
   filtered site setting pages, previously it was super
   sticky from Ember
* Many translations were moved around, instead of being
   in various namespaces for the sidebar links and the admin
   page titles and descriptions, now everything is under
   `admin.config` namespace, this makes it way easier to reuse
   this text for pages, search, and sidebar, and if you change it
   in one place then it is changed everywhere.

---------

Co-authored-by: Ella <ella.estigoy@gmail.com>
2025-02-21 11:59:24 +10:00
Joffrey JAFFEUX
a77d469eeb
UX: close thread panel with a single escape (#31426)
Before this commit we were requiring two escapes:
- one to un-focus composer
- one to close panel
2025-02-21 00:10:02 +01:00
Joffrey JAFFEUX
7aac73126c
UX: triggers upload dialog on doubleclick (#31425)
When making a double click on the [+] button next to the chat composer,
the upload dialog will now be displayed.

No test as it's hard to test with capybara and is not an important
behavior.
2025-02-20 21:08:59 +01:00
David Taylor
6ae33d63af
FIX: Lightbox chat uploads immediately after optimize (#31414)
When a message is first sent, the original upload URL is used for a
split-second before it's replaced by the optimised thumbnail. Using
`didInsert` didn't re-run on any changes to the uploads. Switching to a
proper modifier, and checking the length of the uploads array within it,
will ensure that it is re-run whenever the uploads change.
2025-02-20 10:21:53 +00:00
Ted Johansson
b5147a4634
FEATURE: Allow admins to remove users from chat DMs (#31366)
This feature allows admins to remove users from channels.
2025-02-20 15:16:57 +08:00
David Battersby
6524e72088
UX: increase limit in chat channel fetcher (#31406)
Increases the number of chat channels loading to prevent missing
notifications for channels beyond the current limit.
2025-02-19 23:51:46 +04:00
Jarek Radosz
b47e429b26
DEV: Fix mixed-decls sass deprecations in plugins (#31356)
A follow-up to #31343.

```
WARNING: Sass's behavior for declarations that appear after nested
rules will be changing to match the behavior specified by CSS in an upcoming
version. To keep the existing behavior, move the declaration above the nested
rule. To opt into the new behavior, wrap the declaration in `& {}`.

More info: https://sass-lang.com/d/mixed-decls
```
2025-02-18 20:04:51 +01:00
Discourse Translator Bot
b37b51d15f
Update translations (#31377) 2025-02-18 14:51:47 +01:00
Sérgio Saquetim
1a7d2667c4
DEV: Add the AsyncContent component (#31101)
Co-authored-by: David Taylor <david@taylorhq.com>
2025-02-17 18:38:51 -03:00
David Taylor
a0f681b256
DEV: Refactor chat HTML decorating (#31309)
Uses the new `<DecoratedHtml` component, which takes care of the full
decorate/render lifecycle. That means we can drop all the custom
modifiers/debouncing which chat was doing. It also naturally adds
support for `helper.renderGlimmer` in chat decorations.

This should resolve a number of subtle bugs related to chat message
decorations.
2025-02-14 11:34:39 +00:00
Jarek Radosz
be513ed9a3
DEV: Fix all mixed-decls sass deprecations (#31343)
```
WARNING: Sass's behavior for declarations that appear after nested
rules will be changing to match the behavior specified by CSS in an upcoming
version. To keep the existing behavior, move the declaration above the nested
rule. To opt into the new behavior, wrap the declaration in `& {}`.

More info: https://sass-lang.com/d/mixed-decls
```
2025-02-13 23:58:19 +01:00
Discourse Translator Bot
e925f9b7e8
Update translations (#31276) 2025-02-11 16:43:08 +01:00
Osama Sayegh
284e708e67
FEATURE: Dark/light mode selector (#31086)
This commit makes the
[color-scheme-toggle](https://github.com/discourse/discourse-color-scheme-toggle)
theme component a core feature with improvements and bug fixes. The
theme component will be updated to become a no-op if the core feature is
enabled.

Noteworthy changes:

* the color mode selector has a new "Auto" option that makes the site
render in the same color mode as the user's system preference
* the splash screen respects the color mode selected by the user
* dark/light variants of category logos and background images are now
picked correctly based on the selected color mode
* a new `interface_color_selector` site setting to disable the selector
or choose its location between the sidebar footer or header

Internal topic: t/139465.

---------

Co-authored-by: Ella <ella.estigoy@gmail.com>
2025-02-07 03:28:34 +03:00
Jarek Radosz
7ec9885454
DEV: Enable and fix more stylelint rules (#31200)
* `color-no-invalid-hex`
* `unit-no-unknown`
* `declaration-block-no-duplicate-custom-properties`
* `block-no-empty`
* `selector-type-no-unknown`
* `selector-pseudo-element-no-unknown`
* `scss/double-slash-comment-whitespace-inside`
* `font-family-no-missing-generic-family-keyword`
* `function-linear-gradient-no-nonstandard-direction`
2025-02-05 20:03:56 +01:00