Commit Graph

3727 Commits

Author SHA1 Message Date
Régis Hanol
35656a1d5f
DEV: attempt to fix some system spec flakes (#30182)
Since 3e7f0867ea, I started seeing some specs fail due to the following error

```plain
Error occurred while rendering: top-level application > discourse-root > topic > discourse-topic > topic-navigation > plugin-outlet > plugin-connector > topic-presence-display

/assets/plugins/discourse-presence.js - Uncaught TypeError: Cannot destructure property 'whisperer' of 'this.currentUser' as it is null.
```

For some reasons I can't fanthom, the presence components seem to be rendered even though they're using outlets that are only rendered when a user is signed in... 🤷‍♂️

Lost too much time trying to reproduce so I ended up adding this `if (!this.currentUser) { return; }` condition to both "presence display" component to (hopefully) fix these flakes.
2024-12-09 18:01:22 +01:00
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
Régis Hanol
3e7f0867ea
FIX: whisper's presence channels (#30097)
In 0993273 we introduced the `whisper_allowed_group_ids` to allow whispers to more users than "staff".

The presence plugin hadn't been updated to account for this change.
2024-12-04 11:47:05 +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
Renato Atilio
85691a7f31
DEV: refactor composer-editor/d-editor, a little more (#29973)
Adds setupEditor to ComposerEditor so it can setup/destroy events when the underlying editorComponent is switched.

Moves putCursorAtEnd uses (which implementation is textarea-specific) to TextareaTextManipulation.

Moves insertCurrentTime and a corresponding test, which is discourse-local-dates specific, to the plugin.

Moves applyList and formatCode from DEditor to the TextareaTextManipulation.

Moves DEditor._applySurround to TextareaTextManipulation.applySurroundSelection

Avoids resetting the textarea value on applyList and formatCode, keeping the undo history.
2024-12-02 18:24:14 -03: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
Jarek Radosz
52b7280ad4
DEV: Remove a use of discourseModule (#29996) 2024-11-29 18:16:21 +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
Gabriel Grubba
43414abf83
FIX: TopicTagsChanged trigger not working with multiple tags (#29961)
* FIX: `TopicTagsChanged` trigger not working with multiple tags

The check for when had multiple tags was being exclusive, you had to have all tags to trigger the automation, now it's inclusive, you can trigger the automation if you have any of the tags.

* DEV: add specs for when having multiple categories

* DEV: changed to use unions and intersections for tags

added more tests to check for multiple tags
2024-11-27 14:16:29 -03: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
Loïc Guitaut
d6bec460a8 DEV: Upgrade Rails to version 7.2 2024-11-27 10:48:47 +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
Joffrey JAFFEUX
a692e87b72
DEV: lint poll test (#29937)
Co-authored-by: David Taylor <david@taylorhq.com>
2024-11-26 16:22:33 +01:00
Joffrey JAFFEUX
7333a00ddb
DEV: ensures poll-test is correctly linted (#29936)
Broken in a535798659
2024-11-26 14:18:30 +01:00
Robert
a535798659
FIX: Poll: ensure it is not possible to vote with all abstentions in Ranked Choice (#29601)
Make sure Cast Vote button is disabled when all abstain and remove any historic data that fails new zero rank vote validation
2024-11-26 20:16:22 +08:00
chapoi
3a11e70b3d
UX: chat drawer hover effect width calc fix (#29910) 2024-11-26 03:25:12 +01:00
Isaac Janzen
6aae60a212
FIX: Tooltip styleguide triggers not rendering options (#29926)
Tooltips have different triggers / untriggers by device type (mobile / desktop) and this PR provides the correct options in the styleguide based on device type. 

# Before
<img width="787" alt="Screenshot 2024-11-25 at 3 31 56 PM" src="https://github.com/user-attachments/assets/f18f3003-e887-42c5-8f42-24af87cadf56">

# After
<img width="800" alt="Screenshot 2024-11-25 at 3 30 48 PM" src="https://github.com/user-attachments/assets/6113eff3-7b1f-4782-aea3-c8bee5e9842a">
2024-11-25 16:00:52 -06: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
Loïc Guitaut
f87333c4e0 DEV: Refactor DiscourseAutomation::DestroyAutomation a bit
Small followup to 932bd6b.
2024-11-22 16:05:31 +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
Jarek Radosz
2589545623
DEV: Detect hbr topic list customizations (#29793) 2024-11-21 16:00:49 +01:00