Commit Graph

1441 Commits

Author SHA1 Message Date
c8faf3e427 FIX: ensures chat notifications links work with subfolder (#26938)
We were missing two `getURL` calls.

The test is now written for subfolder but it's good enough. If it's working for subfolder, it's working for non subfolders, the opposite being false.
2024-05-08 14:47:15 +02:00
fe16633a0c DEV: allows for multiple menus/tooltips (#26823)
menus and tooltips are now appended to their own portals. The service are the only responsible for managing the instances, prior to this commit, services could manage one instance, but the DMenu and DTooltip components could also take over which could cause unexpected states.

This change also allows nested menus/tooltips.

Other notable changes:

- few months ago core copied the CloseOnClickOutside modifier of float-kit without removing the float-kit one, this commit now only use the core one.
- the close function is now trully async
- the close function accepts an instance or an identifier as parameter
2024-05-07 23:48:44 +02:00
278eb0a1a5 FIX: improvements to chat message streaming (#26892)
- prevents re-rendering avatars while updating messages quickly in the thread preview indicator
- ensures the cancel button is shown when you are admin OR when the streamed message is a reply to the current user
2024-05-07 15:38:24 +02:00
42297b2ec3 Update translations (#26903) 2024-05-07 09:31:46 -04:00
26c8eab1f3 FIX: allows bots to create/update/stream messages (#26900)
Prior to this commit, only system users had this pass.

Another significant change of the PR, is to make membership of a channel the angular stone of the permission check to create/update/stop streaming a message. The idea being, if you are a member of a channel already we don't need to check if you can join it AGAIN.

We also have `Chat::AutoRemove::HandleCategoryUpdated` which will deal with permissions change so it's simpler and less prone to error to consider the membership as the only source of truth.
2024-05-07 15:17:42 +02:00
2347ff7074 FIX: only show discourse-ai CTA to admins (#26895) 2024-05-07 00:43:30 +02:00
8bbcd409e3 UX: hide user count in original message link (#26890) 2024-05-06 22:02:15 +02:00
79870d3a1e DEV: Fix random typos (#26881) 2024-05-06 20:52:48 +02:00
f72f63660a FIX: an existing member of a channel is allowed to join (#26884)
There's no point checking if a user can join a channel if they are already part of it. This case was frequent when using `enforce_membership: true` for custom bots for example.
2024-05-06 17:14:20 +02:00
00d88766b2 FIX: correctly pass topic/posts context (#26882)
This case had not been tested end to end as `Discourse.track_events` was not working when wrapping `send_message`. Because of this lack of end to end test, a regression has been created when renaming the expected context properties. This commit fixes the regression and write a slightly convulted, but effective end to end test.
2024-05-06 15:33:00 +02:00
671e6066bf DEV: adds first_messages/last_messages to thread SDK (#26861)
This commit introduces several enhancements to the ChatSDK module, aiming to improve the functionality and usability of chat thread interactions. Here's what has been changed and added:

1. **New Method: `first_messages`:**
   - Added a method to retrieve the first set of messages from a specified chat thread.
   - This method is particularly useful for fetching initial messages when entering a chat thread.
   - Parameters include `thread_id`, `guardian`, and an optional `page_size` which defaults to 10.
   - Usage example added to demonstrate fetching the first 15 messages from a thread.

2. **New Method: `last_messages`:**
   - Added a method to retrieve the last set of messages from a specified chat thread.
   - This method supports reverse pagination, where the user may want to see the most recent messages first.
   - Similar to `first_messages`, it accepts `thread_id`, `guardian`, and an optional `page_size` parameter, defaulting to 10.
   - Usage example provided to illustrate fetching the last 20 messages from a thread.
2024-05-03 17:30:39 +02:00
f28742e597 DEV: Update chat scheduled job loading to match skeleton (#26853)
Followup to e949684fc54e629035b8883dabd9ef2916251da1, ref https://github.com/discourse/discourse-plugin-skeleton/pull/47
2024-05-02 19:20:00 +01:00
e949684fc5 DEV: Eager load chat's scheduled jobs in development mode (#26852) 2024-05-02 18:26:30 +01:00
dda4bb0f7c DEV: allows to disable strip_whitespaces in messages (#26848)
The TextCleaner step has been moved from chat message’s validation to create_message/update_message services. It allows us to easily tweak part of its behavior depending on the needs.

For example we will now disable strip_whitespaces by default when streaming messages as we want to keep newlines and spaces at the end of the message.
2024-05-02 11:59:18 +02:00
c1f6ec5f62 FIX: add excerpt fallback for chat message replies (#26834) 2024-05-01 16:39:47 +02:00
d1f008a2fc Update translations (#26821) 2024-04-30 21:57:28 +02:00
038236fcca FIX: prevents long URL to overflow thread title (#26827) 2024-04-30 21:44:35 +02:00
271ca2c968 FIX: correctly check the user id of the original message (#26805)
Followup: write a test for this
2024-04-29 13:34:49 +02:00
0c8f531909 FEATURE: encourage users to set chat thread titles (#26617)
This change encourages users to title their threads to make it easier for other users to join in on conversations that matter to them.

The creator of the chat thread will receive a toast notification prompting them to add a thread title when on mobile and the thread has at least 5 sent replies.
2024-04-29 17:20:01 +08:00
c1c823144b FIX: correctly rename scroller everywhere (#26783) 2024-04-29 08:45:37 +02:00
cf11e556cb DEV: Update htmlSafe imports (#26776) 2024-04-27 12:01:58 +02:00
fb40f50865 FIX: ensures last read is updated on new message (#26772) 2024-04-26 18:27:39 +02:00
351d212e8a FIX: do not increment reply count manually (#26769)
That could cause flakeyness in specs depending in which timing message bus would arrive and it's not necessary as it should be updated with `handleThreadOriginalMessageUpdate`.
2024-04-26 12:32:06 +02:00
09f2a42f5f FIX: build chat message excerpt for thread preview (#26765)
Follow up to #26712 to account for older threads that don't have a persisted excerpt, as this was previously generated on every page load.

This change allows us to build the excerpt on the fly when none exists, fixing the issue of missing message excerpts for thread previews (within channel) and thread lists (on mobile/desktop).
2024-04-26 14:29:35 +08:00
0f2067b363 DEV: drop ignored columns (#26755)
chat_channels - last_message_sent_at
2024-04-25 16:35:23 +02:00
c62d3610c6 PERF: Reduce overhead from chat message excerpt (#26712)
This change moves the chat message excerpt into a new database column (string) on the chat_messages table.

As part of this change, we will now set the excerpt within the `Chat::CreateMessage` service, and update it within the `Chat::UpdateMessage` service.
2024-04-25 14:29:00 +02:00
52e8d57293 FEATURE: implements last read message for threads (#26702)
This commit will now allow us to track read position in a thread and returns to this position when you open the thread.

Note this commit is also extracting the following components to make it possible:
- `<ChatMessagesScroller />`
- `<ChatMessagesContainer />`

The `UpdateUserThreadLastRead` has been updated to allow this.

Various refactorings have also been done to the code and specs to improve the support of last read.
2024-04-25 10:47:54 +02:00
2bab1df461 FIX: ensures we close modal on reaction (#26745)
It's important to close the modal or we will just remove it from screen without calling callbacks, which will cause the body to be locked on iOS.

It's hard to test this behavior, as it only happens on iOS and the modal will disappear anyways, it's only a matter of ensuring it's closed correctly.
2024-04-24 19:06:11 +02:00
dde1132a28 Update translations (#26713) 2024-04-23 16:22:27 +02:00
a564274ba2 FIX: messages are already reversed (#26692)
This is reverting part of 08ff0bac29 to only have the call on exit channel. This was causing incorrect unread update. I will refactor this in another commit.
2024-04-20 12:33:09 +02:00
08ff0bac29 FIX: ensures last read is updated on exit (#26691) 2024-04-20 10:50:32 +02:00
e9e3456f18 DEV: Rename modifier import to avoid overwriting template keyword 2024-04-19 10:06:08 +01:00
60d3a79d40 UX: update to variable text color for variable background (#26676) 2024-04-18 14:12:16 -04:00
380e5ca6cb DEV: Move more service code to core (#26613)
This is to enable :array type attributes for Contract
attributes in services, this is a followup to the move
of services from chat to core here:

cab178a40557e205e9c3e75fcb411a5e0e164d15

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-04-12 13:14:19 +02:00
4d2dcdad9b UX: Emoji aligment fixes, followup to #26491 (#26618) 2024-04-12 10:48:14 +02:00
01a0f8298f FIX: ensures reply is unlocking body scroll (#26616)
Prior to this fix we were calling the action before closing the menu which could cause various callbacks, like the enable body scroll one, to not be called as some actions will do: `chat.activeMessage = null;` causing the message actions menu to be instantly destroyed.
2024-04-12 10:01:53 +02:00
463eff2bbf DEV: Drop user_id from chat_mentions (#25022)
This column is ignored since 62f423d
2024-04-11 18:50:29 +04:00
8b147b7f84 DEV: Drop chat_mention.notification_id column (#24800)
We ignore this column since fbd24fa
2024-04-11 17:15:57 +04:00
af7d44971d DEV: correctly check for latest (#26603)
This was not testing the right path, and was still green most of the times because we were not waiting for channels to be preloaded in this case.
2024-04-11 14:23:07 +02:00
389018c0cb DEV: Fix flaky test when moving threads (#26590) 2024-04-10 22:10:35 -03:00
d1cdac0e70 FIX: only allows kbd and not details 2024-04-11 00:13:58 +02:00
107015ff4b DEV: allows chat to render specific html tags (#26591)
This commit adds two custom markdown rules:
- chat-html-block
- chat-html-inline

For now it only allows `<kbd>` for inline and `<details>` for block.
2024-04-10 21:23:23 +02:00
7f802e9c42 Update translations (#26575) 2024-04-09 18:48:44 +02:00
f5c9e75438 UX: Fix alignment issues around user status (#26491)
Minor changes but they 1. correct the html structure (no divs in spans) 2. unify the margins
2024-04-09 11:10:12 +02:00
0d0dbd391a DEV: Rename with_secure_uploads? to should_secure_uploads? on Post (#26549)
This method name is a bit confusing; with_secure_uploads implies
it may return a block or something with the uploads of the post,
and has_secure_uploads implies that it's checking whether the post
is linked to any secure uploads.

should_secure_uploads? communicates the true intent of this method --
which is to say whether uploads attached to this post should be
secure or not.
2024-04-09 13:23:11 +10:00
1060e4573a DEV: allows fabricators to use faker (#26555)
The complexity of the situation is that we don't want to load faker into production by default but fabricators and styleguide are available on production.

This is made possible through app/assets/javascripts/discourse/app/lib/load-faker.js which contains a function to ensure faker is loaded asynchronously (loadFaker) and another function to access the loaded faker (getLoadedFaker).

Note 1: this commit also refactors fabricators to have access to context and use faker where possible
Note 2: this commit moves automation to admin bundle

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2024-04-08 21:00:09 +02:00
e34da15b55 FEATURE: Add thread support to the chat message mover (#26147)
When selecting messages to move to a new channel, if any of the selected messages is the original message of a thread, the entire thread, including all its replies, will be moved to the destination channel
2024-04-08 09:03:46 -03:00
0bee802ccc FIX: do not autofocus input on edit in mobile (#26554) 2024-04-08 14:02:36 +02:00
cf7f2a6afb UX: chat > deleted msg styling (#26538) 2024-04-06 11:18:18 +02:00
67a8080e33 FEATURE: Redesigned bookmark modal and menu (#23071)
Adds the new quick menu for bookmarking. When you bookmark
a post (chat message behaviour will come later) we show this new quick
menu and bookmark the item straight away.

You can then choose a reminder quick option, or choose Custom... to open
the old modal. If you click on an existing bookmark, we show the same quick menu
but with Edit and Delete options.

A later PR will introduce a new bookmark modal, but for now we
are using the old modal for Edit and Custom... options.
2024-04-05 09:25:30 +10:00