Commit Graph

3078 Commits

Author SHA1 Message Date
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