Commit Graph

211 Commits

Author SHA1 Message Date
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
6bc9153a0d DEV: Remove duplicated tests (#28889) 2024-09-12 23:20:49 +02:00
4d484d89d0 DEV: Add a missing service injection (#28890) 2024-09-12 23:20:33 +02:00
2a5e1aa8e6 FEATURE: only play chat sound when chat badge icon is shown (#28387)
Every time a desktop chat sound plays, there should be some visual cue as to why the sound was played in the first place.

This change follows the chat indicator preference:

- All New Messages - a blue dot is shown for all messages, so we attempt to play a sound every time
- Direct Messages, Mentions and Watched Threads - a green dot is shown for all urgent messages, so we attempt to play a sound for urgent chat notifications
- Only Mentions - only play chat sounds when user is mentioned
- Never - we never play chat sounds, as user wouldn’t know why the sound was played
2024-09-06 18:25:25 +04:00
e991574389 UX: chat drawer increase unread channel visibility (#28731)
This change increases the visibility of unread channels to make them stand out more in drawer mode (desktop).

When a channel is unread:

- it floats to the top;
- when multiple channels are unread, they are sorted alphabetically (equal to how it’s done on mobile)
- the unread indicator blue dot moves to directly right of the channel name
2024-09-05 13:36:50 +04:00
fdcf4698fc UX: Update Chat Group Name and Placeholder (#28703)
* UX: Update Chat Group Name and Placeholder

* update tests

* fix failing tests

* better checking of system user when setting dm title
2024-09-04 15:52:23 +10:00
f14cf4f8a9 DEV: Fix random typos (#28103)
July 2024 edition
2024-07-26 23:13:12 +02:00
038e5deb2a DEV: Clean up imports (#28060)
* `@ember/owner` instead of `@ember/application`
* `discourse-i18n` instead of `I18n`
* `{ service } from "@ember/service"` instead of `inject as service`
2024-07-25 15:09:06 +02:00
8d4c9523ee DEV: Convert some tests to qunit-dom (#27577)
(and fix two test bugs)
2024-06-23 22:34:15 +02:00
5361c3704d FIX: Don't modify FloatKitInstances arrays unless needed (#27462) 2024-06-13 12:44:38 +02:00
0260415664 FIX: correctly handle notifications for channels (#27178)
Prior to this fix we had too logic to detect if a user is active or not:

- idle codepath on the frontend
- online user ids on the backend

The frontend solution is not very reliable, and both solution are just trying to be too smart. Making a lot of people questioning why they receive a notification sometimes and sometimes not. This commit removes all this logic and replaces it with a much more simpler logic:

- you can't receive notifications for channel you are actually watching
- we won't play a sound more than once every 3seconds
2024-05-24 19:59:24 +02:00
5134e74e91 UX: also plays notification sounds in group channels (#27176)
Prior to this fix we were limiting this to 1:1 channels.
2024-05-24 17:48:07 +02:00
d5066336ec UX: reduces idle time to 0 on chat (#27158)
We consider that you should always receive a notification sound when someone speaks directly with you in chat.

This commit also refactors the way we play audio in chat to make it simpler and throttle it to 3 seconds.

We also added a safeguard to ensure we won't play sounds for old messages, this case can happen when message bus is catching up the backlog (eg: in an inactive tab for example).
2024-05-24 11:18:11 +02:00
52125d849f FIX: correctly check for disabled notifications, tab and is idle (#27127)
This commit reuses the existing codepath in desktop-notifications and make it available to use to chat.

primaryTab was too hard to test if not impossible in this service test, however isIdle and disabled notifications are correctly tested.
2024-05-22 10:08:05 +02:00