Commit Graph

224 Commits

Author SHA1 Message Date
c00c522530 DEV: Adds hasNoPreferredMode to chat state manager (#33213)
This commit introduces a new property `hasNoPreferredMode` to the
chat state manager, which represents a user who has not purposely
set chat mode to drawer or full page, meaning they have no LocalStorage
value set.

This can be useful for themes to change the chat mode but only
if the user has no preference already.

c.f.
https://meta.discourse.org/t/full-screen-chat-as-default-for-collaboration-setup/369849
2025-06-17 13:22:42 +10:00
2268f06b04 FIX: Chat video thumbnails in Safari (#33199)
When uploading videos in chat using Safari the thumbnail isn't being
displayed
so we need to trick the browser to by adding the timestamp property so
that it
will fetch the metedata the html5 video tag needs to render the
thumbnail.
2025-06-13 13:04:35 -06:00
c1946425fa FIX: chat: shows placeholder instead of timer for empty chats (#33105)
For empty chats, a dummy message is created with `id=null` (an
unsaved Ember model). 

The timer or placeholder's display is determined by the message ID's presence now (not the `createdAt` prop).
2025-06-09 15:59:04 +08:00
8efd99da9e FEATURE: Improve emoji diversity rendering (#32909)
This change polishes the emoji diversity rendering behaviour in the emoji pickers. When a user changes their diversity setting, that setting will now be applied to favourites, chat default reactions, and in the  emoji picker section selectors.

If an emoji was previously stored with a skin tone in favourites or default reactions, the stored skin tone won't be overridden.
2025-05-27 11:34:24 +10:00
b15c1d28c9 DEV: Introduce experimental viewport-based mobile mode (#32859)
Introduces the viewport_based_mobile_mode experimental site setting.
When enabled, user-agent-based mobile/desktop detection will be replaced
with viewport-width logic. 'mobile mode' is enabled for any viewport
less than our 'sm' breakpoint (40rem, or 640px at default font size).

When this mode is enabled, mobile/desktop toggle buttons are hidden,
since they are non-functional.

Tests are also updated to use a consistent method for force-enabling the
legacy mobile mode. All state is now stored in `lib/mobile`, and the
`Site` model references that via a getter.
2025-05-23 13:01:04 +01:00
58009fb0e7 DEV: Fix small issues in the Glimmer Post Stream (#32656)
- When using the Glimmer Post Stream, ensure the status wrapper is only
rendered for mentions of users with a status set.
This prevents an empty wrapper from adding a small blank space at the
end of the mention.

- Ensures the post's user field in initialized with the
`avatar_template` in the PostStream to prevent missing avatar on small
actions

- Fix an issue where the path would be incorrectly linked on small
actions

- Fix an issue where the relative timestamp would be incorrectly
displayed in wiki posts
2025-05-09 12:17:28 -03:00
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
999ae73c78 DEV: [gjs-codemod] apply codemod
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-02 13:44:15 +01:00
386bb974d1 DEV: [gjs-codemod] renamed js to gjs 2025-04-02 13:43:28 +01:00
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
d06c60ca7c FEATURE: add icons and emojis to category (#31795)
This feature allow admins to personalize their communities by
associating emojis or icons with their site categories.

There are now 3 style types for categories:
- Square (the default)
- Emoji
- Icon

### How it looks 🎨 

Adding an icon:

<img width="502" alt="Category with an icon"
src="https://github.com/user-attachments/assets/8f711340-166e-4781-a7b7-7267469dbabd"
/>

Adding an emoji:

<img width="651" alt="Category with an emoji"
src="https://github.com/user-attachments/assets/588c38ce-c719-4ed5-83f9-f1e1cb52c929"
/>

Sidebar:

<img width="248" alt="Sidebar with emojis"
src="https://github.com/user-attachments/assets/cd03d591-6170-4515-998c-0cec20118568"
/>

Category menus:

<img width="621" alt="Screenshot 2025-03-13 at 10 32 30 AM"
src="https://github.com/user-attachments/assets/7d89797a-f69f-45e5-bf64-a92d4cff8753"
/>

Within posts/topics:

<img width="382" alt="Screenshot 2025-03-13 at 10 33 41 AM"
src="https://github.com/user-attachments/assets/b7b1a951-44c6-4a4f-82ad-8ee31ddd6061"
/>

Chat messages:

<img width="392" alt="Screenshot 2025-03-13 at 10 30 20 AM"
src="https://github.com/user-attachments/assets/126f8076-0ea3-4f19-8452-1041fd2af29f"
/>

Autocomplete:

<img width="390" alt="Screenshot 2025-03-13 at 10 29 53 AM"
src="https://github.com/user-attachments/assets/cad75669-225f-4b8e-a7b5-ae5aa8f1bcad"
/>

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-03-26 09:46:17 +04:00
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
28e00d9bfe DEV: Update lint-configs and autofix issues (#31620)
This updates us to Prettier 3.x
2025-03-05 01:20:16 +01:00
e98644fbc6 DEV: Replace remaining uses of query helper (#30019) 2025-01-22 00:25:03 +01:00
72f4588d3b DEV: Do not trigger floatkit 'hover' for touch events (#30793)
When tapping something on a touch-enabled device, `mouseMove` events are
still fired, so floatkit would still be triggered even if configured for
'hover' only. For links, this would be particularly strange, because the
tooltip would appear for a split-second, before the page navigation
occured.

To avoid this problem, we can use the more-modern 'pointerMove' event,
and check the `pointerType` to exclude 'touch'
2025-01-16 12:36:47 +00:00
0ed4b09527 DEV: Move discourse-common/(utils|lib) to discourse/lib (#30733)
`discourse-common` was created in the past to share logic between the
'wizard' app and the main 'discourse' app. Since then, the wizard has
been consolidated into the main app, so the separation of
`discourse-common` is no longer useful.

This commit moves `discourse-common/(lib|utils)/*` into
`discourse/lib/*`, adds shims for the imports, and updates existing
uses in core.
2025-01-13 13:02:49 +00:00
69ec6d29d7 DEV: Resolve this-property-fallback deprecation in chat test (#30669) 2025-01-09 10:17:18 +00:00
6740a340ca DEV: unifies emoji picker (#28277)
The chat emoji picker is renamed emoji-picker, and the old emoji-picker is removed.

This commit doesn't attempt to fully rework a new emoji-picker but instead tries to migrate everything to one picker (the chat one) and add small changes.

Other notable changes:
- all the favorite emojis code has been mixed into one service which is able to store one state per context, favorites emojis will be stored for all topics, and for each chat channel. Meaning that if you always use a specific emoji in a channel, it will only show as favorite emoji in this channel.
- a lot of static code has been removed which should improve initial load perf of discourse. Initially this code was around to improve the performance of the emoji picker rendering.
- the emojis are now stored, once the full list has been loaded, if you close and reopen the picker it won't have to load them again.

List of components:

- `<EmojiPicker />` will render a button which will open a dropdown
- `<EmojiPickerContent />` represents the content of the dropdown alone, it's useful when you want to render a picker from an action which is not the default picker button
- `<EmojiPickerDetached />` just a simple wrapper over `<EmojiPickerContent />` to make it easier to use it with `this.menu.show(...)`

---------

Co-authored-by: Renato Atilio <renatoat@gmail.com>
2025-01-08 11:41:36 +01:00
8f6c99df8c DEV: Run prettier correctly for bundled-plugin test directories (#30338) 2024-12-18 12:02:28 +00:00
af8c98217a DEV: Remove empty beforeEach hooks (#30326) 2024-12-17 11:57:49 -06:00
6e4baaf092 DEV: Use qunit-dom's hasValue wherever possible (#30018) 2024-12-01 20:37:24 +01:00
efa2589204 DEV: Finish qunit-dom hasText migration (#30017) 2024-12-01 14:00:48 +01:00
1396aef99f DEV: Make the logIn helper replace current-user service (#30010) 2024-11-30 17:23:51 +01:00
dfb74d90c3 DEV: Extensively use qunit-dom's hasText (#30012) 2024-11-30 16:44:51 +01:00
b546c31b7f UI: simplify chat thread title (#29998)
We were using a complex logic to make it change size based on scroll position but this was imperfect and not visually pleasing. Also the title had been made a button which was causing the ellipsis to not work correctly, and I would prefer to not mix page knowledge (thread) with title component so I made this click logic directly in the chat-thread component.

---------

Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2024-11-29 22:39:18 +01:00
ef7518d4ad DEV: Fix no-loose-assertions lint (#29965)
and enable some of qunit lints
2024-11-28 11:22:27 +01:00
5db0eba0a8 DEV: Autofix (w/ manual follow up) various qunit lints (#29950) 2024-11-27 13:02:55 +01:00
d71016522e FIX: hide chat button in user card (#29887)
when the user isn't able to receive DMs (either because they've disabled it or because they're suspended for example).

Internal ref - t/142198
2024-11-22 09:05:58 +01:00
32665cf9dd DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
2024-11-19 20:45:18 +00:00
e68905510d DEV: Use the new hasHtml/includesHtml from qunit-dom (#29680) 2024-11-11 13:06:12 +01:00
2272b1340b DEV: Use qunit-dom instead of raw href/title comparisons (#29678) 2024-11-11 11:44:54 +01:00
c4de8565ec FIX: flakey due to 0 width/height images (#29700)
https://github.com/mainmatter/qunit-dom/blob/master/API.md#isvisible will return true if offsetWidth or offsetHeight are zero which could happen in this case as the test could run before the image has loaded. By forcing a minimum height in the test we ensure it will be consistent.
2024-11-11 17:23:19 +09:00
78ed0bb711 DEV: Use selectors instead of query() where possible (#29677) 2024-11-10 13:53:12 +01:00
d67a6002eb DEV: Replace count with qunit-dom (#29674) 2024-11-10 02:06:03 +01:00
f9e58938ce DEV: Update visible/invisible uses to qunit-dom (#29672) 2024-11-10 01:41:50 +01:00
de6d575d40 DEV: Convert all uses of exists to qunit-dom (#29667) 2024-11-10 01:30:33 +01:00
c1916f7984 DEV: Convert assert.true(exists()) to qunit-dom (#29638) 2024-11-08 20:27:32 +01:00
5010fced92 DEV: only supports headings in messages for bots (#29585)
The markdown it rule "heading" will only be used when the message is done by a bot, which means an id < 0.

This commit also adds a is-bot css class on messages made by a bot, for finer control.

---------

Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
2024-11-07 22:27:35 +09:00
380974ce00 DEV: Use hasAttribute/hasAria/hasStyle in tests (#29568) 2024-11-04 11:30:38 +01:00
9694d2477a DEV: Convert more notOk assertions (#29556)
…to either qunit-dom or `strictEqual`
2024-11-04 10:27:30 +01:00
b81055a6d4 DEV: Convert more equal assertions (#29554)
…to either qunit-dom or `strictEqual`
2024-11-03 21:04:38 +01:00
7bcd46b87d DEV: use service worker for chat sound (#29388)
This change makes use of service workers to determine if we should play chat sounds in the current browser tab. Since users can have multiple tabs open, we currently attempt to play sound across all active tabs.

With this change we iterate over all clients and check if client.focused is true (ie. the current tab/window we have open), if so we allow playing the audio in the current tab and for all other hidden tabs/windows we return false.

---------

Co-authored-by: Bianca Nenciu <nbianca@users.noreply.github.com>
2024-10-29 13:15:53 +04:00
aa89acbda6 DEV: Upgrade Uppy to v4 (#29397)
Key changes include:

- `@uppy/aws-s3-multipart` is now part of `@uppy/aws-s3`, and controlled with a boolean

- Some minor changes/renames to Uppy APIs

- Uppy has removed batch signing from their S3 multipart implementation. This commit implements a batching system outside of Uppy to avoid needing one-signing-request-per-part

- Reduces concurrent part uploads to 6, because S3 uses HTTP/1.1 and browsers limit concurrent connections to 6-per-host.

- Upstream drop-target implementation has changed slightly, so we now need `pointer-events: none` on the hover element
2024-10-28 14:01:44 +00:00
b9ec9c7e4f DEV: Update more asserts to qunit-dom (#29326)
regex find&replace + removing now-unused imports + manually fixing incorrect css selectors (that now got flagged 😌) + manually updating selectors that relied on jq
2024-10-22 11:34:23 +02:00
688f65a39d DEV: Convert more test assertions to qunit-dom (#29214)
the PR is sponsored by vscode's regex support in find-and-replace 😉
2024-10-15 17:11:20 +02:00
9eaf908e63 DEV: cleanup chat desktop notification data (#28943)
Makes channel_id and is_direct_message_channel consistent across desktop notifications, which also removes the need to lookup the channel from Chat Notification Manager.
2024-10-03 12:43:17 +04:00
2aca41914a FEATURE: supports mark tag in chat messages (#28949)
This brings feature parity with posts where you can use this tag.
2024-09-17 20:52:34 +02:00
b60f4606e5 FEATURE: allow names in chat channel title (#28843)
This change adds full names to direct message channel titles when the following conditions are met:

- SiteSetting.enable_names = true
- SiteSetting.display_name_on_posts = true
- SiteSetting.prioritize_username_in_ux = false

If a user's full name is blank, it will fallback to their username in both 1-1 channels and Group DM channels.
2024-09-16 18:12:13 +04:00
a914d3230b DEV: remap all core icons for fontawesome 6 upgrade (#28715)
Followup to 7d8974d02f7360b324b446868463e950fe92883f

Co-authored-by: David Taylor <david@taylorhq.com>
2024-09-13 16:50:52 +01:00
896f116443 DEV: Fix random typos (#28891) 2024-09-12 23:25:34 +02:00