Commit Graph

3418 Commits

Author SHA1 Message Date
Sam
e3a0faefc5
FEATURE: allow re-scoping chat user search via a plugin (#26361)
This enables the following in Discourse AI

```
 plugin.register_modifier(:chat_allowed_bot_user_ids) do |user_ids, guardian|
  if guardian.user
    mentionables = AiPersona.mentionables(user: guardian.user)
    allowed_bot_ids = mentionables.map { |mentionable| mentionable[:user_id] }
    user_ids.concat(allowed_bot_ids)
  end
  user_ids
end
```

some bots that are id < 0 need to be discoverable in search otherwise people can not talk to them.

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-03-27 08:55:53 +11:00
Discourse Translator Bot
f2a781bcd0
Update translations (#26368) 2024-03-26 16:30:01 +01:00
Jarek Radosz
4c860995e0
DEV: Remove unnecessary rails_helper requiring (#26364) 2024-03-26 11:32:01 +01:00
Joffrey JAFFEUX
9855b794e9
UI: better modal backdrop opacity fading (#26328)
The fading should now be function of the swipe position. We should also correctly instantly remove the fading when closing the modal.
2024-03-22 22:49:01 +01:00
David Taylor
04e365f741
FIX: Remove broken narrative-bot search context logic (#26319)
In the past we had logic to automatically set the search context to the current topic during the tutorial. This hasn't worked for a long time, and clearly people have still been able to complete the tutorial. In fact, it's probably better for us to teach people how to use the search un-assisted anyway.

This commit removes the dead logic, and makes a slight tweak to the copy in the unlikely event of confusion.
2024-03-22 13:25:33 +00:00
David Taylor
2507bd7b70
UX: Ensure all header buttons are consistently sized (#26318)
- Converts all header buttons to use `<DButton`

- Updates `<DButton` to render `<a href=` tags when `@href` is passed (previously it was rendering a `<button`, and then using JS to route when clicked)
2024-03-22 12:50:05 +00:00
Jarek Radosz
6d137a41c2
DEV: Remove the last transpile_js mentions (#26263) 2024-03-20 15:32:37 +01:00
Joffrey JAFFEUX
a884842fa5
FIX: do not use return in block (#26260)
We were incorrectly using `return` in a block which was causing exceptions at runtime. These exceptions were not causing much issues as they are in defer block.

While working on writing a test for this specific case, I noticed that our `upsert_custom_fields` function was using rails `update_all` which is not updating the `updated_at` timestamp. This commit also fixes it and adds a test for it.
2024-03-20 10:49:28 +01:00
David Battersby
2a37be701f
FIX: hide chat btn from user card when chat disabled (#26237)
The issue:
When the current user disables chat from within user preferences, the chat button still appears when clicking another user’s profile picture to open the user card. This is also the case when the current user has chat enabled but the target user has disabled chat.

After this change:
- when a user disables chat in preferences, the chat button should not be displayed when opening a user card or visiting profiles of other users.
- when chat is enabled in preferences but another user disables chat, the chat button should not appear on their user card or profile
2024-03-20 16:24:34 +08:00
Ted Johansson
370c4156fd
FIX: Add missing chat message illegal flag text (#26255)
When adding the new "illegal" flag option, we missed adding the translation to the chat plugin, so when flagging a chat message (rather than a post) you'd see [en.chat.flags.illegal]. This PR fixes that.
2024-03-20 13:03:33 +08:00
Krzysztof Kotlarek
7f3f07dd40
FIX: missing IST KST and JST timezones in cooked posts (#26252)
In this PR we introduced 3 new timezones to UX - IST, KST and JST

cb2569303f

However, the same has to be done in PrettyText so cooked posts respect those timezones.
2024-03-20 11:28:45 +11:00
Martin Brennan
8180770e7b
FIX: Do not lose admin sidebar when opening chat drawer (#26235)
This commit fixes an issue where the following happens:

1. You open /admin as a member of the admin_sidebar_enabled_groups
1. You then click the chat icon in the header when you prefer to have
   drawer open, or if you just minimise chat into drawer after it opens
   fullscreen
1. You lose the admin sidebar panel, and are reset instead to the main
   panel

Also included is a bit of refactoring to make it so the forcing of
admin sidebar state is in one place.
2024-03-20 09:20:06 +10:00
Discourse Translator Bot
29752dda2e
Update translations (#26242) 2024-03-19 16:00:07 +01:00
Jarek Radosz
83e73722a7
DEV: Fix typos in a chat service tests (#26239)
channnel -> channel

and use `assert.true()/assert.false()`
2024-03-19 12:07:19 +01:00
Jarek Radosz
11099434b5
DEV: Clean up mobileView/desktopView uses (#26229)
Inspired by a piece of "do not do x if it's not a mobile view" code 🙃
2024-03-18 23:29:42 +01:00
chapoi
fe02868a79
UX: chat > fix lock icon in original message link (#26227) 2024-03-18 19:30:36 +01:00
Joffrey JAFFEUX
bbb8595107
PERF: defer loading channels (#26155)
Prior to this change we would pre-load all the user channels which making initial page load slower. This change will make them be loaded right after initial load. In the past this was not possible as the channels would have to be loaded on each page transition. However since about a year, we made the channels to be cached on the frontend and no other request will be needed.

I have decided for now to not show a loading state in the sidebar as I think it would be noise, but we can reconsider this later.

Note given we don't have the channels loaded at first certain things where harder to accomplish. The biggest UX change of this commit is that we removed all the complex logic of computing the best channel to display when you load /chat. We will now store the id of the last channel you visited and will use this id to decide which channel to show.
2024-03-18 08:35:07 +01:00
David Battersby
d5b944f1de
FEATURE: add chat direct message button to user profile (#26135)
This change adds the chat direct message button to user profiles, similarly to how we use it within the user card.
2024-03-18 11:17:37 +08:00
Martin Brennan
78bafb331a
FEATURE: Allow site settings to be edited throughout admin UI (#26154)
This commit makes it so the site settings filter controls and
the list of settings input editors themselves can be used elsewhere
in the admin UI outside of /admin/site_settings

This allows us to provide more targeted groups of settings in different
UI areas where it makes sense to provide them, such as on plugin pages.
You could open a single page for a plugin where you can see information
about that plugin, change settings, and configure it with custom UIs
in the one place.

In future we will do this in "config areas" for other parts of the
admin UI.
2024-03-18 08:50:39 +10:00
Penar Musaraj
8cf2f909f5
DEV: Dedicated route for current user notification counts (#26106)
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2024-03-15 12:08:37 -04:00
David Battersby
139e21e37d
UX: fix chat title margin on drawer and side panel (#26171)
Fixes alignment issues within the drawer mode and chat sidebar panel on desktop.
2024-03-14 13:41:42 +08:00
chapoi
1f786f4972
UX: fix chat navbar header alignment (#26161) 2024-03-14 12:11:08 +08:00
Krzysztof Kotlarek
9afb0b29f8
FEATURE: filter additional keywords for the sidebar (#26148)
With the new admin sidebar restructure, we have a link to "Installed plugins". We would like to ensure that when the admin is searching for a plugin name like "akismet" or "automation" this link will be visible. Also when entering the plugins page, related plugins should be highlighted.
2024-03-14 12:28:08 +11:00
Martin Brennan
4e7a75a7ec
DEV: Single admin plugin page for consistent admin plugin UX (#26024)
This commit adds new plugin show routes (`/admin/plugins/:plugin_id`) as we move
towards every plugin having a consistent UI/landing page.

As part of this, we are introducing a consistent way for plugins
to show an inner sidebar in their config page, via a new plugin
API `register_admin_config_nav_routes`

This accepts an array of links with a label/text, and an
ember route. Once this commit is merged we can start the process
of conforming other plugins to follow this pattern, as well
as supporting a single-page version of this for simpler plugins
that don't require an inner sidebar.

Part of /t/122841 internally
2024-03-13 13:15:12 +10:00
Discourse Translator Bot
ec3d29a1fa
Update translations (#26136) 2024-03-12 15:40:11 +01:00
Régis Hanol
47d1703b67
FIX: code "block" detection before showing autocomplete (#26023)
**TL;DR:** Refactor autocomplete to use async markdown parsing for code block detection.

Previously, the `inCodeBlock` function in `discourse/app/lib/utilities.js` used regular expressions to determine if a given position in the text was inside a code block. This approach had some limitations and could lead to incorrect behavior in certain edge cases.

This commit refactors `inCodeBlock` to use a more robust algorithm that leverages Discourse's markdown parsing library.

The new approach works as follows:

1. Check if the text contains any code block markers using a regular expression.
   If not, return `false` since the cursor can't be in a code block.
1. If potential code blocks exist, find a unique marker character that doesn't appear in the text.
1. Insert the unique marker character into the text at the cursor position.
1. Parse the modified text using Discourse's markdown parser, which converts the markdown into a tree of tokens.
1. Traverse the token tree to find the token that contains the unique marker character.
1. Check if the token's type is one of the types representing code blocks ("code_inline", "code_block", or "fence").
   If so, return `true`, indicating that the cursor is inside a code block.
   Otherwise, return `false`.

This algorithm provides a more accurate way to determine the cursor's position in relation to code blocks, accounting for the various ways code blocks can be represented in markdown.

To accommodate this change, the autocomplete `triggerRule` option is now an async function.

The autocomplete logic in `composer-editor.js`, `d-editor.js`, and `hashtag-autocomplete.js` has been updated to handle the async nature of `inCodeBlock`.

Additionally, many of the tests have been refactored to handle async behavior. The test helpers now simulate typing and autocomplete selection in a more realistic, step-by-step manner. This should make the tests more robust and reflective of real-world usage.

This is a significant refactor that touches multiple parts of the codebase, but it should lead to more accurate and reliable autocomplete behavior, especially when dealing with code blocks in the editor.

> Written by an 🤖 LLM. Edited by a 🧑‍💻 human.
2024-03-11 17:35:50 +01:00
David Battersby
3aa1846fc0
UX: chat thread last replied user avatar (#26123)
My Threads on mobile should show the last replied user avatar rather than original poster avatar.
2024-03-11 19:20:08 +08:00
chapoi
cfd72fa65c
UX: remove last reply from My Threads preview + restyle (#25568)
On mobile, when viewing the My Threads area, each thread will show:

- The avatar of the last responder in the thread, overlaid with the chat thread symbol to visually distinguish this area from DMs.
- Either the thread title, where applicable, or the first message of the thread, truncated to fit on one line.
- The channel where the thread originated.
- The last message sent in the thread, truncated to fit on one line.
- When the last message was sent in the thread.

---------

Co-authored-by: David Battersby <info@davidbattersby.com>
2024-03-11 17:59:40 +08:00
Jarek Radosz
147e5563fb
DEV: Update moment and moment-timezone (#26089)
* Bump the moment-timezone version in package.json
* update yarn lock
* bump moment
* bin/rails javascript:update
* npx yarn-deduplicate
* update the spec (not sure which tz changed exactly but there's a 1 hour difference now for year 2018 and earlier 🤷‍♂️)

---------

Co-authored-by: Anton Morgunov <45741336+anmorgunov@users.noreply.github.com>
Co-authored-by: Anton Morgunov <anton@ischemist.com>
2024-03-11 03:04:51 +01:00
Mark VanLandingham
3f1566eeb1
FIX: Use user's locale for chat push notifications (#26107) 2024-03-08 15:18:47 -06:00
chapoi
1fcd6fee29
UX: Chat avatar is-online styling (#26012)
* UX: change is-online from border to box-shadow

* Correct sizing of user-count channel-icon

* Delete obsolete css
2024-03-08 21:11:47 +01:00
Joffrey JAFFEUX
21a7ebf1bc
FIX: improves linking of thread messages (#26095)
- The thread preview is now a regular link and can be right clicked
- left gutter date, and regular date of a thread message will not correctly link to the thread's message
2024-03-08 09:09:42 +01:00
Loïc Guitaut
ac0808a320 DEV: Remove the need for splat operator in services 2024-03-07 15:54:37 +01:00
Joffrey JAFFEUX
821402d024
DEV: removes default service actions (#26078)
Previously services would let you define a high level default `def default_actions_for_service; end` which would define various handlers like `on_success`, after months of usage we consider the cons are superior to the pros here.

Two mains cons:
- people would often not understand where the handling was coming from
- it's easy to miss a case when you write your specs
2024-03-07 12:10:43 +01:00
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
Martin Brennan
cd6fd515fe
FIX: Prevent admin sidebar errors in safe mode (#25832)
In safe mode plugins are not loaded, so the plugin admin
routes are not loaded. This was causing errors in the
admin sidebar because we are trying to show links to the plugin
admin routes.

This fixes the issue by just not adding the plugin links if
we are in safe mode.
2024-02-23 17:04:42 +10:00
chapoi
b2a2203140
UX: chat composer > fix typing indicator and top padding (mobile) (#25821) 2024-02-23 07:59:06 +02:00
chapoi
f4848ae989
UX: tweaks for send button (#25816) 2024-02-22 16:39:54 +01:00
Joffrey JAFFEUX
84cd621bdc
FIX: allows to query a username made of integers (#25815)
If a user had `123456789` as username, it could be passed to the query as a number and the query would fail as it expects a string.

Also applies the same fix to groups.
2024-02-22 14:53:47 +01:00
chapoi
64a41729f7
UX: chat composer design update (mobile) (#25789) 2024-02-22 12:42:07 +01:00
Alan Guo Xiang Tan
6e9fbb5bab
DEV: Do not process requests initiated by browser in a different example (#25809)
Why this change?

We noticed that running `LOAD_PLUGINS=1 rspec --seed=38855 plugins/chat/spec/system/chat_new_message_spec.rb` locally
results in the system tests randomly failing. When we inspected the
request logs closely, we noticed that a `/presence/get` request from a
previous rspec example was being processed when a new rspec example is
already being run. We know it was from the previous rspec example
because inspecting the auth token showed the request using the auth
token of a user from the previous example. However, when a request using
an auth token from a previous example is used it ends up logging out the
same user on the server side because the user id in the cookie is the same
due to the use of `fab!`.

I did some research and there is apparently no way to wait until all
inflight requests by the browser has completed through capybara or
selenium. Therefore, we will add an identifier by attaching a cookie to all non-xhr requests so that
xhr requests which are triggered subsequently will contain the cookie in the request.

In the `BlockRequestsMiddleware` middleware, we will then reject any
requests when the value of the identifier in the cookie does not match the current rspec's example
location.

To see the problem locally, change `Auth::DefaultCurrentUserProvider.find_v1_auth_cookie` to the following:

```
  def self.find_v1_auth_cookie(env)
    return env[DECRYPTED_AUTH_COOKIE] if env.key?(DECRYPTED_AUTH_COOKIE)

    env[DECRYPTED_AUTH_COOKIE] = begin
      request = ActionDispatch::Request.new(env)
      cookie = request.cookies[TOKEN_COOKIE]

      # don't even initialize a cookie jar if we don't have a cookie at all
      if cookie&.valid_encoding? && cookie.present?
        puts "#{env["REQUEST_PATH"]} #{request.cookie_jar.encrypted[TOKEN_COOKIE]&.with_indifferent_access}"
        request.cookie_jar.encrypted[TOKEN_COOKIE]&.with_indifferent_access
      end
    end
  end
```

After which run the following command: `LOAD_PLUGINS=1 rspec --format documentation --seed=38855 plugins/chat/spec/system/chat_new_message_spec.rb`

It takes a few tries but the last spec should fail and you should see something like this:

```
assets/chunk.c16f6ba8b6824baa47ac.d41d8cd9.js {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
/assets/chunk.050148142e1d2dc992dd.d41d8cd9.js {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
/chat/api/channels/527/messages {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
/uploads/default/test_0/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_512x512.png {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
    redirects to existing chat channel
    redirects to chat channel if recipients param is missing (PENDING: Temporarily skipped with xit)
  with multiple users
/favicon.ico {"token"=>"9a75c114c4d3401509a23d240f0a46d4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591736}
/chat/new-message {"token"=>"9a75c114c4d3401509a23d240f0a46d4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591736}
/presence/get {"token"=>"37d995a4b65395d3b343ec70fff915b4", "user_id"=>3382, "username"=>"bruce0", "trust_level"=>1, "issued_at"=>1708591735}
 ```
 
 Note how the `/presence/get` request is using a token from the previous example. 

Co-authored-by: David Taylor <david@taylorhq.com>
2024-02-22 19:41:10 +08:00
David Battersby
1d4ef460ac
UX: chat channel title links to channel settings (#25785) 2024-02-21 17:53:04 +08:00
Martin Brennan
ac92cc526d
FIX: Admin sidebar was hiding chat/forum toggle button (#25781)
We have separated and combined modes for sidebar panels.
Separated means the panels show only their own sections,
combined means sections from all panels are shown.

The admin sidebar only shows its own panels, so it must set
the mode to separated; however when we navigate to chat or
home we must revert to the initial mode setttings.
2024-02-21 14:44:09 +10:00
Martin Brennan
95014e9ab8
FIX: Do not duplicate admin sidebar plugin links (#25780)
When hiding/showing the sidebar, as is the case on mobile
and using the toggle in the top left on desktop, we delete
and recreate the ember component on the page. This causes
the `sections` for each sidebar panel to get re-evaluated
every time.

For the admin sidebar, this means that we were constantly
re-adding the plugin links to the sidebar, causing duplication.
This can be fixed by just adding @cached to the getter for
sections.
2024-02-21 12:58:31 +10:00
Discourse Translator Bot
716e3a4dd5
Update translations (#25767) 2024-02-20 09:42:19 -05:00
David Battersby
5054fe7730
DEV: skip test for chat link with missing param (#25766) 2024-02-20 18:49:30 +08:00
David Battersby
a460dbcb37
FEATURE: Create a link to start a new chat (#25722)
This feature adds the functionality to start a new chat directly from the URL using query params.

The format is: /chat/new-message?recipients=buford,jona

The initial version of this feature allows for the following:

- Open an existing direct message channel with a single user
- Create a new direct message channel with a single user (and auto redirect)
- Create or open a channel with multiple users (and auto redirect)
- Redirects to chat home if the recipients param is missing
2024-02-20 18:08:57 +08:00
Joffrey JAFFEUX
d8d756cd2f
DEV: chat streaming (#25736)
This commit introduces the possibility to stream messages. To allow plugins to use streaming this commit also ships a `ChatSDK` library to allow to interact with few parts of discourse chat.

```ruby
ChatSDK::Message.create_with_stream(raw: "test") do |helper|
  5.times do |i|
    is_streaming = helper.stream(raw: "more #{i}")
    next if !is_streaming
    sleep 2
  end
end
```

This commit also introduces all the frontend parts:
- messages can now be marked as streaming
- when streaming their content will be updated when a new content is appended
- a special UI will be showing (a blinking indicator)
- a cancel button allows the user to stop the streaming, when cancelled `helper.stream(...)` will return `false`, and the plugin can decide exit early
2024-02-20 09:49:19 +01:00
Jan Cernik
a03b9f1602
FIX: Correct category name for auto_join_users_info in chat (#25739) 2024-02-19 06:51:11 -03:00
Krzysztof Kotlarek
fc9648578b
DEV: Make more group-based settings client: false (#25735)
Affects the following settings:

delete_all_posts_and_topics_allowed_groups
experimental_new_new_view_groups
enable_experimental_admin_ui_groups
custom_summarization_allowed_groups
pm_tags_allowed_for_groups
chat_allowed_groups
direct_message_enabled_groups
chat_message_flag_allowed_groups

This turns off client: true for these group-based settings,
because there is no guarantee that the current user gets all
their group memberships serialized to the client. Better to check
server-side first.
2024-02-19 13:25:59 +11:00
chapoi
5b9eac00b9
UX: better card alignment (#25720) 2024-02-16 16:00:55 +01:00
chapoi
292685d3de
UX: Chat browse redesign (#25698)
* UX: fix search input placeholder cutoff

* UX: use transparent button for new-channel

* UX: remove settings link

* UX: removed joined tag

* UX: increase lock icon size

* UX: use grid for channel card

* UX: chat-channel-card styling + cleanup

* UX: dont space about tabs on mobile

* specs

* PR feedback

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>

* PR feedback > translation

* Remove import

* UX: update copy

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-02-15 18:00:22 +01:00
chapoi
4deacc4aa8
UX: prevent groupname from wrapping (#25696) 2024-02-15 14:13:21 +01:00
Alan Guo Xiang Tan
55df52b56d
DEV: Skip consitently flaky tests on CI (#25689)
Why this change?

The tests are consistently flaky and failing with the following error:

```
CapybaraTimeoutExtension::CapybaraTimedOut:
  This spec passed, but capybara waited for the full wait duration (10s) at least once. This will slow down the test suite. Beware of negating the result of selenium's RSpec matchers.
```
2024-02-15 14:14:53 +08:00
Andrei Prigorshnev
e83d8fb3e2
FIX: Allow several chat channels to have an empty slug (#25680)
In certain cases, chat channels may have empty slugs, it happens when:

1. The `slug_generation_method` setting is set to `None`
2. `slug_generation_method` is set to `ASCII` and a channel with 
a Unicode name and an empty slug is created (in this case, the code 
that creates channels tries to generate a slug and fallbacks to an empty slug)

At the moment, we have a unique index on the `chat_channels.slug` column 
which leads to errors when creating several channels with empty slugs 
(Discourse is able to create one such channel, but when trying to create 
the second one fails because of the unique constraint). This PR fixes that 
by adding a `where` condition to the index. Slugs still have to be unique, 
but now many channels may have empty slugs.

This fix is similar to the one we made to the category slugs – 7ba914f1e1.
2024-02-15 00:39:39 +04:00
Discourse Translator Bot
8eab06cb2f
Update translations (#25659) 2024-02-13 16:11:30 +01:00
David Taylor
061e79297f
DEV: Convert User model to native class syntax (#25628)
This commit was created with a combination of the ember-native-class-codemod and manual cleanup.

User-status-related functionality was previously encapsulated in its own `User.reopen` call, which is essentially an 'inline mixin'. This commit refactors it into a utility class, with an instance accessible on `User#statusManager`
2024-02-13 10:49:18 +00:00
Joffrey JAFFEUX
06bbed69f9
DEV: allows a context when creating a message (#25647)
The service `Chat::CreateMessage` will now accept `context_post_ids` and `context_topic_id` as params. These values represent the topic which might be visible when sending a message (for now, this is only possible when using the drawer).

The `DiscourseEvent` `chat_message_created` will now have the following signature:

```ruby
on(:chat_message_created) do | message, channel, user, meta|
  p meta[:context][:post_ids]
end
```
2024-02-13 11:37:15 +01:00
chapoi
2bd0a8f432
UX: Onebox container sizing (#25658)
* UX: scope onebox container size to not images

* UX: increase max-width for onebox img
2024-02-13 10:06:29 +01:00
chapoi
7cd5d646d2
UX: set zindex of chat action menu higher (#25645) 2024-02-13 09:25:42 +01:00
David Battersby
85001a27e9
FIX: sort chat channels by slug (#25656)
Channels can include emojis in front of the channel title which causes problems when sorting.

Using the channel slug is a more reliable way to sort and avoid these kind of issues.
2024-02-13 12:59:46 +08:00
Bianca Nenciu
11e322abbf
DEV: Fix tests (#25644)
Follow up to commit 1403217ca4.
2024-02-12 14:29:23 +02:00
David Battersby
aac28b9048
FIX: sort chat channels by mentions, unread and channel title (#25565)
This change will sort channels by activity on mobile, with preference to those with urgent or unread messages.

Channels with mentions will appear first, followed by channels with unread messages, then finally everything else sorted by the channel title (alphabetically).
2024-02-12 18:19:16 +08:00
Bianca Nenciu
1403217ca4
FEATURE: Async load of category and chat hashtags (#25526)
This commit includes several changes to make hashtags work when "lazy
load categories" is enabled. The previous hashtag implementation use the
category colors CSS variables, but these are not defined when the site
setting is enabled because categories are no longer preloaded.

This commit implements two fundamental changes:

1. load colors together with the other hashtag information

2. load cooked hashtag data asynchronously

The first change is implemented by adding "colors" to the HashtagItem
model. It is a list because two colors are returned for subcategories:
the color of the parent category and subcategory.

The second change is implemented on the server-side in a new route
/hashtags/by-ids and on the client side by loading previously unseen
hashtags, generating the CSS on the fly and injecting it into the page.

There have been minimal changes outside of these two fundamental ones,
but a refactoring will be coming soon to reuse as much of the code
and maybe favor use of `style` rather than injecting CSS into the page,
which can lead to page rerenders and indefinite grow of the styles.
2024-02-12 12:07:14 +02:00
Martin Brennan
d80345fa83
DEV: Chat hashtag test (#25638)
Followup a2a2785f0b, moving
stuff to an existing test.
2024-02-12 12:32:52 +10:00
Bianca Nenciu
a2a2785f0b
FIX: Look up all channel hashtags (#25617) 2024-02-09 19:59:38 +02:00
Martin Brennan
3cc73cfd1e
FIX: Always preload admin plugin list for admin in sidebar (#25606)
When we show the links to installed plugins in the admin
sidebar (for plugins that have custom admin routes) we were
previously only doing this if you opened /admin, not if you
navigated there from the main forum. We should just always
preload this data if the user is admin.

This commit also changes `admin_sidebar_enabled_groups` to
not be sent to the client as part of ongoing efforts to
not check groups on the client, since not all a user's groups
may be serialized.
2024-02-09 12:52:22 +10:00
David Battersby
490041a435
UX: add padding to bottom of mobile chat channel settings page (#25587)
The leave channel button is cut off when accessing the channel settings page on mobile.

This change adds additional padding to the bottom of the channel settings page when accessing via iPad/PWA/Hub.
2024-02-07 22:14:26 +08:00
Discourse Translator Bot
c8c20585a7
Update translations (#25579) 2024-02-06 22:35:44 +01:00
Jan Cernik
8abc7baf7c
FIX: Save previous chat state when navigating with the sidebar (#25537) 2024-02-06 13:11:12 -03:00
David Battersby
4b85975490
FIX: add desktop redirect for mobile only chat routes (#25561)
Chat mobile has separate routes for channels and direct messages. However on desktop we want to prevent these routes from being accessible as they aren't intended to be used by chat in full-page or drawer mode on desktop.
2024-02-05 13:26:01 +08:00
Joffrey JAFFEUX
9961163e82
FIX: prevents discourse header to go under ipad navigation (#25542)
We had two issues which were present for a long time I think:
- one that impacts both core discourse and chat. We were not setting top on the header when `footer-nav-ipad` was present, meaning that you could make it scroll under if you try to scroll up by putting your finger on the discourse header
- one that impacted only chat. It's also present in core, but in core it's not a probem because we don't have a fixed height div. The body height was higher than the screen which would cause a second scrollbar to appear and would slightly break layout, if you scroll on this scrollbar (body).
2024-02-02 15:24:18 +01:00
chapoi
d7cd09d4ab
UX: Chat Sizing on Mobile (#25543)
* UX: increase font-size of last message + decrease emoji size

* UX: decrease size of username emoji

* UX: Mobile chat index cleanup

* UX: decrease size of chat-channel-title in thead list
2024-02-02 14:29:07 +01:00
Andrei Prigorshnev
657eba4782
FIX: only use mention styling for valid mentions in chat (#25523)
Chat should follow the same convention as topics, where invalid mentions 
are not styled the same as valid mentions. This PR makes chat use such styling.

I'm following the same pattern that we use for invalid mentions in posts – 
9bd6523581/app/assets/stylesheets/common/base/topic-post.scss (L1285-L1288)

This way it'll be easier to dry it up if we decide to do that at some point.
2024-02-02 15:56:56 +04:00
Ted Johansson
2da7c74e60
DEV: Remove TagGuardian#can_create_tag? fallback (#25535)
We've changed access settings to be group membership based rather than based on the TL value directly. We kept both conditions here while we updated any plugins and themes. It should now be safe to remove.
2024-02-02 13:48:53 +08:00
Joffrey JAFFEUX
550895a970
FEATURE: adds a link to original message (#25503)
This commit adds a link to the original message of a thread, this link will:
- load the channel message and highlight it while keeping thread panel open on desktop
- open the channel and highlight the message in mobile (and close thread panel, as mobile never shows channel and thread in the same view)

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2024-02-01 18:27:38 +01:00
Joffrey JAFFEUX
4c25266cf7
FIX: better supports ipad and hub footer nav (#25518)
Since https://github.com/discourse/discourse/pull/25501 this behavior was broken. This PR attempts to fix it by being more fine grain.

Also note that this PR is moving `footer-nav-ipad` and `footer-nav-visible` to the `html` element and not the `body`. It makes more sense as we are already adding most of other global state class like `keyboard-visible` to the `html` element.

Tested on:
- chrome desktop
- safari ios - iphone
- PWA ios - iphone
- PWA ios - ipad
- DiscourseHub iphone
2024-02-01 10:24:44 +01:00
Joffrey JAFFEUX
ec26dc51cd
UX: shows PWA/Hub footer navigation on chat (#25501)
This commit sets a default of 0px for `--footer-nav-height` and set it only when `body.footer-nav-visible` allowing us to safely use `--footer-nav-height` wherever it will be needed if set.
2024-01-31 14:41:12 +01:00
Jan Cernik
9b9ff3e10a
FIX: Conditionally hide 'My Threads' on mobile (#25494) 2024-01-31 09:09:04 -03:00
David Battersby
e944468162
FIX: chat channel row indicator should only show urgent count (#25458)
Correctly shows the number of urgent notifications in channel list, rather than showing all new notifications as urgent.
2024-01-31 16:47:54 +08:00
Discourse Translator Bot
c3b8216869
Update translations (#25476) 2024-01-30 17:05:37 +01:00
Andrei Prigorshnev
429a7d09e2
FIX: Chat messages exporter (#25461)
We usually don't enforce foreign key relationships on the database level. 
Because of that, occasionally it's possible to see a chat message that 
references to a non-existent chat_channel or user. MessagesExporter 
failed in such case before, this PR fixes that.
2024-01-30 18:37:11 +04:00
Jan Cernik
8654757581
FIX: Hide 'My Threads' if no followed channels have threads (#25470)
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-01-30 10:53:32 -03:00
Jan Cernik
ab326d10d8
FIX: Make long thread titles readable (#25456)
When reaching the top of a thread, the full thread title will be displayed if it was too long to fit.
It works in mobile, drawer mode, and fullscreen.
---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-01-30 14:18:00 +01:00
Ted Johansson
f0a46f8b6f
DEV: Automatically update groups for test users with explicit TL (#25415)
For performance reasons we don't automatically add fabricated users to trust level auto-groups. However, when explicitly passing a trust level to the fabricator, in 99% of cases it means that trust level is relevant for the test, and we need the groups.

This change makes it so that when a trust level is explicitly passed to the fabricator, the auto-groups are refreshed. There's no longer a need to also pass refresh_auto_groups: true, which means clearer tests, fewer mistakes, and less confusion.
2024-01-29 17:52:02 +08:00
David Battersby
dbdc4bbbd6
DEV: use chat tracking state manager for unread threads (#25457)
Updates the channel list component to use the hasUnreadThreads from Chat Tracking State Manager service.
2024-01-29 14:50:48 +08:00
David Battersby
6b3a68e562
FEATURE: Mobile Chat Notification Badges (#25438)
This change adds notification badges to the new footer tabs on mobile chat, to help users easily find areas where there’s new activity to review.

When on mobile chat:
- Show a badge on the DMs footer when there is unread activity in DMs.
- Show a badge on the Channels footer tab when there is unread channel activity.
- Show a badge on the Threads footer tab when there is unread activity in a followed thread.
- Notification badges should be removed once the unread activity is viewed.

Additionally this change will:
- Show green notification badges for channel mentions or DMs
- Show blue notification badges for unread messages in channels or threads

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2024-01-29 10:38:14 +08:00
Martin Brennan
c7860173c1
DEV: Clean up hashtag code (#25397)
* Delete dead code
* Split up hashtag-autocomplete into more logical modules
2024-01-29 09:48:56 +10:00
Joffrey JAFFEUX
68288a3bfc
FIX: allows to translate yesterday (#25446)
The value [Yesterday] was a fixed string which couldn't be translated. Also removes nextWeek/nextDay which make no sense for dates which are always supposed to be in the past.
2024-01-27 14:03:58 +08:00
Kris
6b185f8655
PERF: eliminate some slow CSS selectors (#25392) 2024-01-26 13:10:45 -05:00
chapoi
08b882097a
UX: chat > channel info: show member count on tab (#25439)
* UX: chat > channel info: show member count on tab
2024-01-26 12:10:56 +01:00
David Battersby
4f5843e819
DEV: remove chat footer thread count reference (#25436)
Removes an unused modifier from chat footer on mobile.
2024-01-26 14:00:10 +08:00
Ted Johansson
7e5d2a95ee
DEV: Convert min_trust_level_to_tag_topics to groups (#25273)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_level_to_tag_topics site setting to tag_topic_allowed_groups.
2024-01-26 13:25:03 +08:00
Joffrey JAFFEUX
7b173e883f
FEATURE: display last message on mobile (#25384)
Direct messages on mobile will now display the last message in the channels list.
2024-01-25 15:30:21 +01:00
Ted Johansson
57ea56ee05
DEV: Remove full group refreshes from tests (#25414)
We have all these calls to Group.refresh_automatic_groups! littered throughout the tests. Including tests that are seemingly unrelated to groups. This is because automatic group memberships aren't fabricated when making a vanilla user. There are two places where you'd want to use this:

You have fabricated a user that needs a certain trust level (which is now based on group membership.)
You need the system user to have a certain trust level.
In the first case, we can pass refresh_auto_groups: true to the fabricator instead. This is a more lightweight operation that only considers a single user, instead of all users in all groups.

The second case is no longer a thing after #25400.
2024-01-25 14:28:26 +08:00
Martin Brennan
57ededb770
DEV: Move admin sidebar out of initializer (#25396)
Having the admin sidebar code in an instance initializer is not
ideal because:

* It runs during app boot which may not even be necessary based on site settings
* It makes it hard for plugins to register additional links in time without resorting
to before/after initializer gymnastics

This PR moves the admin sidebar into a lib and creates the panel
in custom-sections.js, then the sections and links are loaded when
the main sidebar component is rendered, which leaves plugins enough
time to add additional links in an initializer.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2024-01-25 10:45:14 +10:00
Martin Brennan
0e50f88212
DEV: Move min_trust_to_post_embedded_media to group setting (#25238)
c.f. https://meta.discourse.org/t/we-are-changing-giving-access-to-features/283408
2024-01-25 09:50:59 +10:00
Joffrey JAFFEUX
a3c1fff65a
DEV: removes flakey spec (#25405)
scroll position is not reliable enough
2024-01-24 18:56:50 +01:00
Jarek Radosz
fd3c3fa565
DEV: Use service: lookups instead of :main (#25402)
where applicable
2024-01-24 15:59:44 +01:00
Jarek Radosz
57c4b6bd50
DEV: Update js linting setup (#25365) 2024-01-24 15:30:03 +01:00
David Battersby
85d74ec8bf
DEV: remove pseudo-class selector in chat channel page object (#25399)
The channels-list div is only rendered once now so the :first-child pseudo-class can be removed.
2024-01-24 12:24:40 +08:00
David Battersby
04d2ec45b4
DEV: remove user thread count route (#25385)
Removes a now redundant route for the user thread count.
2024-01-24 10:32:34 +08:00
Penar Musaraj
b6f64a70f0
UX: Add "filter for more" to icon picker (#25263)
Repurposes the existing "filter for more" row from the tag drop component.
2024-01-23 21:53:13 +01:00
Discourse Translator Bot
da2c0cd5c0
Update translations (#25386) 2024-01-23 18:29:34 +01:00
David Battersby
67244a2318
FIX: use site setting to show my threads chat footer tab (#25277)
Fixes an issue with delayed rendering of the My Threads tab in chat mobile footer.

Previously we made an ajax request to determine the number of threads a user had before rendering the tab, however it is much faster (and better UX) if we can rely on a site setting for this.

The new chat_threads_enabled site setting is set to true when the site has chat channels with threading enabled.
2024-01-23 19:14:46 +08:00
Joffrey JAFFEUX
eff485e4c0
FIX: renders channels-list wrapper only once (#25383)
This bug was causing broken layout when using the `header_dropdown` setting instead of `sidebar` as we were rendering `<div class="channels-list"></div>` two times.
2024-01-23 11:33:45 +01:00
David Taylor
9d3800adec
DEV: Implement text() for SidebarChatMyThreadsSection (#25371)
In normal use, this `text()` getter is never called. However, when running with the Ember inspector, it is eagerly evaluated and hits throws the "not implemented" error in the base class.
2024-01-23 10:16:47 +00:00
Martin Brennan
db70e7a842
FIX: Minor bookmark issues (#25358)
* FIX: Minor bookmark issues

* We were showing "missing %{name} value" when the name for the
  bookmark was undefined with title translations
* There was no way to see the bookmark details on hover in chat
  for a message where the bookmark icon was in the left gutter.
  We can show the title on the bookmark button in the chat message
  actions instead.

* Minor fix

* DEV: Test fix
2024-01-23 16:49:41 +10:00
Martin Brennan
a03f87bdbd
DEV: Move core plugin TL -> group settings (#25355)
* DEV: Change poll_minimum_trust_level_to_create to group based setting

New setting is poll_create_allowed_groups

c.f. https://meta.discourse.org/t/changes-coming-to-settings-for-giving-access-to-features-from-trust-levels-to-groups/283408

* DEV: Move styleguide_admin_only to group based setting

Not exactly a TL -> group change, but still part of the
overall effort here:

https://meta.discourse.org/t/changes-coming-to-settings-for-giving-access-to-features-from-trust-levels-to-groups/283408

New setting is styleguide_allowed_groups
2024-01-23 11:35:14 +10:00
Jarek Radosz
126ed84bbb
DEV: Remove unused chat css (#25363)
There are no longer any references to `chat-tabs`/`tabpanel` outside this scss files
2024-01-23 06:56:17 +08:00
Joffrey JAFFEUX
aee7197c43
FIX: correctly save scroll position in channel (#25345)
Due to an incorrect test the previous service was incorrectly implementing the map, and was most importantly not deleting the state when reaching bottom.
2024-01-19 22:49:14 +01:00
Joffrey JAFFEUX
ccb5fa1a5a
FIX: correctly exclude muted channels from thread unreads (#25339) 2024-01-19 22:05:41 +01:00
Joffrey JAFFEUX
a840c295d8
FIX: fixed a bug where keyboard on ios was broken (#25338)
It was broken on iOS PWA, when you had the keyboard open and would leave the app. When you came back the body was scrolled and it was looking buggy until you close/reopen keyboard.

This commit attempt to reposition the page correctly 200ms after the tab is visible again.
2024-01-19 17:07:59 +01:00
Joffrey JAFFEUX
3bd88d7586
FIX: ensures active message is cleared on threads opening (#25337)
No test as this is a very specific edge case, already hard to repro manually.
2024-01-19 16:34:24 +01:00
Joffrey JAFFEUX
9365d8b544
FEATURE: save/retrieve scroll position in chat channel (#25336)
Note this is only saved on each tab session.
2024-01-19 16:34:11 +01:00
Joffrey JAFFEUX
2014f1a0b7
FEATURE: implements dates separators for threads (#25335)
This commit creates a shared implementation of the dates computation and moves all the logic (new messages since last visit and dates separator into one single component <ChatMessageSeparator />).

The frontend tests have been removed and only a single system spec has been added for threads as everything is sharing the same implementation and the existing channel specs should catch any regression.
2024-01-19 16:21:48 +01:00
Selase Krakani
d5d0bab19d
DEV: Promote historic post_deploy migrations (#25334)
This commit promotes all post_deploy migrations which existed in Discourse v3.1.0 (timestamp <= 20230405121454)
2024-01-19 14:47:42 +00:00
Jan Cernik
f4e51e0789
FEATURE: Allow users to DM groups in chat (#25189)
Allows users to create DMs by selecting groups as a target. It also allows adding user groups to an existing chat

- When creating the channel, it expands the user group and adds all its members with chat enabled to the channel.
- After creation, there's no difference between adding a group or adding its members individually.
- Users can add multiple groups and users simultaneously.
- There are UI validations; the member count preview updates according to the member count of added groups, and it does not allow users to add more members than SiteSetting.chat_max_direct_message_users."
2024-01-19 11:09:47 -03:00
Andrei Prigorshnev
610d5b45c7
FIX: errors when loading My Threads and Channel Threads (#25310)
This PR fixes the problems described below. We also need tests for this, 
they'll be in a follow-up. When there is a group mention inside a chat 
thread, the next problems are happening.

1. When trying to look at _My Threads_ the list of threads is failing to load 
and there are errors on the console:

Server Error in the current_user_threads_controller:

Message
ActiveRecord::AssociationNotFoundError (Association named 'user' was not 
found on Chat::GroupMention; perhaps you misspelled it?)

app/controllers/application_controller.rb:423:in `block in with_resolved_locale'
app/controllers/application_controller.rb:423:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/missing_avatars.rb:22:in `call'
lib/middleware/turbo_dev.rb:31:in `call'
Backtrace
activerecord (7.0.8) lib/active_record/associations.rb:302:in `association'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:79:in `block in grouped_records'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:77:in `each'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:77:in `grouped_records'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:114:in `loaders'
activerecord (7.0.8) lib/active_record/associations/preloader/branch.rb:71:in `runnable_loaders'
activerecord (7.0.8) lib/active_record/associations/preloader/batch.rb:15:in `each'
activerecord (7.0.8) lib/active_record/associations/preloader/batch.rb:15:in `flat_map'
activerecord (7.0.8) lib/active_record/associations/preloader/batch.rb:15:in `call'
activerecord (7.0.8) lib/active_record/associations/preloader.rb:118:in `call'
activerecord (7.0.8) lib/active_record/relation.rb:830:in `block in preload_associations'
activerecord (7.0.8) lib/active_record/relation.rb:829:in `each'
activerecord (7.0.8) lib/active_record/relation.rb:829:in `preload_associations'
activerecord (7.0.8) lib/active_record/relation.rb:918:in `block in exec_queries'
activerecord (7.0.8) lib/active_record/relation.rb:962:in `skip_query_cache_if_necessary'
activerecord (7.0.8) lib/active_record/relation.rb:908:in `exec_queries'
activerecord (7.0.8) lib/active_record/relation.rb:695:in `load'
activerecord (7.0.8) lib/active_record/relation.rb:250:in `records'
activerecord (7.0.8) lib/active_record/relation.rb:783:in `blank?'
plugins/chat/app/services/service/base.rb:143:in `call'
plugins/chat/app/services/service/base.rb:368:in `block in run!'
plugins/chat/app/services/service/base.rb:368:in `each'
plugins/chat/app/services/service/base.rb:368:in `run!'
plugins/chat/app/services/service/base.rb:361:in `run'
<internal:kernel>:90:in `tap'
plugins/chat/app/services/service/base.rb:229:in `call'
plugins/chat/app/helpers/chat/with_service_helper.rb:22:in `run_service'
plugins/chat/lib/service_runner.rb:121:in `call'
plugins/chat/lib/service_runner.rb:115:in `call'
plugins/chat/app/helpers/chat/with_service_helper.rb:18:in `with_service'
plugins/chat/app/controllers/chat/api/current_user_threads_controller.rb:5:in `index'
actionpack (7.0.8) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.8) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.0.8) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.8) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
app/controllers/application_controller.rb:423:in `block in with_resolved_locale'
i18n (1.14.1) lib/i18n.rb:322:in `with_locale'
app/controllers/application_controller.rb:423:in `with_resolved_locale'
activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.8) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.8) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/rescue.rb:23:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.8) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.8) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.8) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.8) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.8) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.8) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.8) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.8) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.3.0) lib/mini_profiler/profiling_methods.rb:115:in `block in profile_method' 
actionpack (7.0.8) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.8) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:852:in `call'
railties (7.0.8) lib/rails/engine.rb:530:in `call'
railties (7.0.8) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.8) lib/rails/railtie.rb:226:in `method_missing'
actionpack (7.0.8) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (7.0.8) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.8) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.8) lib/action_dispatch/routing/route_set.rb:852:in `call'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.8) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.8) lib/rack/head.rb:12:in `call'
actionpack (7.0.8) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/cookies.rb:704:in `call'
activerecord (7.0.8) lib/active_record/migration.rb:638:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.8) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.8) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
logster (2.14.0) lib/logster/middleware/reporter.rb:40:in `call'
railties (7.0.8) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.8) lib/rails/rack/logger.rb:27:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.8) lib/rack/method_override.rb:24:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.8) lib/action_dispatch/middleware/host_authorization.rb:138:in `call'
lib/middleware/missing_avatars.rb:22:in `call'
lib/middleware/turbo_dev.rb:31:in `call'
rack-mini-profiler (3.3.0) lib/mini_profiler.rb:334:in `call'
message_bus (4.3.8) lib/message_bus/rack/middleware.rb:60:in `call'
railties (7.0.8) lib/rails/engine.rb:530:in `call'
railties (7.0.8) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.8) lib/rails/railtie.rb:226:in `method_missing'
rack (2.2.8) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.8) lib/rack/urlmap.rb:58:in `each'
rack (2.2.8) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
bin/unicorn:93:in `load'
bin/unicorn:93:in `block in <main>'
bin/unicorn:92:in `fork'
bin/unicorn:92:in `<main>'

</details>

2. When looking at _channel threads_, threads are getting rendered successfully, 
but there are still errors on the console. The server error is similar to the first case, 
but it's in the `channel_threads_controller`.

This regression was introduced in 62f423da15.

The idea of the fix is that we only need to load user_mentions in those controllers 
anyway (we send them to the client in order to be able to show user status on mentions).
2024-01-18 17:35:32 +04:00
David Battersby
6fa836d781
FIX: prevent popup when thread count request fails (#25308)
On the rare occasions that an ajax request for thread count fails, we should fail silently without alerting the user.
2024-01-18 16:28:23 +08:00
Andrei Prigorshnev
20c5f7aef8
PERF: Avoid loading the whole record when we only need id (#25301) 2024-01-18 08:50:26 +08:00
Andrei Prigorshnev
62f423da15
DEV: Redesign chat mentions (#24752)
At the moment, when someone is mentioning a group, or using here or 
all mention, we create a chat_mention record per user. What we want 
instead is to have special kinds of mentions, so we can create only one 
chat_mention record in such cases. This PR implements that.

Note, that such mentions will still have N related notifications, one 
notification per a user. We don't expect we'll have performance 
problems on the notifications side, but if at some point we do, we 
should be able to solve them on the side of notifications 
(notifications are handled in jobs, also some little delays with 
the notifications are acceptable, so we can make sure notifications 
are properly queued, and that processing of every notification is 
fast enough to make delays small enough).

The preparation work for this PR was done in fbd24fa, where we make 
it possible for one mention to have several related notifications.

A pretty tricky part of this PR is schema and data migration, I've explained 
related details inline on the migration files.
2024-01-17 15:24:01 +04:00
David Battersby
6876c52857
FIX: set channels tab as default on mobile chat footer (#25296)
This change moves the "Channels" tab to first position in the chat footer nav, and loads it as the default page when opening chat for the first time on mobile.
2024-01-17 17:12:55 +08:00
David Battersby
c91bd3ca07
UX: hide draft post notice on mobile chat (#25297) 2024-01-17 16:45:25 +08:00
Discourse Translator Bot
50f8a51923
Update translations (#25278) 2024-01-16 14:54:32 +01:00
Joffrey JAFFEUX
a8330222f9
FIX: correctly support safe-area-inset-bottom in footer (#25276) 2024-01-16 11:12:36 +01:00
David Battersby
4512e5652f
FEATURE: Mobile Chat Footer Redesign (#25161)
This update adds three tabs to the bottom of the chat overlay to make it easier for users to navigate chat on mobile.

As a result of this change:

- Direct Messages are now shown separately from public channels on mobile
- My Threads has now moved from the channel list to it's own tab on mobile
- My Threads can still be accessed on desktop via the sidebar and within the drawer channel list
- Chat back button has been updated to navigate to the correct tab (for both channels and threads)

Some special cases:

- If DMs are not used then the tab is not rendered
- If the user has no threads then the tab is not rendered
- If both the tabs for DMs and Threads aren't available then the whole footer will not be rendered
- Chat footer is only shown on the listing pages (DMs, Channels, My Threads)

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-01-16 14:29:33 +08:00
Penar Musaraj
f2cf5434f3
Revert "DEV: Convert min_trust_level_to_tag_topics to groups (#25258)" (#25262)
This reverts commit c7e3d27624 due to
test failures. This is temporary.
2024-01-15 11:33:47 -05:00
Ted Johansson
c7e3d27624
DEV: Convert min_trust_level_to_tag_topics to groups (#25258)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_level_to_tag_topics site setting to tag_topic_allowed_groups.
2024-01-15 20:59:08 +08:00
chapoi
60a4d09f1a
UX: Chat composer dropdown styling mobile (#25244) 2024-01-15 09:59:24 +01:00
Kris
731699a7cf
UX: adjust onebox styles for chat, title line-height (#25249) 2024-01-12 18:14:26 -05:00
Kris
92708f2ff5
DEV: remove :has selector from chat settings (#25248) 2024-01-12 18:04:27 -05:00
chapoi
190a8db55d
UX: remove lock icon positioning (#25241) 2024-01-12 15:53:57 +01:00
chapoi
b063d92ad1
UX: chat header size and alignments (#25239)
This commit:

- increased the size of chat-header-offset from 46px to 56px on mobile
- tweaked navbar padding
- Increased the gap between back button and title; this means no more perfect alignment, but I think that's perfectly fine and a fair trade off for an easier click target for the back button without fear of hitting the title
2024-01-12 14:27:44 +01:00
chapoi
bad14899e6
UX: change chat back button to btn-transparent (#25184) 2024-01-12 13:11:25 +01:00
Jarek Radosz
3a0bf97401
DEV: Minor cleanup of navbar components (#25222)
Convert components to template-only where applicable.
2024-01-11 19:20:27 +01:00
Jarek Radosz
6d9fcf8f76
DEV: Don't apply this-fallback to strict-mode components (#25216)
fixes the issue with imported components references in plugin gjs files
2024-01-11 11:35:00 +01:00
Penar Musaraj
26747540d2
FIX: Chat summary email link in subfolder setups (#25188)
This regressed in 2791e75072. That commit
fixed subfolder URLs in general, but the `full_url` was adding the
subfolder prefix a second time, thus breaking this URL in emails.
2024-01-10 11:52:57 -05:00
Discourse Translator Bot
2e0ec679c5
Update translations (#25185) 2024-01-09 15:09:36 +01:00
chapoi
d4ce503460
UX: add max width for c-navbar on mobile to prevent horizontal scroll (#25182) 2024-01-09 13:18:05 +01:00
Jarek Radosz
0d38b4d0a9
UX: Add title attr to thread titles (#25178)
…so it's possible to read them when they're inevitably trunacted
2024-01-09 01:57:36 +01:00
Martin Brennan
8c6144d116
DEV: Change enable_admin_sidebar_navigation to group setting (#25159)
This will make it easier to do more focused
testing of this change.
2024-01-09 09:06:27 +10:00
Joffrey JAFFEUX
fd4ff92892
SECURITY: ensures mentioned_users is limited
Prior to this fix the number of users rendered by mentioned_users could equal the number of members in a channel which would be slow but could in more extreme case crash the page and/or server.
2024-01-08 08:02:13 -07:00
Martin Brennan
628873de24
FIX: Sort plugins by their setting category name (#25128)
Some plugins have names (e.g. discourse-x-yz) that
are totally different from what they are actually called,
and that causes issues when showing them in a sorted way
in the admin plugin list.

Now, we should use the setting category name from client.en.yml
if it exists, otherwise fall back to the name, for sorting.
This is what we do on the client to determine what text to
show for the plugin name as well.
2024-01-08 09:57:25 +10:00
Andrei Prigorshnev
93ca13e534
DEV: Add new chat metrics (#23872)
This adds the following chat metrics:

- _chat_open_channels_with_threads_enabled_ — a count of open channels 
where threading is enabled.
- _chat_channel_messages_ — a count of messages sent in a chat channel 
(i.e. not a personal chat / direct message), within a thread or outside of a thread.
- _chat_threaded_messages_ — a count of messages sent within a thread 
in a chat channel (i.e. not a personal chat / direct messages).
- _chat_direct_messages_ — a count of messages sent in a personal chat / direct messages.

The metrics added using the plugin API introduced in 098ab29d, 
and extended in d91456fd.

Note that these stats won't be exposed at the `about.json` 
and the `site/statistics.json` routes.
2024-01-04 16:10:03 +04:00
Jarek Radosz
b43bba7dd7
UX: Improve border-radius stuff in chat-message actions (#25129) 2024-01-04 12:33:07 +01:00
Jan Cernik
117611ea82
FIX: 500 error when reviewable has a missing message (#25113) 2024-01-03 11:49:54 -03:00
Discourse Translator Bot
8e1fc93748
Update translations (#25088) 2024-01-02 15:25:58 +01:00
David Battersby
406f4c9e80
DEV: fix flaky back to forum spec (#25071)
Fixes a flaky test by ensuring Capybara finishes loading the topic page before attempting to open chat. The back to forum url relies on a tracked property (previous url), which is set when visiting the topic page.
2023-12-29 16:55:12 +08:00
Alan Guo Xiang Tan
ea910e291b
DEV: Remove assertion causing test to be flaky (#25069)
Why this change?

The assertion does not make use of Capybara's waiting strategy and is
not really testing anything meaningful by asserting for the src of the
img element.
2023-12-29 13:23:16 +08:00
Joffrey JAFFEUX
40ce619edd
DEV: uses in: {} with lambda to work with eager_load (#25039)
When validating with a dynamic set of values, especially one that might change during runtime, we should use a lambda or a proc to ensure that the validation uses the most up-to-date set of values. This is particularly important when using config.eager_load = true, which can cause some elements to be loaded only once at startup, thus not reflecting changes made at runtime.

This was the root cause of the issues here, as we were adding more ReviewableScore types after initial load through: `register_reviewable_type Chat::ReviewableMessage`
2023-12-29 12:45:07 +08:00
David Battersby
1061bf97e2
UI: chat header style improvements (#25057)
Small visual improvements for chat header on mobile:

- makes the Back to Forum target size slightly narrower
- makes the text color consistent between header and back button (and d-icon)
- makes the chat heading bold
2023-12-28 17:44:53 +08:00
Discourse Translator Bot
cd818ab63f
Update translations (#25041) 2023-12-28 10:12:53 +01:00
David Battersby
3d4b62651e
FIX: chat drawer routing fix for threads (#25056)
This change fixes a minor regression in the chat back button navigation.
2023-12-28 15:02:33 +08:00
Alan Guo Xiang Tan
655c106101
DEV: Capture and log AR debug logs on GitHub actions for flaky tests (#25048)
Why this change?

We have been running into flaky tests which seems to be related to
AR transaction problems. However, we are not able to reproduce this
locally and do not have sufficient information on our builds now to
debug the problem.

What does this change do?

Noe the following changes only applies when `ENV["GITHUB_ACTIONS"]` is
present.

This change introduces an RSpec around hook when `capture_log: true` has
been set for a test. The responsibility of the hook is to capture the
ActiveRecord debug logs and print them out.
2023-12-27 14:40:00 +08:00
David Battersby
67d736a045
FEATURE: chat header redesign on mobile (#24938)
This change simplifies the layout of our header when chat is open on mobile. The search icon and hamburger menu icons are also hidden and the Discourse logo is replaced by a ← Forum link to make it easier to continue where you left off within the forum (prior to this update the user could only go back to the forum index page).
2023-12-26 17:36:26 +08:00
Alan Guo Xiang Tan
bf3e121323
DEV: Set config.eager_load = true on CI (#25032)
Why this change?

When running system tests on our CI, we have been occasionally seeing
server errors like:

```
Error encountered while proccessing /stylesheets/desktop_e58cf7f686aab173f9b778797f241913c2833c39.css
  NoMethodError: undefined method `+' for nil:NilClass
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/path/pattern.rb:139:in `[]'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:127:in `block (2 levels) in find_routes'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `each'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `each_with_index'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `block in find_routes'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:123:in `map!'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:123:in `find_routes'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:32:in `serve'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/routing/route_set.rb:852:in `call'
```

While looking through various Rails issues related to the error above, I
came across https://github.com/rails/rails/pull/27647 which is a fix to
fully initialize routes before the first request is handled. However,
the routes are only fully initialize only if `config.eager_load` is set
to `true`. There is no reason why `config.eager_load` shouldn't be `true` in the
CI environment and this is what a new Rails 7.1 app is generated with.

What does this change do?

Enable `config.eager_load` when `env["CI"]` is present
2023-12-26 13:05:55 +08:00
David Battersby
1010bbf2ce
FIX: whitelist uploads before creating thumbnail variants (#25013)
Only attempt to create thumbnails for whitelisted upload extensions.
2023-12-22 17:59:53 +08:00
Joffrey JAFFEUX
9ebe21df82
FIX: prevents audio container to overflow container (#25012) 2023-12-22 09:38:21 +01:00
Martin Brennan
7fcef5f2f9
FIX: Show admin plugin route sub-links in sidebar (#24982)
This changes the Plugins link in the admin sidebar to
be a section instead, which then shows all enabled plugin
admin routes (which are custom routes some plugins e.g.
chat define).

This is done via adding some special preloaded data for
all controllers based on AdminController, and also specifically
on Admin::PluginsController, to have the routes loaded without
additional requests on page load.

We just use a cog for all the route icons for now...we don't
have anything better.
2023-12-21 11:37:20 +10:00
chapoi
22d4fbf59c
UX: chat navbar > alignments part 2 (#24985)
* UX: chat navbar > alignments part 2

* Change copy to be consistent My threads

* Dont show back button on full page desktop
2023-12-20 16:24:10 +01:00
Alan Guo Xiang Tan
cdd66b24ec
Revert "UX: typo (#24971)" (#24979)
This reverts commit b8a36dd870.

Commit is breaking the build
2023-12-20 13:20:34 +08:00
Alan Guo Xiang Tan
68a3f7783e
DEV: Remove the use of Capybara::Session#quit (#24978)
Why this change?

This is what `Capybara::Session#quit` does:

```
    def quit
      @driver.quit if @driver.respond_to? :quit
      @document = @driver = nil
      @touched = false
      @server&.reset_error!
    end
```

One notable thing is that it resets server errors which means that any
server errors encountered by a session is cleared. That is not what we
want since it hides errors even though `Capybara.raise_server_errors`
has been set to `true`.
2023-12-20 13:20:14 +08:00
Discourse Translator Bot
032bfa3d51
Update translations (#24968) 2023-12-19 22:45:27 +01:00
chapoi
63b217c2bc
UX: chat navbar header specific case (#24972) 2023-12-19 16:37:16 +01:00
chapoi
70f0cb610a
UX: Chat info area back button + styling tweaks (#24966)
## Back button to navigate out of add-member area

Currently on mobile, once you're in the member area, there is no easy to return to the general settings area, except exiting the settings altogether, which isn't very user friendly. A go-back link solves the problem.

## Styling tweaks

* Removed the background from the leave button
* Added more spacing between the sections on desktop and removed the fixed height for rows

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-12-19 16:28:07 +01:00
chapoi
b8a36dd870
UX: typo (#24971) 2023-12-19 16:26:47 +01:00
Andrei Prigorshnev
fbd24fa6ae
DEV: Allow chat mentions to have several notifications (#24874)
This PR is a reworked version of https://github.com/discourse/discourse/pull/24670.

In chat, we need the ability to have several notifications per `chat_mention`. 
Currently, we have one_to_one relationship between `chat_mentions` and `notifications`:

d7a09fb08d/plugins/chat/app/models/chat/mention.rb (L9)

We want to have one_to_many relationship. This PR implements that by introducing 
a join table between `chat_mentions` and `notifications`.

The main motivation for this is that we want to solve some performance problems 
with mentions that we're having now. Let's say a user sends a message with @ all 
in a channel with 50 members, we do two things in this case at the moment:

- create 50 chat_mentions
- create 50 notifications

We don't want to change how notifications work in core, but we want to be more 
efficient in chat, and create only 1 `chat_mention` which would link to 50 notifications. 
Also note, that on the side of notifications, having a lot of notifications is not so 
big problem, because notifications processing can be queued.

Apart from improving performance, this change will make the code design better.

Note that I've marked the old `chat_mention.notification_id` column as ignored, but 
I'm not deleting it in this PR. We'll delete it later in https://github.com/discourse/discourse/pull/24800.
2023-12-19 18:53:00 +04:00
chapoi
558c709fef
UX: align navbar and composer uploads (#24970) 2023-12-19 15:41:51 +01:00
chapoi
9f4fbd0279
UX: use same colour for thread icon as for indicator when unread (#24967) 2023-12-19 12:09:09 +01:00
David Battersby
8ed7f46ce3
FIX: add gallery to lightbox for images in the same chat message (#24962)
When multiple chat images are uploaded to a single message they can use the lightbox gallery.
2023-12-19 17:21:15 +08:00
Joffrey JAFFEUX
c467af97ac
DEV: skip two flakey specs (#24965) 2023-12-19 09:27:09 +01:00
chapoi
dce5e811ef
UX: chat channel info area > classname changes (#24954) 2023-12-18 22:09:47 +01:00
Joffrey JAFFEUX
608ce620fb
FIX: chat navbar followups (#24953)
- displays title on threads screen on one line instead of two on mobile

- ensures chat is not overflowing the screen width
2023-12-18 21:39:36 +01:00
Joffrey JAFFEUX
2ed59266a9
FIX: chat navbar follow-ups (#24951)
- correctly accounts for navbar height on ipad and when keyboard is open
- fixes an incorrect I18n key
2023-12-18 20:22:13 +01:00
Joffrey JAFFEUX
53b96638c5
DEV: implements <Chat::Navbar /> (#24917)
This new navbar component is used for every navbar in chat, full page or drawer, and any screen.

This commit also uses this opportunity to correctly decouple drawer-routes from full page routes. This will avoid having this kind of properties in components: `@includeHeader={{false}}`. The header is now defined in the parent template using a navbar. Each route has now its own template wrapped in a div of the name of the route, eg: `<div class="c-routes-threads">..</div>`.

The navbar API:

```gjs
<Navbar as |navbar|>
 <navbar.BackButton />
 <navbar.Title @title="Foo" />
 <navbar.ChannelTitle @channel={{@channel}} />
 <navbar.Actions as |action|>
   <action.CloseThreadButton />
 </navbar.Actions>
</navbar>
```

The full list of components is listed in `plugins/chat/assets/javascripts/discourse/components/navbar/index.gjs` and `plugins/chat/assets/javascripts/discourse/components/navbar/actions.gjs`.

Visually the header is not changing much, only in drawer mode the background has been removed.

This commit also introduces a `<List />` component to facilitate rendering lists in chat plugin.
2023-12-18 17:49:58 +01:00
Krzysztof Kotlarek
1f72152e47
DEV: Remove usage of min_trust_to_create_topic SiteSetting (#24887)
Using min_trust_to_create_topic and create_topic_allowed_groups together was part of #24740

Now, when plugins specs are fixed, we can safely remove that part of logic.
2023-12-18 13:39:53 +11:00
Kelv
2477bcc32e
DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
Penar Musaraj
8a4ab79be2
DEV: Improve header offset calculation (#24910) 2023-12-15 15:29:17 +01:00
Jan Cernik
437c2c5552
FIX: Do not display chat replies as threads in transcripts (#24768)
* FIX: Do not display chat replies as threads in transcripts

* specs
2023-12-15 09:50:43 -03:00
Jan Cernik
ca3792221a
FIX: Do not notify users for quoted mentions in chat (#24902) 2023-12-14 15:39:28 -03:00
chapoi
7da33ad6ba
UX: user threads styling tweaks 2023-12-13 14:10:52 +01:00
Ted Johansson
294febf3c4
DEV: Convert min_trust_to_flag_posts setting to groups (#24864)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_to_flag_posts site setting to flag_post_allowed_groups.

Note: In the original setting, "posts" is plural. I have changed this to "post" singular in the new setting to match others.
2023-12-13 17:18:42 +08:00
Discourse Translator Bot
7d0562f10e
Update translations (#24848) 2023-12-12 14:23:51 +01:00
Joffrey JAFFEUX
875966cc9e
FIX: ensures border and shadow of header is visible (#24847) 2023-12-12 14:18:36 +01:00
Jarek Radosz
41942357ed
DEV: Use class attribute instead of @class arg (#24804) 2023-12-12 13:09:05 +01:00
Joffrey JAFFEUX
fca67117ee
FIX: incorrect spacing with my threads on ios (#24843)
- sticky doesn't work well with overflow: hidden parents. These overflows were used to hide other issues which shouldn't exist anyways. If it causes issues we should fix the root cause.

- our `--header-offset` is changing a lot on safari while scrolling, sometimes with very unexpected value like: negative or very high value, which causes the navbar to appear at unexpected positions for few ms, this commit is using the value of the header on insert and not changing it after, it shouldn't cause any issue.
2023-12-12 11:32:36 +01:00
David Battersby
22d8978eb4
FIX: increase default max length of chat message excerpts (#24842)
Increases the default max length of message excerpts to allow for longer titles in threads index.
2023-12-12 18:24:07 +08:00
Krzysztof Kotlarek
7dd150bc95
DEV: Convert min_trust_to_edit_wiki_post to groups (#24766)
This change converts the min_trust_to_edit_wiki_post site setting to edit_wiki_post_allowed_groups.

See: https://meta.discourse.org/t/283408

Hides the old setting
Adds the new site setting
Add a deprecation warning
Updates to use the new setting
Adds a migration to fill in the new setting if the old setting was changed
Adds an entry to the site_setting.keywords section
Updates tests to account for the new change
After a couple of months, we will remove the email_in_min_trust setting entirely.

Internal ref: /t/117248
2023-12-12 15:20:37 +11:00
Mark VanLandingham
223e413a6c
DEV: Render glimmer notification items for user notification list (#24802)
This removes the widget notifications list and renders the glimmer user menu notification items instead.
2023-12-11 11:04:43 -06:00
Jan Cernik
4904c2f11b
DEV: Skip chat transcript spec (#24819) 2023-12-11 13:09:22 -03:00
Joffrey JAFFEUX
dacb06842e
FIX: allow to click on thread indicator (#24821)
We can also now control tabindex, and other html attributes, which allows to lick on the thread indicator but not tab to it for example.

By default the tabindex will be 0.
2023-12-11 16:35:29 +01:00
Joffrey JAFFEUX
a7a4aaa6b9
FIX: ensures side panel is closed (#24822)
When navigating to /chat/threads we were not closing the side panel. It would not show as the route doesn't support it, but after if we would open a channel from the sidebar it would open the channel with an empty opened sidepanel .
2023-12-11 16:35:18 +01:00
Joffrey JAFFEUX
2e25e95ce1
UI: ensures emojis are correctly aligned in reactions (#24814)
Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2023-12-11 14:29:16 +01:00
Jan Cernik
72872297f5
FIX: Allow quoting thread's original message (#24773) 2023-12-11 09:58:00 -03:00
Joffrey JAFFEUX
54724f7c09
UX: allow users to click thread title to open it (#24816) 2023-12-11 13:54:00 +01:00
Jan Cernik
549513e25d
DEV: Unskip chat transcript spec (#24778) 2023-12-11 09:46:46 -03:00
Jan Cernik
cf9bef0499
FIX: Navigating out of thread shows other unread threads (#24693)
* FIX: Navigating out of thread shows other unread threads

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-12-11 09:44:50 -03:00
chapoi
8e373bc167
UX: prevent chat channel avatar from getting squished (#24815) 2023-12-11 09:52:12 +01:00
Joffrey JAFFEUX
09277bc543
FEATURE: my threads page (#24771)
This commit adds a new "My threads" link in sidebar and drawer. This link will open the "/chat/threads" page which contains all threads where the current user is a member. It's ordered by activity (unread and then last message created).

Moreover, the threads list of a channel page is now showing every threads of a channel, and not just the ones where you are a member.
2023-12-11 07:38:07 +01:00
Jarek Radosz
694b5f108b
DEV: Fix various rubocop lints (#24749)
These (21 + 3 from previous PRs) are soon to be enabled in rubocop-discourse:

Capybara/VisibilityMatcher
Lint/DeprecatedOpenSSLConstant
Lint/DisjunctiveAssignmentInConstructor
Lint/EmptyConditionalBody
Lint/EmptyEnsure
Lint/LiteralInInterpolation
Lint/NonLocalExitFromIterator
Lint/ParenthesesAsGroupedExpression
Lint/RedundantCopDisableDirective
Lint/RedundantRequireStatement
Lint/RedundantSafeNavigation
Lint/RedundantStringCoercion
Lint/RedundantWithIndex
Lint/RedundantWithObject
Lint/SafeNavigationChain
Lint/SafeNavigationConsistency
Lint/SelfAssignment
Lint/UnreachableCode
Lint/UselessMethodDefinition
Lint/Void

Previous PRs:
Lint/ShadowedArgument
Lint/DuplicateMethods
Lint/BooleanSymbol
RSpec/SpecFilePathSuffix
2023-12-06 23:25:00 +01:00
Jarek Radosz
8623631a06
DEV: Fix random typos (#24756) 2023-12-06 22:25:26 +01:00
Jarek Radosz
6eb1cadb73
DEV: Fix RSpec/SpecFilePathSuffix / enable 3 chat spec files (#24750)
* RSpec/SpecFilePathSuffix
* removes failing specs
* More specific selectors?

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-12-06 22:25:11 +01:00
Kris
22bb1c8951
UX: improve poll text wrap (#24732) 2023-12-06 10:58:06 -05:00
Jarek Radosz
6a66dc1cfb
DEV: Fix Lint/BooleanSymbol (#24747) 2023-12-06 13:19:09 +01:00
Jarek Radosz
138bf486d3
DEV: Fix Lint/DuplicateMethods (#24746) 2023-12-06 13:18:34 +01:00
Jarek Radosz
4280c01153
DEV: Fix Lint/ShadowedArgument (#24733) 2023-12-06 13:16:10 +01:00
David Battersby
78c2f116e0
DEV: skip flaky upload spec for large image thumbnails (#24745) 2023-12-06 19:08:56 +08:00
David Battersby
6dd4937b69
update matchers to improve test suite perf for upload specs (#24744)
This change speeds up our upload specs by avoiding Capybara's default_max_wait_time.
2023-12-06 18:02:55 +08:00
David Battersby
8b46dc8bb5
FEATURE: Add thumbnails for chat image uploads (#24328)
Introduces the concept of image thumbnails in chat, prior to this we uploaded and used full size chat images within channels and direct messages.

The following changes are covered:
- Post processing of image uploads to create the thumbnail within Chat::MessageProcessor
- Extract responsive image ratios into CookedProcessorMixin (used for creating upload variations)
- Add thumbnail to upload serializer from plugin.rb
- Convert chat upload template to glimmer component using .gjs format
- Use thumbnail image within chat upload component (stores full size img in orig-src data attribute)
- Old uploads which don't have thumbnails will fallback to full size images in channels/DMs
- Update Magnific lightbox to use full size image when clicked
- Update Glimmer lightbox to use full size image (enables zooming for chat images)
2023-12-06 14:59:18 +08:00
Martin Brennan
30d5e752d7
DEV: Revert guardian changes (#24742)
I took the wrong approach here, need to rethink.

* Revert "FIX: Use Guardian.basic_user instead of new (anon) (#24705)"

This reverts commit 9057272ee2.

* Revert "DEV: Remove unnecessary method_missing from GuardianUser (#24735)"

This reverts commit a5d4bf6dd2.

* Revert "DEV: Improve Guardian devex (#24706)"

This reverts commit 77b6a038ba.

* Revert "FIX: Introduce Guardian::BasicUser for oneboxing checks (#24681)"

This reverts commit de983796e1.
2023-12-06 16:37:32 +10:00
Martin Brennan
ac60b9fe72
DEV: Skip chat test (#24739)
This consistently fails on core now, see
https://github.com/discourse/discourse/actions/runs/7109919490/job/19355591619?pr=24738

Error: QUnit Test Failure: Browser Id 2 - Discourse Chat | Component | chat message collapser images: escapes link
not ok 444 Chrome 120.0 - [58 ms] - Browser Id 2 - Discourse Chat | Component | chat message collapser images: escapes link
    ---
        actual: >
            false
        expected: >
            true
        stack: >

Expected value is %3Cscript%3Esomeeviltitle%3C/script%3E and actual value is
&lt;script&gt;someeviltitle&lt;/script&gt;
2023-12-06 13:58:13 +10:00
Martin Brennan
9057272ee2
FIX: Use Guardian.basic_user instead of new (anon) (#24705)
c.f. de983796e1

There will soon be additional login_required checks
for Guardian, and the intent of many checks by automated
systems is better fulfilled by using BasicUser, which
simulates a logged in TL0 forum user, rather than an
anon user.

In some cases the use of anon still makes sense (e.g.
anonymous_cache), and in that case the more explicit
`Guardian.anon_user` is used
2023-12-06 11:56:21 +10:00
Discourse Translator Bot
cae2b83af8
Update translations (#24716) 2023-12-05 14:39:08 +01:00
chapoi
3d710fa0b8
UX:; scope details change (#24715) 2023-12-05 13:56:17 +01:00
Joffrey JAFFEUX
c5aa6b5e16
FIX: correctly update replies_count on chat_threads (#24711)
The previous query would look at the existing messages, count them, and update the associated thread.

But, if for some reason messages were **ALL** deleted without updating the `replies_count`, then the query wouldn't find any message, and wouldn't update any thread's `replies_count`.
2023-12-05 13:46:58 +01:00
chapoi
707acbe696
UX: details tag background colour (#24710) 2023-12-05 12:52:00 +01:00
Joffrey JAFFEUX
094d597ec8
FIX: increments message version when processed (#24713)
Incrementing version, ensures the message will re-play decorators.

Also removes a debugging line which had been forgotten.
2023-12-05 12:34:19 +01:00
Ted Johansson
c7667f791e
DEV: Fix chat notifier deprecation warnings from job arguments (#24708)
We're seeing some deprecation warnings in production. This is because we're passing a raw Ruby timestamp, which gets stringified implicitly when written to Redis. As per #15842, this conversion needs to be done explicitly.
2023-12-05 18:03:30 +08:00
Joffrey JAFFEUX
c805bcc7ba
DEV: adds a chat-join-channel-button outlet (#24698)
This outlet allows to redefine the button displayed when asking the user to join a channel.

The following outletArgs are sent to the outlet:

```
onJoinChannel
channel
icon
title
label
disabled
```
2023-12-04 18:11:33 +01:00
Jan Cernik
0af8bbd378
FIX: Multiple nested threads and duplicated messages in chat transcripts (#24685) 2023-12-04 12:43:04 -03:00
David Taylor
d636ff216a
DEV: Resolve transitionTo deprecation in chat-channel route (#24668) 2023-12-01 16:01:59 +00:00
Joffrey JAFFEUX
bcca1692c6
FIX: disables tooltip on desktop message menu’s reaction (#24650) 2023-11-30 19:41:28 +01:00
Joffrey JAFFEUX
a7a7d8e41e
DEV: correctly uses link to message endpoint in spec (#24652)
- correctly uses link to message endpoint in spec
- correctly uses "chat with"
2023-11-30 19:33:41 +01:00
Joffrey JAFFEUX
4fa1b0e978
FIX: show leave channel notice only on group channels (#24653) 2023-11-30 19:24:14 +01:00
Joffrey JAFFEUX
a1ae9f6ab0
FIX: correctly show "chat with" and not "chat in" for users (#24651)
Prior to this fix direct message would always show "Chat in ..." when hovering the channel even if you were hovering a direct message channel with another user (or yourself).

We will now correctly show:

- `Chat in ...` for group channels
- `Chat with ...` for direct message channels
2023-11-30 19:02:19 +01:00
Joffrey JAFFEUX
a1690e0401
DEV: removes dead code (message_link) (#24648)
Linking to a message ID is now handled by the frontend router: `chat.channel.near-message`
2023-11-30 11:13:37 +01:00
Joffrey JAFFEUX
0b65aa8b77
DEV: ensures we have error message before message check (#24647)
Previously the spec could be flakey as the long message could show on the screen while we await for processing. Now we will first check to have the error message on screen, at this point the erroneous message should never be visible.
2023-11-30 10:55:05 +01:00
chapoi
1b022457ad
UX: chat leave info (#24645)
* UX: add info-warning to leave button

* Scope to groupchat

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2023-11-30 10:13:37 +01:00
Martin Brennan
dc8a727b3f
COPY: secure media -> secure uploads (#24643)
Fixing up the last few holdouts
2023-11-30 14:58:55 +10:00
Krzysztof Kotlarek
7e013b2120
DEV: add recurrence rule parameter to downloadCalendar API (#24404)
Add option to create recurrent calendar events. Recurrence rule parameter follows rfc5545 specification: https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10
2023-11-30 13:56:22 +11:00
Joffrey JAFFEUX
384a8b17a1
FIX: leaving a group channel should destroy membership (#24631)
In other kind of channels we will only unfollow but for group channels we don't want people to keep appearing in members list.

This commit also creates appropriate services:
- `Chat::LeaveChannel`
- `Chat::UnfollowChannel`

And dedicated endpoint for unfollow: `DELETE /chat/api/channels/:id/memberships/me/follows`
2023-11-29 17:48:14 +01:00
Jarek Radosz
7cac167928
DEV: Fix "ember/no-empty-glimmer-component-classes" lint (#24629) 2023-11-29 15:14:30 +01:00
Discourse Translator Bot
c90772fd3a
Update translations (#24599) 2023-11-29 10:41:27 +01:00
Sam
b09422428d
DEV: update syntax tree to latest (#24623)
update format to latest syntax tree
2023-11-29 16:38:07 +11:00
Joffrey JAFFEUX
ee5bdb3436
DEV: refactor flag message (#24604)
- Uses a chat service: `Chat::FlatMessage`
- Moves logic inside chat api controllers
- Create a javascript chat api helper: `chatApi.flagMessage(...)`
2023-11-28 18:24:09 +01:00
Jan Cernik
de0c761516
DEV: Skip flaky chat transcript specs (#24607) 2023-11-28 14:13:25 -03:00
Blake Erickson
21d614215b
DEV: Use staged user check instead (#24578)
This change refactors the check `user.groups.any?` and instead uses
`user.staged?` to check if the user is staged or not.

Also fixes several tests to ensure the users have their auto trust level
groups created.

Follow up to:

- 8a45f84277
- 447d9b2105
- c89edd9e86
2023-11-28 07:34:02 -07:00
Jarek Radosz
e9356c2ec9
DEV: Fix "no-empty" lint (#24588) 2023-11-28 10:55:02 +01:00
Jarek Radosz
916e1371b3
DEV: Fix "ember/no-global-jquery" lint (#24586) 2023-11-28 10:53:38 +01:00
Jarek Radosz
22210a9c15
DEV: Fix "no-setter-return" lint (#24585) 2023-11-28 10:49:49 +01:00
Jarek Radosz
cfa7dcaf0a
DEV: Remove unnecessary await settled() (#24584) 2023-11-28 10:45:20 +01:00
Jarek Radosz
b2dfc320aa
DEV: Fix super calls in native chat classes (#24583) 2023-11-28 10:44:47 +01:00
Jarek Radosz
a80e32fe75
DEV: Fix no-extra-boolean-cast lint (#24582) 2023-11-28 10:37:23 +01:00
Jarek Radosz
103fab37e3
DEV: Fix no-unnecessary-curly-strings lint rule (#24580) 2023-11-28 10:35:09 +01:00
Jan Cernik
ac9e804dbe
FEATURE: Add threads support to chat archives (#24325)
This PR introduces thread support for channel archives. Now, threaded messages are rendered inside a `details` HTML tag in posts.

The transcript markdown rules now support two new attributes: `threadId` and `threadTitle`.

- If `threadId` is present, all nested `chat` tags are rendered inside the first one.
- `threadTitle` (optional) defines the summary content.

```
[chat threadId=19 ... ]
thread OM

  [chat ... ]
  thread reply
  [/chat]

[/chat]
```

If threads are split across multiple posts when archiving, the range of messages in each part will be displayed alongside the thread title. For example: `(message 1 to 16 of 20)` and `(message 17 to 20 of 20)`.
2023-11-27 15:47:35 +01:00
Renato Atilio
856ccb34e1
UX: fix new group chat cancel i18n label (#24554) 2023-11-25 16:54:07 -03:00
Jarek Radosz
68960b26be
DEV: Consistently use kebab-case in service lookups (#24552) 2023-11-25 18:10:10 +01:00
Joffrey JAFFEUX
2befff5101
FIX: nullifies target message id when not readable (#24540)
This bug was very reproducible when your last read was a message you didn't read and an admin would delete it. When coming back to the channel you would get a not found, in this case we will now reset last read and present you the last message of the channel.

We could be more fancy and  try to detect the next readable message but that would be more code and complexity for such a rare case.
2023-11-24 11:46:00 +01:00
chapoi
0b352ce7fb
UX: fix date time modal on mobile (#24531)
* UX: fix date time modal
2023-11-24 10:28:46 +01:00
Joffrey JAFFEUX
d667c22171
FIX: prevents input to reset at wrong moment (#24536)
Before this fix we would reset the input two times:

- right before sending message
- and after it's been sent

The second one is actually not necessary, and more over with the server delay the user could have started typing a new message and that would clear it.
2023-11-24 10:59:48 +10:00