Commit Graph

1783 Commits

Author SHA1 Message Date
David Battersby
f0ea57e30e
FIX: chat channel sort order consistency in sidebar (#30180)
This change creates a shallow copy of the public message channels so we don't change the original array while sorting.

Without this change the publicMessageChannels getter cache gets invalidated and cached again with the sorted channels array instead, which causes a bug where the sidebar channel list sorting order is updated by activity when user interacts with the chat drawer.
2024-12-09 15:36:41 +04:00
Osama Sayegh
976aca68f6
FEATURE: Restrict profile visibility of low-trust users (#29981)
We've seen in some communities abuse of user profile where bios and other fields are used in malicious ways, such as malware distribution. A common pattern between all the abuse cases we've seen is that the malicious actors tend to have 0 posts and have a low trust level.

To eliminate this abuse vector, or at least make it much less effective, we're making the following changes to user profiles:

1. Anonymous, TL0 and TL1 users cannot see any user profiles for users with 0 posts except for staff users
2. Anonymous and TL0 users can only see profiles of TL1 users and above

Users can always see their own profile, and they can still hide their profiles via the "Hide my public profile" preference. Staff can always see any user's profile.

Internal topic: t/142853.
2024-12-09 13:07:59 +03:00
Kelv
0f2033dd69
DEV: Update more deprecated Font Awesome icon names (#30163)
* DEV: Update more deprecated Font Awesome icon names

* revert update to icon-library test - test is covering deprecation case
2024-12-08 22:14:28 +01:00
Joffrey JAFFEUX
b0be89cb17
FIX: lower thread panel min-width (#30158)
It's been set to this value as a workaround for long thread titles, but we now have standalone thread titles in the thread body which makes this not needed. People had troubles understanding why they couldn't resize more the thread panel.
2024-12-06 19:18:45 +01:00
David Taylor
55980a2a84
DEV: Add workaround for chrome crash (#30157)
Some users are seeing consistent "Error 5" crashes in chrome when saving/deleting bookmarks on chat messages.

When crash logging is enabled, the message is:

`[33466:259:1206/122312.195048:ERROR:ax_object.cc(3400)] Check failed: !NeedsToUpdateCachedValues(). Stale values: "Group" axid#7543 <svg#discourse-emojis> needsToUpdateCachedValues/disallowed isIgnored inUserAgentShadowRoot:<use> isInert needsToUpdateChildren hasDirtyDescendants`

This seems to be influenced by a few factors, including the re-render of the bookmarks button, the adjacent 'reactions' button, and also the opening/closing of the modal.

Adding this `activeElement.blur` seems to avoid the issue in my manual testing. Hopefully, this can be dropped after future chrome releases.

Internal topic: t/143485
2024-12-06 16:05:09 +00:00
David Battersby
4f4498994c
UX: fix channel name style for unread threads (#30152)
Follow up to #30127.

Normally when viewing a channel with tracked threads, we dismiss the blue dot next to the channel name even though the thread has not been read yet.

This change applies the same criteria to determine if we should bold the channel name.
2024-12-06 17:38:13 +04:00
David Battersby
4e8a1487ca
UX: make channel name bold for unread threads (#30127)
Channels with unread threads should have a font weight of bold to match unread channels.
2024-12-05 14:17:31 +04:00
David Battersby
b3c94839ed
FIX: improve chat channel sorting for DMs (#30124)
This change sorts unread channels in descending order based on last message date, so channels with the latest activity will always appear at the top. It also adds some improvements for sorting channels with unread threads, now when multiple channels have unread threads, they will be sorted by last thread reply date to ensure more active channels rise to the top.

For DM channels, the order is now:

- Urgent (green badge) - unread messages, mentions and unread watched threads (most recent activity at top)
- Unread (blue badge) - unread tracked threads (most recent thread reply at top)
- Everything else (most recent message at top)
2024-12-05 13:33:55 +04:00
Kelv
1ca90c3070
DEV: update more deprecated font awesome icon names (#30123)
* update more deprecated font awesome icon names

* add migration to remove deprecated default for badges.icon
2024-12-05 15:20:02 +08:00
Régis Hanol
f75c43713b
FEATURE: bump DM limits from 20 to 50 (#30102)
So people who are having a **lot** of 1-1/group conversations in #chat can have even more 😅

Internal ref - t/143226/8
2024-12-04 16:34:28 +01:00
Régis Hanol
1ce12ae718
DEV: Deleted the "ChatComposerPresenceManager"... (#30098)
...since it was mostly duplicating the work the "ComposerPresenceManager" was doing.

So now the #chat composer uses the same "presence manager" as the composer, benefiting from the "hide presence" checks, with the only difference that the "keep alive" timeout is 5s for chat and 10s for topics/posts.
2024-12-04 12:21:55 +01:00
Discourse Translator Bot
838d7478c1
Update translations (#30062) 2024-12-04 11:59:28 +01:00
Kris
c67d3131aa
UX: adjust mobile chat text title alignment (#30065) 2024-12-03 14:11:33 -05:00
Joffrey JAFFEUX
89a6cac968
FIX: attempt to simplify chat navbar spacing (#30054)
The main bug this commit is fixing is lack of spacing on the title "channels" when visiting the chat homepage on mobile.
2024-12-03 09:33:10 +01:00
Loïc Guitaut
cf2b4d9934 DEV: Apply new Rubocop linting on services 2024-12-02 17:31:36 +01:00
David Taylor
a52b83333e
DEV: Correctly lint bundled plugins admin directory (#29999) 2024-12-02 16:31:21 +00:00
Jarek Radosz
b3423c40b0
DEV: Fix random typos (#30023)
(late) Nov 2024 edition
2024-12-02 07:34:05 +08:00
Jarek Radosz
6e4baaf092
DEV: Use qunit-dom's hasValue wherever possible (#30018) 2024-12-01 20:37:24 +01:00
Jarek Radosz
efa2589204
DEV: Finish qunit-dom hasText migration (#30017) 2024-12-01 14:00:48 +01:00
Jarek Radosz
1396aef99f
DEV: Make the logIn helper replace current-user service (#30010) 2024-11-30 17:23:51 +01:00
Jarek Radosz
dfb74d90c3
DEV: Extensively use qunit-dom's hasText (#30012) 2024-11-30 16:44:51 +01:00
Joffrey JAFFEUX
35be2a9879
FIX: word break long continuous thread titles (#30007) 2024-11-30 01:07:39 +01:00
Joffrey JAFFEUX
c42248670d
FIX: increase chat thread title limit (#30006)
This will ensure AI generated titles don't appear as out of range in the UI and also allow users to set longer titles. The limit in DB was already 100 so it's just a simple frontend change.
2024-11-30 00:42:20 +01:00
Joffrey JAFFEUX
877b03c7ae
FIX: do not show as clickable the thread header (#30005)
When the current user can't modify the thread title we shouldn't show it as a clickable area.
2024-11-30 00:32:58 +01:00
Joffrey JAFFEUX
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
David Battersby
3cde55b76f
FIX: show urgent badge for mentions in DM threads (#29821)
When thread tracking level is Normal in a DM channel, we should still show notification badges to the mentioned user.
2024-11-29 12:52:55 +04:00
Régis Hanol
8f8d88afac
PERF: Optimize query for finding users with unread chat messages (#29964)
Using CTEs and DISTINCT ON to:
- Pre-filter active users with correct preferences
- Get only first unread message per channel
- Eliminate redundant joins and message scanning

This reduces the query execution time by limiting message scanning and joins to only relevant users and messages.

Internal ref t/142836 & t/139517
2024-11-28 15:28:37 +01:00
Joffrey JAFFEUX
5a3afa0505
UI: hides channel with visible panel on narrow screen (#29541)
This commit will hide the channel when the side panel is present and the width of the viewport is less than 1000px. This is especially useful when you want to focus reading a thread on a small screen.

This change only impacts desktops.
2024-11-28 11:58:36 +01:00
Jarek Radosz
ef7518d4ad
DEV: Fix no-loose-assertions lint (#29965)
and enable some of qunit lints
2024-11-28 11:22:27 +01:00
Joffrey JAFFEUX
b4406861ae
FIX: simplify desktop notifications behavior (#29957)
Historically the behavior of this file has been complexified to attempt to answer this use case:

A user has two tabs open, tab 1 is on a topic, tab 2 is on a chat channel. If your active tab is tab 1 and someones sends you a mention in chat. We will show a desktop notification, but in which tab the channel should open if you click it? The changes made years ago said: in tab 2.

I think this is complexifying too much this codepath and is also confusing. You might wonder why this discourse notification you clicked opened in some of your 50 tabs in the background when you had a discourse tab active currently in front of you.

Moreover, a recent change has made the notification to only happen on desktop, but all the subscription stuff was happening regardless of mobile or desktop.
2024-11-27 17:33:31 +01:00
Jarek Radosz
5db0eba0a8
DEV: Autofix (w/ manual follow up) various qunit lints (#29950) 2024-11-27 13:02:55 +01:00
chapoi
cdf8eb8055
UX: update minwidth to chat sidepanel + better title word-break fn (#29954) 2024-11-27 06:04:04 +01:00
Discourse Translator Bot
b9f183e2c3
Update translations (#29934) 2024-11-26 23:14:56 +01:00
chapoi
3a11e70b3d
UX: chat drawer hover effect width calc fix (#29910) 2024-11-26 03:25:12 +01:00
Joffrey JAFFEUX
0c68b14534
FIX: correctly link to settings in full page (#29913)
There's already a test for this behavior and the CI is currently broken because of it.
2024-11-25 08:21:41 +01:00
Joffrey JAFFEUX
66409fa8b4
UX: improved collapsed drawer state/interactions (#29850)
- Clicking the channel title of a collapsed drawer will only open the drawer, and not open settings
- Remove the back button when the drawer is collapsed
- Uses same icon for toggling on chat that composer
- add max-width to minimised drawer + add hover effect
---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2024-11-25 03:39:03 +01:00
Régis Hanol
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
Tobias Eigen
5bf5d13356
UX: Corrected text for notification titles (#29860)
Improves notification title text from:

Chat quoted -> Quoted in chat
Chat watched thread -> Watched chat thread
2024-11-22 09:37:41 +04:00
Gary Pendergast
f1bf63f89c
FIX: Tweak the unread channel shortcut key behaviour (#29874) 2024-11-21 11:41:02 +11:00
Blake Erickson
1841e72571
DEV: Make sure chat migration is in plugin directory (#29867)
This migration is for chat so it needs to live in the chat plugin
directory.

Follow up to: 23a7f00524
2024-11-20 14:50:15 -07:00
Gary Pendergast
f06a5635b3
FIX: Improve the reliability of the unread channel keyboard shortcuts (#29814)
Additionally, a bunch of related flaky tests were unflakified.
2024-11-21 08:24:26 +11:00
Blake Erickson
23a7f00524
DEV: Re-apply chat index migration (#29859)
Commit c2a733a95a was applied to an
existing migration that possibly had already run. Due to this some
discourse instances might not have the correct index.

This change removes the original migration and creates a new one so that
it will actually be applied.

This is the missing index that some sites might not have:
```
Missing Index | CREATE INDEX
index_chat_messages_on_chat_channel_id_and_id ON public.chat_messages
USING btree (chat_channel_id, id) WHERE (deleted_at IS NOT NULL)
```
2024-11-20 12:59:07 -07:00
David Taylor
6f7c581a80
DEV: Bump @discourse/lint-configs and autofix (#29847)
In particular, this applies:

- new `discourse/no-implicit-this` template-lint rule
- `init`/`willDestroy` ordering enforcement
- `lines-between-class-members`
2024-11-20 14:15:04 +00:00
David Taylor
5563e9dc03
DEV: Revert ember-template-lint CI command change (#29845)
Partial revert of a10dcffb73, pending https://github.com/ember-template-lint/ember-template-lint/pull/3095

Also corrects a linting failure which snuck in while CI was broken
2024-11-20 11:10:16 +00:00
Joffrey JAFFEUX
2fb811a335
FIX: serializes interaction for direct messages (#29844)
Prior to this fix it would cause an error as we need to pass the user to get the title of the channel.

This commit also adds a test for message interaction serializer.
2024-11-20 11:26:12 +01:00
Régis Hanol
7cf28fec7b
PERF: optimize chat user membership cleanup when removing a single user (#29833)
This optimizes a hot path when users are being removed from one or more groups since we use the `on(:user_removed_from_group)` event to call the `Chat::AutoLeaveChannels` with a `user_id` parameter. In such case, we don't need to clear the membership of all users, just that one user.

DEBUG: Also added a "-- event = <event>" comment on top of the SQL queries used by the "AutoLeaveChannels" so they show up in the logs and hopefully facilitate any performance issues that might arise in the future.
2024-11-20 09:21:02 +01:00
Joffrey JAFFEUX
eb41a07afb
DEV: supports blocks in chat message sdk (#29839)
Blocks have been added in 582de0ffe3 but were not yet supported in the SDK.
2024-11-20 08:06:48 +01:00
Discourse Translator Bot
abfd065ff0
Update translations (#29835) 2024-11-20 00:21:25 +01:00
David Taylor
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
Penar Musaraj
7776773a11
FIX: Simplify max-height calculation for chat composer (#29822)
In some rare cases, this was causing the input to be invisible. The
change here means the input will have a smaller max height, but since
here we are limiting this to 25% of the viewport height, it should be
more than fine.

It's also not necessary to include the `chat-header-offset`, it ends up
being only a few pixels' difference (since, again, it is divided by 4).
2024-11-19 12:18:05 -05:00