Commit Graph

3251 Commits

Author SHA1 Message Date
Osama Sayegh
2f2355b0ad
DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
chapoi
8bbcd409e3
UX: hide user count in original message link (#26890) 2024-05-06 22:02:15 +02:00
Jarek Radosz
79870d3a1e
DEV: Fix random typos (#26881) 2024-05-06 20:52:48 +02:00
Joffrey JAFFEUX
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
Joffrey JAFFEUX
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
Régis Hanol
6c6a56139e FIX: nested polls
Polls should work when "nested" inside a quote or a details block.

Internal ref - t/89085
2024-05-03 19:46:13 +02:00
Joffrey JAFFEUX
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
David Taylor
f28742e597
DEV: Update chat scheduled job loading to match skeleton (#26853)
Followup to e949684fc5, ref https://github.com/discourse/discourse-plugin-skeleton/pull/47
2024-05-02 19:20:00 +01:00
David Taylor
e949684fc5
DEV: Eager load chat's scheduled jobs in development mode (#26852) 2024-05-02 18:26:30 +01:00
Joffrey JAFFEUX
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
David Battersby
c1f6ec5f62
FIX: add excerpt fallback for chat message replies (#26834) 2024-05-01 16:39:47 +02:00
Osama Sayegh
8ed684312f
FIX: Prevent race condition in recurring automations (#26828)
Recurring automations are triggered by a scheduled job that runs every minute and checks for due automations, runs them and then marks as them as completed (by deleting the `PendingAutomation` record). However, the job is currently subject to a race condition where a recurring automation can be executed more than once at its due date if it takes more than a minute to finish.

This commit adds a mutex around the code that triggers the recurring automation so that no concurrent executions can happen for a single automation.

Meta topic: https://meta.discourse.org/t/daily-summary-9pm-utc/291850/119?u=osama.
2024-05-01 09:01:58 +03:00
Discourse Translator Bot
d1f008a2fc
Update translations (#26821) 2024-04-30 21:57:28 +02:00
Joffrey JAFFEUX
038236fcca
FIX: prevents long URL to overflow thread title (#26827) 2024-04-30 21:44:35 +02:00
Osama Sayegh
0e44072b2b
FIX: Prevent infinite loop of automations triggering each other (#26814)
It's currently possible to setup multiple automation rules that trigger each other resulting in an infinite loop. To prevent that, this commit adds a global "circuit breaker" that prevents all automations from triggering while an automation rule is executing.

Internal topic: t/124365.
2024-04-30 20:13:29 +03:00
Jarek Radosz
3930064fd1
DEV: Convert various components to gjs (#26782)
Those were all low hanging fruits - all were already glimmer components, so this was mostly merging js and hbs files and adding imports.

(occasionally also adds/fixes class names)
2024-04-30 16:44:49 +02:00
Joffrey JAFFEUX
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
David Battersby
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
Joffrey JAFFEUX
c1c823144b
FIX: correctly rename scroller everywhere (#26783) 2024-04-29 08:45:37 +02:00
Jarek Radosz
cf11e556cb
DEV: Update htmlSafe imports (#26776) 2024-04-27 12:01:58 +02:00
Joffrey JAFFEUX
fb40f50865
FIX: ensures last read is updated on new message (#26772) 2024-04-26 18:27:39 +02:00
Joffrey JAFFEUX
e7f0aa52fa
FIX: ensures we don't exit without pending automations (#26771)
This case is not supposed to happen but it seems safer to ensure this case will recreate pending automations.
2024-04-26 14:05:27 +02:00
Joffrey JAFFEUX
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
David Battersby
dad6912566
DEV: add toast progress bar to styleguide (#26767) 2024-04-26 16:49:58 +08:00
David Battersby
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
Régis Hanol
989d6f921a UX: loading spinner when clicking an item
This fixes the UX when clicking a checklist item to toggle its state.
2024-04-25 18:45:38 +02:00
Joffrey JAFFEUX
0f2067b363
DEV: drop ignored columns (#26755)
chat_channels - last_message_sent_at
2024-04-25 16:35:23 +02:00
David Battersby
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
Joffrey JAFFEUX
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
Joffrey JAFFEUX
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
Discourse Translator Bot
dde1132a28
Update translations (#26713) 2024-04-23 16:22:27 +02:00
Joffrey JAFFEUX
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
Joffrey JAFFEUX
08ff0bac29
FIX: ensures last read is updated on exit (#26691) 2024-04-20 10:50:32 +02:00
Joffrey JAFFEUX
bf715c8235
FIX: resets pending automations only if necessary (#26685)
Prior to this fix, any change to an automation would reset `pending_automations`, now we only do it if any value related to recurrence (start_date, interval, frequency, execute_at...) has been changed.

It means that any trigger creating `pending_automations` now needs to manage them in the `on_update` callback.
2024-04-19 14:23:57 +02:00
David Taylor
e9e3456f18 DEV: Rename modifier import to avoid overwriting template keyword 2024-04-19 10:06:08 +01:00
Kris
60d3a79d40
UX: update to variable text color for variable background (#26676) 2024-04-18 14:12:16 -04:00
David Taylor
5c2ac4fe88
DEV: Allow RenderGlimmer to be used inside post-cooked-glued widgets (#26675)
In this case, the top-level widget being glued must have a `_postCookedWidget` attribute.
2024-04-18 15:39:29 +01:00
Jarek Radosz
27d9b53bac
FEATURE: Allow dismissing tooltips by clicking their button (#26668)
Also: fixes typos, updates tests, and moves the tooltip element into document.body
2024-04-18 13:16:55 +02:00
Osama Sayegh
4733369f71
FEATURE: Add 'New users only' option to user_updated trigger (#26648)
This commit adds a new option to the `user_updated` trigger of the automation plugin to only trigger an automation for new users that join after the automation is enabled.

Internal topic: t/125829/9.
2024-04-16 21:13:11 +03:00
Discourse Translator Bot
8346f4a1e6
Update translations (#26651) 2024-04-16 17:37:49 +02:00
Martin Brennan
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:

cab178a405

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-04-12 13:14:19 +02:00
Jarek Radosz
4d2dcdad9b
UX: Emoji aligment fixes, followup to #26491 (#26618) 2024-04-12 10:48:14 +02:00
Joffrey JAFFEUX
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
Natalie Tay
18bb6b0871
DEV: Do not attempt to update polls if there are no polls before and after (#26573) 2024-04-12 13:16:10 +08:00
Andrei Prigorshnev
463eff2bbf
DEV: Drop user_id from chat_mentions (#25022)
This column is ignored since 62f423d
2024-04-11 18:50:29 +04:00
Andrei Prigorshnev
8b147b7f84
DEV: Drop chat_mention.notification_id column (#24800)
We ignore this column since fbd24fa
2024-04-11 17:15:57 +04:00
Joffrey JAFFEUX
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
Jan Cernik
389018c0cb
DEV: Fix flaky test when moving threads (#26590) 2024-04-10 22:10:35 -03:00
Joffrey JAFFEUX
d1cdac0e70
FIX: only allows kbd and not details 2024-04-11 00:13:58 +02:00
Joffrey JAFFEUX
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