1144 Commits

Author SHA1 Message Date
Jordan Vidrine
b888ec07cb
UX: Chat more message actions adjustments (#32404) 2025-04-22 16:36:21 -05:00
Kelv
1e0d773b54
DEV: duplicate scroll-top util function to lib and replace current usage with new path (#32367)
This was refactored from an actual Mixin some time back. This PR moves
the function to the lib folder and keeps the same logic/interface
otherwise.

We'll remove the mixin file once all non-core repos change to use the
new file.
2025-04-21 08:12:51 +08:00
Jordan Vidrine
f03a6f3557
UX: Onebox & quote border radius (#32242) 2025-04-14 10:55:51 -05:00
David Taylor
7b2b08cf89
DEV: [gjs-codemod] Convert automation/styleguide/other to gjs
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-14 15:36:16 +01:00
David Taylor
3462113bd4
DEV: [gjs-codemod] merge js and hbs 2025-04-14 15:27:52 +01:00
David Taylor
1eb953ca57
DEV: [gjs-codemod] renamed hbs to gjs 2025-04-14 15:27:47 +01:00
David Taylor
3ca507e008
DEV: [gjs-codemod] renamed js to gjs 2025-04-14 15:27:45 +01:00
Joffrey JAFFEUX
fff1ae60f1 DEV: ensures chat can work without discourse-presence
discourse presence can be disabled, given it's a plugin the `composerPresenceManager` service couldn't be present anymore and would cause an error.

No test as it's testing imbrication of multiple plugins and hard to test reliably.
2025-04-09 17:00:31 -04:00
Joffrey JAFFEUX
4c8420833e
FEATURE: One-click chat reaction settings (#32150)
Adds a one-click chat reactions setting to the chat preferences page
where members can determine what one-click reactions are shown in chat.

- Frequent: This will be the default setting. (Automatically set based
on most used chat reactions)
- Custom: Members can choose up to three reactions they want to see in
their one-click chat/DM reactions menu. Defaults are `❤️`, `👍` ,
and `😄`.


![image](https://github.com/user-attachments/assets/8913db0e-d6ec-4347-ad91-2329206b127c)

This pull request is essentially the work of @dsims in
https://github.com/discourse/discourse/pull/31761

---------

Co-authored-by: dsims <1041068+dsims@users.noreply.github.com>
2025-04-04 09:15:13 +02:00
Jordan Vidrine
abeb8de7b5
UX: Button fixes (#32152) 2025-04-03 16:13:34 -05:00
Jarek Radosz
9be51b616b
DEV: Handle the missing d-lazy-video case (#32148)
aka: lazy load lazy video

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-04-03 18:09:02 +02:00
David Taylor
999ae73c78
DEV: [gjs-codemod] apply codemod
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-02 13:44:15 +01:00
David Taylor
dac398d6ab
DEV: [gjs-codemod] merge js and hbs 2025-04-02 13:43:33 +01:00
David Taylor
1c8019a3c7
DEV: [gjs-codemod] renamed hbs to gjs 2025-04-02 13:43:32 +01:00
David Taylor
386bb974d1
DEV: [gjs-codemod] renamed js to gjs 2025-04-02 13:43:28 +01:00
moin-Jana
6b37aaf414
DEV: Fix FA icon deprecation 'smile' -> 'face-smile' (#32065)
Over the last few weeks, I have occasionally seen a deprecation warning
on my smartphone. Unfortunately, there was no corresponding entry in
/logs, and I never had the browser console available at the time.

I have now found the steps to reproduce the issue: the warning is
triggered by the emoji selection button in the chat.


https://github.com/user-attachments/assets/fbda7ee2-6967-48af-aa00-d081466e6aea

The icon used in the button was 'smile' instead of 'face-smile'. With
this fix, the warning no longer appears.

Otherwise, the icon will be missing once
https://github.com/discourse/discourse/pull/31866 is merged.

![After_1_April](https://github.com/user-attachments/assets/eed141e4-abd8-42c3-a27c-6dad7c4467f9)
2025-03-31 09:42:19 +01:00
Martin Brennan
d3c2bd015d
FEATURE: Implement chat transcripts in rich editor (#31819)
This commit allows the ProseMirror rich editor to display chat
transcripts copied from chat using the "Copy" button.

The BBCode usually looks something like this:

```
[chat quote="hunter;29856;2025-03-20T07:13:04Z" channel="design gems 🎉" channelId="95"]
haha **ok** _cool_
[/chat]
```

But there are several variations that must be accounted for:

* Single message from single user
* Multiple messages from a single and multiple users
* Messages inside chat threads

The rich transcript extension has to ignore many of the chat transcript
markdown
tokens because they simply aren't necessary -- none of the ProseMirror
nodes need
to be editable. So, we basically recreate the same HTML that the chat
transcript markdown
rule does in the `toDOM()` function. Maybe in future we want to make the
markdown rule
do less and have this HTML creation in one place, but for now we need to
mirror in both files.

---------

Co-authored-by: Renato Atilio <renato@discourse.org>
2025-03-31 14:04:22 +10:00
David Battersby
f13ff5088c
FIX: update chat icon position on mobile (#32016)
The chat icon was repositioned in #31951 but we should also account for
mobile, where it should appear before the hamburger icon.
2025-03-26 17:03:47 +04:00
David Battersby
525406ad20
UX: reposition chat header icon (#31951)
With header search we toggle the search icon when scrolling on topics,
which can feel visually jarring when the search icon is in the middle.

Switching the position of the chat icon in the header reduces the impact
of this.
2025-03-26 10:59:01 +04: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
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
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
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
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
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
Jarek Radosz
3d2a6322d0
DEV: Update lint-configs and auto-fix issues (#31485) 2025-02-24 23:32:31 +01: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
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
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
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
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
Jarek Radosz
39b1ac91b8
DEV: Merge duplicated css (#31167)
Fixes `no-duplicate-selectors` stylelint rule.
2025-02-05 18:42:55 +01:00
Jarek Radosz
5b5899b543
UX: Update bot-indicator styling (#31108)
Before/After

<img width="334" alt="Screenshot 2025-02-01 at 12 05 39"
src="https://github.com/user-attachments/assets/6939c586-3166-42e8-aa71-1062b282eeb8"
/> <img width="334" alt="Screenshot 2025-02-01 at 12 06 38"
src="https://github.com/user-attachments/assets/506f460a-7f85-418d-bd5d-b7cecd26abac"
/>
2025-02-05 12:44:50 +01:00
Renato Atilio
0e61565b2b
FEATURE: introduce a ProseMirror editor (#30815)
This is the first in a series of PRs to introduce a
ProseMirror-based
WYSIWYM editor experience
alongside our current textarea Markdown editor.

Behind a hidden site setting, this PR adds a toggle to the composer
toolbar, allowing users to switch between the two options.

Our implementation builds upon the excellent ProseMirror and its
non-core Markdown
module, using the
module's schema, parsing, and serialization definitions as the base for
further Discourse-specific features.

An extension API is included to enable further customizations.

The necessary extensions to support all Discourse's core and core
plugins features **will be implemented in subsequent PRs**.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-02-04 14:37:18 -03:00
Joffrey JAFFEUX
ab4ca0be6e
FIX: quote from thread in drawer mode (#31137)
Due to a recent regression the selection management was failing in
drawer mode for threads. We were not correctly setting the active
thread.

This commit fixes the issue and adds a spec.
2025-02-03 21:20:50 +01:00