Commit Graph

3134 Commits

Author SHA1 Message Date
Jarek Radosz
5d90332cfc
DEV: Use the "new" service import (#26059) 2024-03-06 18:05:11 +01:00
Jarek Radosz
11067c73d0
DEV: Use fn+mut instead of action+mut (#26057)
One step closer to removing all `action` helper usage
2024-03-06 18:05:03 +01:00
Joffrey JAFFEUX
65c6909419
DEV: rely on default session in smoke spec (#26054) 2024-03-06 21:08:06 +08:00
Joffrey JAFFEUX
76953cc356
FEATURE: allows to force a thread (#25987)
Forcing a thread will work even in channel which don't have `threading_enabled` or in direct message channels.

For now this feature is only available through the `ChatSDK`:

```ruby
ChatSDK::Message.create(in_reply_to_id: 1, guardian: guardian, raw: "foo bar baz", channel_id: 2, force_thread: true)
```
2024-03-06 12:03:42 +01:00
Alan Guo Xiang Tan
7f7ef60a7b
FIX: Update Discobot's UserProfile#bio_raw when default locale changes (#26045)
Why this change?

When a site's default locale is changed, Discobot's `UserProfile#bio_raw` is not
changed and we have gotten reports about this.

What does this change do?

This change adds a `DiscourseEvent.on(:site_setting_changed)` callback
which watches for changes to the `default_locale` site setting and
updates Discobot's `UserProfile#bio_raw` when it changes.
2024-03-06 11:42:20 +08:00
Alan Guo Xiang Tan
3491642f98
DEV: Make discourse_narrative_bot use Rails autoload (#26044)
Why this change?

Instead of manually loading files, we should just structure the plugin
so that it relies on Rails autoload strategy and avoid all the manual
`require_relative`s.

What does this change do?

1. Structure the plugin to use Rails autoloading convention
2. Remove onceff jobs that were added 5-6 years ago. There is no need to
   carry these jobs anymore after such a long time.
3. Move setting of `SiteSetting.discourse_narrative_bot_enabled` to
   `false` in the test environment from core into the plugin.
2024-03-06 11:14:53 +08:00
Joffrey JAFFEUX
0c827980e6
FIX: do not show threads with no replies (#26033)
Prior to this fix if a user had started to reply to a message without actually sending a message, the thread would still be created and we would end up listing it in the threads list of a channel.

This commit also improves adds thread and thread_replies_count to the 4th parameter of the chat_message_created event.
2024-03-05 20:26:35 +01:00
chapoi
f99687e10d
UX: fix fontsize and weight for prioritize username setting (#26034) 2024-03-05 19:42:24 +01:00
Discourse Translator Bot
6791eb1a94
Update translations (#26030) 2024-03-05 16:47:46 +01:00
David Taylor
ccf0b61fe3
DEV: Convert truth-helpers to a v2 addon and simplify imports (#26029)
No need for a build step here, since the helpers are all simple js.
2024-03-05 15:24:47 +00:00
chapoi
180e6c6188
UX: chat message creator scss cleanup + design tweak to username display (#25928)
* UX: chat message creator scss cleanup + design tweak to username display

* add user status with live updates to modal

* show user status description in modal

* add tests for user status

* UX: add user-status styling to chat message creator


---------

Co-authored-by: David Battersby <info@davidbattersby.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-03-05 12:49:29 +01:00
Joffrey JAFFEUX
27407a25b4
FIX: correctly shows as disabled a user who can't chat (#26010)
Prior to this fix we were checking if user was not part of a group which allows to chat, but we were not checking if this user was part of groups who can use direct messages.
2024-03-05 09:13:42 +01:00
David Taylor
b788c08712
FEATURE: Introduce APIs for manipulating header icons (#25916) 2024-03-04 12:51:49 -07:00
Mark VanLandingham
04b0f40db8
DEV: Modifier for Chat::Mailer to skip summary email for users (#26011) 2024-03-04 09:21:02 -06:00
Loïc Guitaut
f7d7092a7a DEV: Update rubocop-discourse to latest version
The lastest version of rubocop-discourse enables rules regarding
plugins.
2024-03-04 15:08:35 +01:00
Joffrey JAFFEUX
7a6ba47e7b
DEV: quit session asap (#26009) 2024-03-04 11:50:13 +01:00
Joffrey JAFFEUX
3be5daae37
DEV: skip flakey last read spec (#26008) 2024-03-04 11:35:49 +01:00
Joffrey JAFFEUX
3200e276b7
DEV: attempts to fix flakey spec (#25984) 2024-03-01 10:08:24 +01:00
Joffrey JAFFEUX
0b778697ff
FIX: instantly removes group message when leaving (#25961)
Prior to this fix clicking <kbd>x</kdb> on a channel row would effectively leave the channel on server side, but it wouldn't disappear from the screen before a page refresh.
2024-02-29 23:49:01 +01:00
Mark VanLandingham
6c2c690479
DEV: Add push notification filtering to MessageBus alerts (#25965) 2024-02-29 12:49:46 -06:00
Joffrey JAFFEUX
11400bca1a
DEV: attempts to make last spec non flakey (#25962) 2024-02-29 13:15:00 +01:00
Joffrey JAFFEUX
0bb492c6b6
FIX: live updates threads from my threads page (#25955)
Prior to this fix if a user was answering to one of the listed screen it wouldn't update while you look at the list.
2024-02-29 12:31:20 +01:00
Jarek Radosz
5c54fbfdb1
DEV: Fix random typos (#25957)
February 2024 edition
2024-02-29 12:24:37 +01:00
Kris
8c22831672
UX: update appropriate btn-flat instances to btn-transparent (#25945)
With the adjustments of `btn-transparent` in https://github.com/discourse/discourse/pull/24666, there are more buttons that could use this class instead of `btn-flat`. This mostly relates to `x` close buttons, but also includes composer and chat toggles.

The primary difference between these styles is that `btn-transparent` never has a background, where `btn-flat` may have a hover or focus background.
2024-02-29 11:47:07 +01:00
David Battersby
88f833418f
FIX: channel member status live updates (#25925) 2024-02-29 17:49:18 +08:00
Natalie Tay
ef292d1fed
DEV: Shorten a condition (#25951) 2024-02-29 12:57:53 +08:00
Martin Brennan
df4197c8b8
FIX: Show deleted bookmark reminders in user bookmarks menu (#25905)
When we send a bookmark reminder, there is an option to delete
the underlying bookmark. The Notification record stays around.
However, if you want to filter your notifications user menu
to only bookmark-based notifications, we were not showing unread
bookmark notifications for deleted bookmarks.

This commit fixes the issue _going forward_ by adding the
bookmarkable_id and bookmarkable_type to the Notification data,
so we can look up the underlying Post/Topic/Chat::Message
for a deleted bookmark and check user access in this way. Then,
it doesn't matter if the bookmark was deleted.
2024-02-29 09:03:49 +10:00
Kris
c8133318b8
DEV: move chat scrollbar style to scollbar file (#25934) 2024-02-28 19:07:22 +01:00
Kris
6426eaff39
UX: increase chat pre scrollbar contrast (#25930) 2024-02-28 12:27:08 -05:00
chapoi
337773b8ac
UX: chat > general fixes (#25929)
* UX: chat > keep send icon active when keyboard is hidden (mobile)

* FIX: chat > keep composer insert button at bottom

* UX: chat > give seperator equal padding
2024-02-28 15:12:13 +01:00
Jarek Radosz
36a9b5d0fa
DEV: Introduce a helper for handling events (#25433)
Instead of

```hbs
{{on "input" (action this.foo value="target.value")}}
{{on "input" (action (mut this.bar) value="target.value")}}
```

you can use:

```hbs
{{on "input" (with-event-value this.foo)}}
{{on "input" (with-event-value (fn (mut this.bar)))}}
```

or in gjs:

```gjs
import { fn } from "@ember/helper";
import { on } from "@ember/modifier";
import withEventValue from "discourse/helpers/with-event-value";
…
{{on "input" (withEventValue (fn (mut this.bar)))}}
```
2024-02-28 14:00:53 +01:00
Joffrey JAFFEUX
0e17ff8d09
FEATURE: introduces chat_preferred_mobile_index setting (#25927)
`chat_preferred_mobile_index` allows to set the preferred default tab when loading chat on mobile.

Current choices are:
- channels
- direct_messages
- my_threads
2024-02-28 12:05:05 +01:00
David Battersby
5bf06f2634
DEV: skip flaky channel member status test (#25922) 2024-02-28 12:00:51 +08:00
Mark VanLandingham
b426f85a81
DEV: Add modifiers for plugins to customize push notification translation arguments (#25889) 2024-02-27 14:03:55 -06:00
Discourse Translator Bot
eea7af09fd
Update translations (#25914) 2024-02-27 20:50:30 +01:00
Jarek Radosz
f44bee1333
DEV: Use autocomplete="new-password" (#25913)
And normalize `<PasswordField />` arguments

(we were getting `[DOM] Input elements should have autocomplete attributes (suggested: "current-password")` in smoke test logs, this may or may not fix that 😛)
2024-02-27 13:29:12 +01:00
David Battersby
fe851a533a
FIX: add status to channel membership serializer (#25906) 2024-02-27 18:23:59 +08:00
Joffrey JAFFEUX
bb079f54cb
FIX: better handling of error on create DM (#25908)
Prior to this fix we were correctly failing but just returning a generic error.
2024-02-27 10:21:36 +01:00
David Battersby
6a2289f29a
DEV: skip test for channel members user status (#25903) 2024-02-27 13:27:52 +08:00
David Battersby
a423afbbb9
FEATURE: Add user status to chat members list (#25831)
This change adds the user status next to the name within the chat channel members list.
2024-02-27 12:17:15 +08:00
Isaac Janzen
b5d4e06de7
DEV: Update chat addToHeaderIcons to pass component (#25885) 2024-02-26 11:00:16 -07:00
chapoi
ff9c6ce934
UX: fix border-radius for dropdown in chat msg actions (#25881) 2024-02-26 15:50:12 +01:00
chapoi
0dfd30f587
UX: remove margin on bookmark icon on chat msg (#25859) 2024-02-26 15:49:58 +01:00
Andrei Prigorshnev
b3a1199493
FEATURE: Hide user status when user is hiding public profile and presence (#24300)
Users can hide their public profile and presence information by checking 
“Hide my public profile and presence features” on the 
`u/{username}/preferences/interface` page. In that case, we also don't 
want to return user status from the server.

This work has been started in https://github.com/discourse/discourse/pull/23946. 
The current PR fixes all the remaining places in Core.

Note that the actual fix is quite simple – a5802f484d. 
But we had a fair amount of duplication in the code responsible for 
the user status serialization, so I had to dry that up first. The refactoring 
as well as adding some additional tests is the main part of this PR.
2024-02-26 17:40:48 +04:00
Joffrey JAFFEUX
41790f7739
DEV: allows stop/resume streaming on a message (#25774)
```ruby
ChatSDK::Message.start_stream(message_id: 1, guardian: guardian)
ChatSDK::Message.stream(raw: "foo", message_id: 1, guardian: guardian)
ChatSDK::Message.stream(raw: "bar", message_id: 1, guardian: guardian)
ChatSDK::Message.stop_stream(message_id: 1, guardian: guardian)
```

Generally speaking only admins or owners of the message can interact with a message.  Also note, Streaming to an existing message with a different user won't change the initial user of the message.
2024-02-26 14:16:29 +01:00
Joffrey JAFFEUX
cb118c979c
DEV: prevents flakey spec (#25855)
Deleting the user of the message was unreliable, giving the test its own message to act on fixes it.
2024-02-26 09:43:29 +01:00
Joffrey JAFFEUX
a1d7548869
FIX: prevents exception when last reply has deleted user (#25852)
Prior to this fix, if the last message of a thread had been made by a deleted user it would cause an exception as we would have no user to display, this commit uses a solution we have been using at other places: the null pattern, through the use of `Chat::NullUser.new`.
2024-02-26 10:44:54 +08:00
Joffrey JAFFEUX
77028e3675
DEV: adds a chat_can_create_direct_message_channel modifier (#25840)
Plugins can now register this modifier:

```ruby
register_modifier(:chat_can_create_direct_message_channel) do |user, target_users|
  # your logic which should return true or false
end
```
2024-02-23 14:35:02 +01:00
Joffrey JAFFEUX
9e08b45f9b
FIX: correctly updates last read on scroll arrow click (#25838)
Prior to this fix the scroll was ignored when clicking the arrow bottom which would prevent the call to update last read. This fix manually calls update last read in this case and adds a test for it.
2024-02-23 14:23:17 +01:00
chapoi
2d68d8f74c
UX: Chat > send btn alignment + hardcoded value fix (#25836)
* UX: chat > fix alignment of svg icon in send button

* fix forgotten hardcoded value
2024-02-23 10:46:55 +01:00