Commit Graph

1835 Commits

Author SHA1 Message Date
David Taylor
0ed4b09527
DEV: Move discourse-common/(utils|lib) to discourse/lib (#30733)
`discourse-common` was created in the past to share logic between the
'wizard' app and the main 'discourse' app. Since then, the wizard has
been consolidated into the main app, so the separation of
`discourse-common` is no longer useful.

This commit moves `discourse-common/(lib|utils)/*` into
`discourse/lib/*`, adds shims for the imports, and updates existing
uses in core.
2025-01-13 13:02:49 +00:00
Régis Hanol
1f483f48a0
FIX: remove complicated 'chat_duplicate_message_sensitivity' site setting (#30516)
And change the "formula" to check for duplicate messages to

- no duplicate check in 1:1 DMs
- only duplicate check in group DMs / channels, for posts made by the
same user, in the past 10 seconds

Internal ref - t/144262
2025-01-13 12:32:51 +01:00
David Battersby
0b3663a16a
DEV: fix flaky chat new message spec (#30731)
Ensures that visiting the route creates a new chat channel before
checking the new redirected url is using the last channel.
2025-01-13 17:01:08 +08:00
Joffrey JAFFEUX
6a50b3d4b4
FIX: removes blank spacing in message actions (#30697)
This is a regression of https://github.com/discourse/discourse/pull/28277
2025-01-10 17:34:22 +01:00
Joffrey JAFFEUX
b96a9b9896
FIX: simplify body scroll lock on iOS (#30696)
This will have the following advantages:
- removes a very annoying bug which was making text selection super hard on iOS
- removes the flashing of header when transitioning from disable to enable body scroll lock
2025-01-10 17:13:48 +01:00
Kelv
8719235cfd
DEV: update deprecated icon name archive to box-archive in chat plugin (#30687) 2025-01-10 12:59:56 +08:00
Kris
d9c992bfdd
UX: follow-up sidebar variable fixes for c398933 (#30676) 2025-01-09 15:53:29 -05:00
David Taylor
69ec6d29d7
DEV: Resolve this-property-fallback deprecation in chat test (#30669) 2025-01-09 10:17:18 +00:00
Joffrey JAFFEUX
40f7941f2b
FIX: emoji-picker minor improvements (#30645)
- uses emojiSearch to ensure we have the same result than autocomplete when filtering emojis (for example search aliases were not working correctly because of this)
- reset the visible sections when clearing filter to ensure we are not attempting to display all the emojis at once which would be slow
- prevents flashing of the full emoji list before showing filtered results
- correctly reset recent favorites and only show them when used
2025-01-08 22:10:50 +01:00
Joffrey JAFFEUX
21c8376679
DEV: removes non needed special case (#30638)
Now that we correctly await for the modal to close, we dont need to special case and disable focusTrigger, the flow will now be:

- click an element of the menu
- wait for modal to close
- focus trigger
- trigger action, which will eventually open a modal and attempt to focus the first item
2025-01-08 11:59:16 +01:00
Joffrey JAFFEUX
6740a340ca
DEV: unifies emoji picker (#28277)
The chat emoji picker is renamed emoji-picker, and the old emoji-picker is removed.

This commit doesn't attempt to fully rework a new emoji-picker but instead tries to migrate everything to one picker (the chat one) and add small changes.

Other notable changes:
- all the favorite emojis code has been mixed into one service which is able to store one state per context, favorites emojis will be stored for all topics, and for each chat channel. Meaning that if you always use a specific emoji in a channel, it will only show as favorite emoji in this channel.
- a lot of static code has been removed which should improve initial load perf of discourse. Initially this code was around to improve the performance of the emoji picker rendering.
- the emojis are now stored, once the full list has been loaded, if you close and reopen the picker it won't have to load them again.

List of components:

- `<EmojiPicker />` will render a button which will open a dropdown
- `<EmojiPickerContent />` represents the content of the dropdown alone, it's useful when you want to render a picker from an action which is not the default picker button
- `<EmojiPickerDetached />` just a simple wrapper over `<EmojiPickerContent />` to make it easier to use it with `this.menu.show(...)`

---------

Co-authored-by: Renato Atilio <renatoat@gmail.com>
2025-01-08 11:41:36 +01:00
Discourse Translator Bot
1d7b1e587a Update translations 2025-01-07 21:56:56 +01:00
Renato Atilio
9b4dfbbbfe
DEV: skip flaky chat composer emoji spec (#30623)
This test is flaky, sometimes it fails with the hamburger menu blocking the click on the emoji, other times it just doesn't return the list of emojis when the search term is there.

Other similar emoji tests are skipped. Stopping the bleed, but we still need to figure out a more reliable testing strategy here.

Will revisit after #28277 is merged.

ref /t/-/145212
2025-01-07 13:36:43 -03:00
Gary Pendergast
b6c1e881be
FIX: Ensure popups from the chat composer dropdown gain focus (#30613)
When inserting anything from the chat composer dropdown, any popups opened weren't properly focussed.

This was due to the default behaviour of the dropdown menu closing, which tries to return the focus to the original triggering element. This would normally be the correct behaviour, but here we want the menu to close in the background, handing focus off to the popup, instead.
2025-01-07 17:34:01 +11:00
Martin Brennan
30be75460f
UX: Admin setting page consistency - Group permissions (#30528) (#30578)
* UX: Admin setting page consistency - Group permissions (#30528)

Followup c2282439b3 and
21470e4afd

Adds a new "Group permissions" page and group_permissions site
setting area, which shows every single group-based site setting
in the app and core plugins.

Also adds a "trust_levels" area to show on the already moved
admin "Trust level" settings page, since that previously was
showing a mix of trust level settings and allowed group settings.

* DEV: Review fixes
2025-01-07 11:25:21 +10:00
Osama Sayegh
7df1fac68b
DEV: Fix build (#30600)
The `faker` gem, which is a dependency for the `*:populate` rake tasks, isn't installed in the production environment, so we should only load files/classes related to those rake tasks in non-production environments.
2025-01-07 03:37:03 +03:00
Osama Sayegh
2d424676fc
DEV: Extend the reviewables:populate rake task in chat (#30597)
Related to 5a55c9062a

The chat plugin now makes use of the plugin API that was added in the linked commit for extending the reviewables:populate rake task.
2025-01-07 03:05:34 +03:00
David Battersby
67d568f709
FIX: stuck notification for mentions within threads (#30546)
For mentions within threads, the mentioned user can experience a stuck notification. This is due to thread memberships only being created for users who interact with a thread. Without the membership we cannot track if the message containing the mention was read by the user.

The solution to this explored in this PR is:

- auto add memberships for mentioned users (only direct mentions for performance reasons).
- update channel/thread unread queries to check notification read status AND thread membership last read message id when counting mentions.

Previously the mention count would remain until the user notification (containing the mention) was read. However this only happens if the user clicks the notification or clicks dismiss all notifications. When a user navigated to the thread without clicking the notification, the green/urgent badge on chat would remain even after a hard page refresh.
2025-01-06 17:26:37 +04:00
dependabot[bot]
27c557bc89
Build(deps-dev): Bump mocha from 2.6.1 to 2.7.1 (#30189)
* Build(deps-dev): Bump mocha from 2.6.1 to 2.7.1

Bumps [mocha](https://github.com/freerange/mocha) from 2.6.1 to 2.7.1.
- [Changelog](https://github.com/freerange/mocha/blob/main/RELEASE.md)
- [Commits](https://github.com/freerange/mocha/compare/v2.6.1...v2.7.1)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* DEV: Fix spec

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Brennan <martin@discourse.org>
2025-01-06 12:33:05 +01:00
Gary Pendergast
f5126199f6
UX: Admin setting page consistency - Navigation (#30574)
Create a basic config page that only contains navigation-related settings, to replace the setting filtered view linked to from "Navigation" in the admin sidebar.
2025-01-06 17:44:33 +11:00
Jarek Radosz
a4c2653db8
DEV: Update rubocop-discourse (#30552)
…and autofix the issues
2025-01-04 13:48:21 +01:00
Discourse Translator Bot
6c7eaf99af
Update translations (#30434) 2025-01-03 14:01:32 +01:00
Martin Brennan
3260654505
UX: Admin setting page consistency - Notifications (#30528)
Followup c2282439b3

Make the Notifications config page reached from the sidebar
use our consistent site setting page rules.
2025-01-03 10:34:40 +10:00
Renato Atilio
eb58623b11
UX: replace partially written emoji when using picker on chat (#30517)
After searching for an emoji through the autocomplete, when a user uses the emoji picker (to see the full list of emojis) and selects one, the content in the chat composer would contain both the partially written emoji and the full :selected_emoji: code.

The actual fix is just re-using the emojiSelected method from TextManipulation.
2025-01-02 12:29:18 -03:00
Joffrey JAFFEUX
e9d4afec53
DEV: simplify restore message spec (#30490)
This spec was flaky, by not using a second session and rely on services instead, I hope to make it more stable and faster.
2024-12-28 15:27:12 +01:00
Joffrey JAFFEUX
4e5fc4654c
DEV: fixes safari bug with content including linebreaks (#30451) 2024-12-23 18:39:28 +01:00
Jordan Vidrine
d69b7da3ca
fix (#30450) 2024-12-23 09:42:55 -06:00
Jarek Radosz
c3548aec5e
DEV: Don't use 0-delay for test-env discourseLater (#30442)
`discourseLater` automatically uses delay of 10ms in test environment
2024-12-23 16:31:46 +01:00
Jarek Radosz
d0e38977e3
UX: Remove chat hover effect from github status badge (#30447) 2024-12-23 16:31:29 +01:00
Joffrey JAFFEUX
3198326cda
DEV: ensures channel has been created (#30445)
We were sometimes trying to fetch the channel before it has been created.
2024-12-23 13:54:22 +01:00
Joffrey JAFFEUX
ae4a4b7d00
DEV: waits for mark_read! to be applied (#30444) 2024-12-23 13:54:13 +01:00
Joffrey JAFFEUX
96b5c28cf9
DEV: correct test to visit category channel and not DM (#30441) 2024-12-23 13:36:02 +01:00
Joffrey JAFFEUX
cf26d3f211
DEV: uses capybara helper has_field (#30438)
Checking for value of input directly is not waiting for value to be present.
2024-12-23 13:25:17 +01:00
Joffrey JAFFEUX
c601b4112e
DEV: no services are used in this component (#30439) 2024-12-23 12:47:53 +01:00
Jarek Radosz
3c95aceeb0
DEV: Unify on-resize modifier situation (#30415)
1. Move chat's on-resize to core
2. Remove ember-on-resize-modifier
2024-12-23 09:11:17 +01:00
Jarek Radosz
0336235c74
DEV: Use object spread instead of Object.assign (#30407) 2024-12-23 08:44:29 +01:00
Régis Hanol
ebb6f1c2d2
FIX: better handle race condition when a channel is deleted (#30403)
NOTE: I wasn't able to reproduce locally, so that's my best guess as to what happens based on the production error logs.
It's also the reason why I haven't changed/added any tests...

Earlier today, we started seeing a growing number of errors in the `register_presence_channel_prefix("chat-reply")` handler of the chat plugin.
It was all coming from a Discourse where they make a heavy use of chat channels. They create and **delete** category channels regularly.

If a user has a thread in one of the channels that just got deleted, the client application might not be aware (just yet), asks the server to be connected to the "presence" bus of that channel, and BOOOM.

The following [line](fa0ad0306c/plugins/chat/plugin.rb (L325)) explodes because `chat_channel` is `nil`

```ruby
config.allowed_group_ids = chat_channel.allowed_group_ids
```

And why is `chat_channel` `nil`? Because when we [do](fa0ad0306c/plugins/chat/plugin.rb (L319))

```ruby
chat_channel = Chat::Thread.find_by!(id: thread_id, channel_id: channel_id).channel
```

The thread is still in the database, but the associated channel has been deleted.

A proper fix would most likely be to delete all the `Chat::Thread` associated to a deleted `Chat::Channel` but this might have more technical & business implications.
2024-12-21 00:49:21 +01:00
Jarek Radosz
d18bf67868
DEV: Remove unnecessary optional chaining operators (#30400) 2024-12-20 16:48:13 +01:00
Discourse Translator Bot
1631c39391
Update translations (#30319) 2024-12-18 15:19:37 +01:00
David Taylor
8f6c99df8c
DEV: Run prettier correctly for bundled-plugin test directories (#30338) 2024-12-18 12:02:28 +00:00
Martin Brennan
a879bcdc35
DEV: Introduce <DPageHeader /> and <DPageSubheader /> components (#30146)
This converts the `<AdminPageHeader />` component and the
`<AdminPageSubheader />` components into new components
that can be used outside of admin, and updates the CSS classes.
Also introduces a `<DPageActionButton />` component and child
components for the header action buttons.

I have to keep the old admin-only components around for
now until plugins are updated, then we can remove it,
and remove the re-exports that are done within
admin-page-action-button.gjs
2024-12-18 08:13:39 +10:00
Isaac Janzen
af8c98217a
DEV: Remove empty beforeEach hooks (#30326) 2024-12-17 11:57:49 -06:00
Joffrey JAFFEUX
41df705188
DEV: replaces topic-notifications-options by DMenu (#30298)
This commit introduces <NotificationsTracking /> which is a wrapper component around <DMenu /> which replaces the select-kit component <TopicNotificationsButton />.

Each tracking case has its dedicated component:

- topic -> `<TopicNotificationsTracking />`
- group -> `<GroupNotificationsTracking />`
- tag -> `<TagNotificationsTracking />`
- category -> `<CategoryNotificationsTracking />`
- chat thread -> `<ThreadNotificationsTracking />`
2024-12-16 19:59:18 +01:00
Régis Hanol
062e4fb4f3
FIX: add server-side limit for DM channels (#30300)
When fetching DM channels, we would fetch all the user's DM channels,
and limit the number of DM channels we display on the client-side using
the `DIRECT_MESSAGE_CHANNELS_LIMIT`.

This is obviously not scalable as users are having more and more
discussions with other users.

This commit ensures we always limit the number of DM channels we send to the
client.

It adds the `MAX_DM_CHANNEL_RESULTS` in `ChannelFetcher` and use it to
limit the records returned by the server. This value should always be
lower than `DIRECT_MESSAGE_CHANNELS_LIMIT` on the client-side, so that
when the user has more "unread DMs" they still show up on the client as
they read them.

While adding a spec, I also updated the spec that ensures we have a
limit on public channels to use `stub_const` to temporarily lower the number
of fixtures we create during the test.
2024-12-16 18:36:29 +01:00
Régis Hanol
bdd4392c01
DEV: skip flaky chat specs (#30273)
while we figure out if we want to keep the feature or replace it with a simpler version.

Internal ref - t/144221
2024-12-13 17:37:40 +01:00
Jordan Vidrine
b191d63c1b
DEV: removes sidebar-extensions css (#30266)
This PR cleans up some unnecessary CSS which are not used anymore. Support of sidebar in chat has a long history due to the various steps leading to the sidebar as we know it today.
2024-12-13 15:36:30 +01:00
Loïc Guitaut
9e9abe0a82 DEV: Unify params access in services
Currently, there are two ways (kind of) for accessing `params` inside a
service:
- when there is no contract or it hasn’t been reached yet, `params` is
  just the hash that was provided to the service. To access a key, you
  have to use the bracket notation `params[:my_key]`.
- when there is a contract and it has been executed successfully,
  `params` now references the contract and the attributes are accessible
  using methods (`params.my_key`).

This patch unifies how `params` exposes its attributes. Now, even if
there is no contract at all in a service, `params` will expose its
attributes through methods, that way things are more consistent.

This patch also makes sure there is always a `params` object available
even when no `params` key is provided to the service (this allows a
contract to fail because its attributes are blank instead of having the
service raising an error because it doesn’t find `params` in its context).
2024-12-13 11:13:18 +01:00
Loïc Guitaut
a589b48f9a DEV: Display better output when inspecting service steps
This patch aims to improve the steps inspector output:
- The service class name is displayed at the top.
- Next to each step is displayed the time it took to run said step.
- Steps that didn’t run are hidden.
- `#inspect` automatically outputs the error when it is present.
2024-12-12 15:21:10 +01:00
moin-Jana
7c00c52c36
UX: Rename private to personal messages in the interface (#29679)
Rename "private messages" to "personal messages" in the interface
2024-12-12 11:44:19 +11:00
Krzysztof Kotlarek
8bd55c35fb
UX: Hide admin header for edit/new webhook (#30194)
In this PR, we added functionality to hide the admin header for edit/new actions - https://github.com/discourse/discourse/pull/30175

To make it work properly, we have to rename `show` to `edit` which is also a more accurate name.
2024-12-12 10:49:17 +11:00