Commit Graph

1593 Commits

Author SHA1 Message Date
David Taylor
ed4f80d589
FIX: Chat emoji picker positioning (#28643)
Removes chat-specific changes from dfc947a97d, and adds `preventScroll: true` to prevent timing issues between the emoji picker being brought into the viewport and being focussed.
2024-08-29 17:00:26 +01:00
Renato Atilio
54d6e52607
FIX: chat mailer log noise (#28616)
Fixes the log noise caused by a deprecation notice
2024-08-29 11:39:08 -03:00
David Taylor
a2cab9a342
DEV: Update remaining core plugin components to native-class syntax (#28611)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-29 12:16:52 +01:00
Loïc Guitaut
d26d45540e DEV: Use run_successfully matcher in service specs 2024-08-28 16:30:09 +02:00
Jan Cernik
a12b933f5c
UX: highlight the chat channel/DM only when chat is expanded (#28488) 2024-08-27 09:50:36 -03:00
Joffrey JAFFEUX
b4a8873596
DEV: changes identifier from card to usercard (#28575) 2024-08-27 14:08:49 +02:00
Alan Guo Xiang Tan
82e75c8700
DEV: Migrate Chat::NotificationMention#notification_id to bigint (#28571)
`Notification#id` was migrated to `bigint` in 799a45a291
2024-08-27 14:57:16 +03:00
David Battersby
910bfaf5f5
FIX: prevent desktop notification callbacks on mobile (#28527) 2024-08-26 15:49:49 +10:00
David Taylor
fe6c91daa3
DEV: Convert select-kit subclasses to native class syntax (#28491)
This covers all select-kit subclasses in core and core plugins

Followup to https://github.com/discourse/discourse/pull/28489
2024-08-23 13:19:26 +01:00
Joffrey JAFFEUX
842d2749a1
FIX: adds chat-draw-expanded class to body (#28490)
To achieve this, the code is now using bodyClass instead of relying on the addChatDrawerStateCallback`.
2024-08-22 17:46:41 +02:00
Loïc Guitaut
f11f2b983f DEV: Put back the model step in HandleCategoryUpdated service
Now that `ActiveRecord` relations are properly handled in a `model`
step, putting this step back will allow the service to stops its
execution if there are no users to be removed without calling the pretty
big SQL query contained in the `CalculateMembershipsForRemoval` action.
2024-08-22 12:33:58 +02:00
Régis Hanol
4b49e358fb
FIX: skip 1:1s when chat search returns users (#28464)
When we use CTRL/CMD + K to search, on the server we run 4 queries:

- 1 for users
- 1 for groups
- 1 for category channels
- 1 for direct message channels

The server returns up to 10 results per type and the client concatenate all the results (in the order I described) and then takes the first 10 or so.

Let's say you've had 1:1s with john1, john2, and john3. Searching for “john” would return all the johns as “users”. It doesn’t make sense to also return them as 1:1 dms.

That’s what this fixes. When the search returns some users, we skip all 1:1s because we assume they will show up as the results of the “users” query.

We’ll always return matching direct messages with more than 2 users (aka. “group chats”). All 3 other queries (users, groups, and category channels) are unaffected.

Internal ref - t/136079
2024-08-22 11:35:13 +02:00
Loïc Guitaut
0636855706 DEV: Allow using an AR relation as a model in services
This patch allows using an AR relation as a model in services without
fetching associated records. It will just check if the relation is empty
or not. In the former case, the execution will stop at that point, as
expected.
2024-08-20 16:32:46 +02:00
Osama Sayegh
db6eff7be9
DEV: Allow custom site activity items in the new /about page (#28400)
This commit introduces a new frontend API to add custom items to the "Site activity" section in the new /about page. The new API is called `addAboutPageActivity` and it works along side the `register_stat` serve-side API which serializes the data that the frontend API consumes. More details of how the two APIs work together is in the JSDoc comment above the API function definition.

Internal topic: t/128545/9.
2024-08-20 16:16:05 +03:00
Joffrey JAFFEUX
ccb1861ada
DEV: better highlighting of mentions (#28403)
This commit improves the hilight-ing of mentions in posts and chat messages.

- `@here` and `@all` will generate a `<a class="mention --wide">`
- bots will generate a `<a class="mention --bot">`
- current user will generate a `<a class="mention --current">`

To achieve this change the following value transformer has been added: "mentions-class". It will be run in posts and chat messages after the mention is rendered.

A bug were bots were not considered in mentioned users has also been fixed as part of this PR.
2024-08-20 14:37:28 +02:00
David Taylor
dfc947a97d
PERF: Defer button actions to improve interaction-next-paint (INP) (#28019)
This is a variation on bc3e8a9963cf9a64d114ec751c875025af169690, which was reverted due to issues on iOS. Safari's "in response to user action" check cannot follow the `runAfterFramePaint` chain of interaction -> requestAnimationFrame -> messageChannel, and so some sensitive browser APIs (e.g. clipboard, upload, etc.) were blocked.

This commit is similar, but uses `next()` instead of `runAfterFramePaint()`. The result seems the same, but doesn't have the same issue on iOS.

The chat-emoji-picker change was required to resolve a test failure. The emoji picker has never closed-on-scroll on desktop, so there is no user-facing change in behavior.
2024-08-20 10:11:34 +08:00
Sam
ade001604b
PERF: automatically join users to channels more efficiently (#28392)
- Only ever auto join 10k users to channels (ordered by last seen)
- Join users to all channels at once, instead of batching and splitting
2024-08-16 13:58:12 +10:00
Alan Guo Xiang Tan
de79e5628e
PERF: Reduce mem allocation of Chat::AutoRemove::HandleCategoryUpdated (#28393)
This is a follow-up to 671f40ce07 and
ed11ee9d05.

While the optimisations in the previous commits were sound, it did not
resolve the memory bloat we were seeing. It turns out that we call
`.blank?` on the model's result if the model has not been marked
optional. The problem with this is that if the model returns an
ActiveRecord relation, calling `.blank?` on the relation basically loads
everything into memory.

Therefore, this commit removes `users` as a model in the  since it really isn't
a model but just a relation.
2024-08-16 11:35:08 +08:00
Alan Guo Xiang Tan
671f40ce07
PERF: Reduce memory footprint of Chat::AutoRemove::HandleCategoryUpdated.call (#28381)
This is a follow up to ed11ee9d05.

In `Chat::AutoRemove::HandleCategoryUpdated`, we are currently loading
the related users record in batches and then handing it off to
`Chat::Action::CalculateMembershipsForRemoval.call`. However, we are
still seeing memory spike as a result of this.

This commit eliminates the allocation of `User` ActiveRecord objects until
absolutely necessary. `Chat::Action::CalculateMembershipsForRemoval.call` has been
updated to accept an ActiveRecord relation instead which allows us to
avoid the ActiveRecord allocations.
2024-08-16 05:37:31 +08:00
David Battersby
e16f22c372
FIX: delay chat notify watching job (#28386)
This change delays the notify watching job to allow time for message to be marked as seen within chat.

Without a slight delay the job fires straight away and often means that messages are seen on screen but the user also receives a notification due to Chat::Notifier.user_has_seen_message? returning false.
2024-08-15 18:08:30 +04:00
Alan Guo Xiang Tan
ed11ee9d05
PERF: Reduce memory footprint of Chat::AutoRemove::HandleCategoryUpdated (#28332)
This commit seeks to reduce the memory footprint of `Chat::AutoRemove::HandleCategoryUpdated.call`
by optimizing the
`Chat::AutoRemove::HandleCategoryUpdated#remove_users_without_channel_permission` method which was
loading all the ActiveRecord users objects into memory at once. This
change updates the method call to load the ActiveRecord user objects in
batches instead.
2024-08-14 09:30:36 +08:00
chapoi
b3bf465890
UX: remove baseline alignment from chat timestamp (#28345) 2024-08-13 17:07:12 +02:00
Discourse Translator Bot
05e120a9f2
Update translations (#28246) 2024-08-13 16:31:24 +02:00
Régis Hanol
d10fd36319
FEATURE: participating users statistics (#28322)
Adds a new statistics (hidden from the UI, but available via the API) that tracks daily participating users.

A user is considered as "participating" if they have

- Reacted to a post
- Replied to a topic
- Created a new topic
- Created a new PM
- Sent a chat message
- Reacted to a chat message

Internal ref - t/131013
2024-08-12 23:47:13 +02:00
Mark VanLandingham
79f871b558
FIX: Display new DM button when public channels are disabled (#28306) 2024-08-12 08:44:51 -05:00
Mark VanLandingham
206bbb4255
UX: Add sidebar DM list back when public channels are disabled (#28301) 2024-08-09 09:16:14 -05:00
Joffrey JAFFEUX
7d316922e7
DEV: correctly position below-direct-chat-channels (#28283)
It should be below channels, not above.
2024-08-08 22:55:35 +02:00
Joffrey JAFFEUX
f87c2e7aa7
DEV: adds chat-drawer-before-content plugin outlet (#28284)
This outlet is rendered before the content of the drawer. The `currentRouteName` is accessible in `outletArgs`.

Example:

```gjs
export default class Test extends Component {
  <template>
    {{#if (eq @outletArgs.currentRouteName "chat.browse")}}
      the browse page
    {{/if}}
  </template>
}
```
2024-08-08 22:46:55 +02:00
Joffrey JAFFEUX
e79a50d7a9
DEV: adds logo page component (#28276)
Usage:

```
click_logo # globally accessible
PageObjects::Components::Logo.click
PageObjects::Components::Logo.hover
```
2024-08-08 13:52:48 +02:00
Kris
76b28ed836
UX: fix user profile button wrap, clean up styles (#28255) 2024-08-06 17:47:51 -04:00
Gabriel Grubba
2b577950af
FIX: make the check better for drawer router (#28212)
* FIX: make the check better for drawer rerouter

* adds a redirect method to chat-drawer-routes

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-08-02 17:53:43 -03:00
Gabriel Grubba
633a19fcc0
FIX: Remove chat default channel setting (#28170)
* FIX: Remove chat default channel being applied to mobile chat and drawer

* DEV: removing chat_default_channel_id setting

* DEV: add migration to remove chat default channel id

* DEV: remove default_channel_validator and tests
2024-07-31 14:12:10 -03:00
Martin Brennan
78f8b7ba99
DEV: Skip flaky topic map spec on CI (#28159) 2024-07-31 13:04:05 +10:00
Discourse Translator Bot
1e76fbe207
Update translations (#28146) 2024-07-31 00:14:19 +02:00
Gabriel Grubba
a3d61ba1c4
DEV: rename chat preferred mobile index to chat preferred index (#27953)
* DEV: rename chat preferred mobile index to chat preferred index

* UX: change routing to be consistent with mobile

* DEV: change migration file to use script

* UX: show footer only if more than one option is available

* UX: Remove desktopView only checks for chat

* DEV: Remove unused imports

* UX: Update chat footer checks and Add rerouting to chat drawer

* UX: Add margin to chat row in desktop and update chat drawer logic

* UX: Change chat in desktop to use flexbox

* UX: Add drawer actions to chat navbar

* DEV: Update page object with new chat css classes

removed `.open-browse-page-btn` usage in 7bd65006d7

* DEV: rename `browse/open` in chat url to `channels`

* UX: Adjust css for when in threads mode

* DEV: change css class name in no_sidebar_spec.rb

* DEV: rename tests to be more descriptive with the action they are testing

update chat template to not rely on `:has`

* DEV: update test and add method to chat page object

* DEV: update no_sidebar_spec for chat changes

* DEV: remove tests from navigation_spec that no longer apply

* DEV: revert typo in test

* DEV: change url path for mobile chat in test specs

* DEV: Add check for when is desktop in rerouting

* UX: Removed footer from desktop.

Made `hasThreads` and `hasDirectMessages` methods in chat-drawer public

* UX: remove sidebar on desktop full page if dm list is empty

* DEV: Address review comments

* DEV: Adjust reroute logic for chat browse

remove unused code

* UX: Adjust rerouting to go to browse.open

* UX: Change rerouting to be more consistent

Add chat_default_channel_id routing

* UX: Update rerouting configuration for chat routes

* DEV: Update tests with the new chat behavior

* DEV: revert changes made in tests and bring back toggle for drawer

* DEV: revert classes in page objects

* DEV: Add tests to new chat navigation behavior

remove unused stylesheets
revert deleted lines in tests
update concat class logic in chat dm template

* DEV: update css on test
2024-07-30 10:25:22 -03:00
Natalie Tay
5b51ed3856
DEV: Promote historic post_deploy migrations (#28128)
This commit promotes all post_deploy migrations which existed in Discourse v3.2.0 (timestamp <= 20240112043325)
2024-07-30 01:14:03 +08:00
Discourse Translator Bot
f5fc49f5db
Update translations (#28115)
* Update translations

* DEV: Spec failed because of translation update

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2024-07-29 15:16:40 +02:00
Jarek Radosz
f14cf4f8a9
DEV: Fix random typos (#28103)
July 2024 edition
2024-07-26 23:13:12 +02:00
David Battersby
6f2f34f786
DEV: fix chat message grace edit period flaky (#28095)
The message grace edit window (10 seconds) was too short after freezing time, possibly causing the test to fail occasionally if the record is not updated within 5 seconds.
2024-07-26 18:16:17 +04:00
Jarek Radosz
038e5deb2a
DEV: Clean up imports (#28060)
* `@ember/owner` instead of `@ember/application`
* `discourse-i18n` instead of `I18n`
* `{ service } from "@ember/service"` instead of `inject as service`
2024-07-25 15:09:06 +02:00
Joffrey JAFFEUX
7a7cc815be
DEV: removes legacy modal code (#28047) 2024-07-24 18:07:17 +02:00
chapoi
5b693c61af
UX: change sidebar background to secondary (#28043) 2024-07-23 15:56:21 +02:00
Discourse Translator Bot
5b5d5b4b4a
Update translations (#28041) 2024-07-23 15:23:42 +02:00
Joffrey JAFFEUX
8b18fd1556
FIX: do not reload identical route in drawer (#27992)
This is a performance optimisation to prevent the same route to keep reloading the same endpoint.

No tests as it's not changing behavior and is also quite complex to test efficiently.
2024-07-19 22:27:32 +02:00
Natalie Tay
278ae6e5fd
DEV: Try until success for clipboard copies (#27986) 2024-07-19 19:44:10 +08:00
Joffrey JAFFEUX
c74fa300e7
FEATURE: allows browse page in chat drawer (#27919)
This commit ensures the browse page can be loaded in the drawer and doesn’t force full page mode.

Other notable changes of this commit:
- be consistent about wrapping each full page route with "c-routes.--route-name" and each drawer container with "c-drawer-routes.--route-name"
- move browse channels into its own component, it was before in the template of the channels browse
2024-07-16 12:34:37 +02:00
Régis Hanol
6ebd0c5aec
DEV: skip flaky spec in CI (#27918) 2024-07-15 12:00:43 +02:00
Natalie Tay
9bed472a77
DEV: Temporarily skip failing test on CI (#27915) 2024-07-15 15:23:01 +08:00
Kelv
98cbfd598c
DEV: add deprecation ids for base-url, fa-icon and chat service (#27911) 2024-07-15 14:29:17 +08:00
David Battersby
f75dd1b43a
FIX: update order of chat message service steps (#27889)
A change made in #27875 added a new step to the create message service, however the step should have been placed before saving the message.
2024-07-12 11:56:07 +04:00