Commit Graph

3776 Commits

Author SHA1 Message Date
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
Gabriel Grubba
0d62863951
FEATURE: Add trigger_on option to topic_tags_changed automation (#30391)
* FEATURE: default value to fields in automation

This PR adds the property `extra.default_value` to the fields in automation. This property is used to set the default value of the field.

Reducing the nil checks we have to do in automation fields.

I've added only testing in the `da-choices-field-test.js` file, but we could add tests to all the fields.

* FEATURE: Add trigger_on option to `topic_tags_changed` automation

This new field will allow users to specify when the trigger should be fired. The options are:
- `tags_added_or_removed`: The trigger will be fired when tags are added or removed from the topic.
- `tags_added`: The trigger will be fired when tags are added to the topic.
- `tags_removed`: The trigger will be fired when tags are removed from the topic.

This PR also brings a migration to set the `trigger_on` field to `tags_added_or_removed` for all existing `topic_tags_changed` automations.

* DEV: reorganize the specs in context blocks

* DEV: migration to add trigger_on field default value to topic_tags_changed_trigger

* DEV: `down` migration for `add_trigger_on_field_default_value_to_topic_tags_changed_trigger` migration

* Update plugins/automation/lib/discourse_automation/triggers/topic_tags_changed.rb

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

* Update plugins/automation/config/locales/client.en.yml

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

* DEV: lint files and update topic_tags_changed trigger to use `default_value`

* Revert "FEATURE: default value to fields in automation"

This reverts commit 4d32635c69.

* DEV: remove migration file

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-01-06 11:22:39 -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
Jan Cernik
bba4c9b005
FIX: Fallback when embedding YouTube videos with lazy videos (#30514) 2025-01-03 08:55:40 -03: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
80cda1212e
DEV: do not check for loading state (#30530)
This shouldn't be necessary and is already causing flakyness today.
2025-01-02 11:08:23 +01:00
Martin Brennan
5711bf6f27
DEV: Move admin config pages out of /customize/ sub-route (#30511)
The customize routes add CSS classes that make these admin
config pages look different from the ones under /admin/config.
We want all config routes to be under /admin/config as well.

This commit moves the emoji, user fields, and permalinks pages
out of customize and into config, updating all references and
adding more rails routes as needed.

Also renames admin emojis route to emoji, emoji is singular and plural.
2025-01-02 09:13:11 +10: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
David Taylor
d2979997e9
DEV: Introduce new 'glimmer topic list mode' site setting (#30375)
This replaces the previous group-based site setting
2024-12-19 17:38:35 +00:00
Keegan George
d886c55f63
DEV: Reusable post-list component (#30312)
This update adds a  _new_ `<PostList />` component, along with it's child components (`<PostListItem/>` and `<PostListItemDetails />`). This new generic component can be used to show a list of posts.

It can be used like so:
```js
/**
 * A component that renders a list of posts
 *
 * @component PostList
 *
 * @args {Array<Object>} posts - The array of post objects to display
 * @args {Function} fetchMorePosts - A function that fetches more posts. Must return a Promise that resolves to an array of new posts.
 * @args {String} emptyText (optional) - Custom text to display when there are no posts
 * @args {String|Array} additionalItemClasses (optional) - Additional classes to add to each post list item
 * @args {String} titleAriaLabel (optional) - Custom Aria label for the post title
 * 
*/
```
```hbs
<PostList
    @posts={{this.posts}}
    @fetchMorePosts={{this.loadMorePosts}}
    @emptyText={{i18n "custom_identifier.empty"}}
    @additionalItemClasses="custom-class"
 />
```
2024-12-19 09:20:25 -08:00
Ella E.
ddca2ca629
UX: Apply admin table to Automation settings page (#30341)
* UX: Apply admin table classes for consistent mobile styling on the automation page

* UX: Remove icon beside the automation page title

* DEV: Add status label to translations

* UX: Reorder the status and name when on mobile

* DEV: Add comment explaining tablet-specific status reorder

* DEV: Apply prettier
2024-12-19 05:07:14 -07:00
Régis Hanol
770a478fcc
UX: fix border around reply indicator (#30343)
On a narrow viewport on desktop, the margins above and below the "replying..." indicator were missing.

Internal - t/144612
2024-12-18 12:34:39 -05: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
Ted Johansson
c1c7ea8959
DEV: Change hide_email_address_taken default to true (#30293)
We're changing the default of hide_email_address_taken to true. This is a trade-off we want to make, as it prevents account enumeration with minimal impact on legitimate users. If you forget you have an account and try to sign up again with the same e-mail you'll receive an e-mail letting you know.
2024-12-17 10:46:04 +08: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
Natalie Tay
537f09912e
DEV: Memoize group find when adding users to groups (#30296) 2024-12-16 17:47:24 +08: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
Natalie Tay
622eb9e51c
FIX: Avoid zipping when adding users to groups (#30263) 2024-12-13 17:24:40 +08: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
Gerhard Schlager
c357e621ef
FIX: Link to group didn't work in locales other than English (#30237)
Group names are translated, so the slug changes depending on the default locale. This could break the link to the staff group.
2024-12-12 13:26:51 +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
Sérgio Saquetim
1505978586
DEV: Upgrade dependencies to Ember 5.12 (#30131) 2024-12-11 11:09:25 -03:00
Régis Hanol
6ef0b5d508
Cleanup mobile topic footer area (#30132) 2024-12-11 14:59:37 +01:00
Discourse Translator Bot
c65192a7a2
Update translations (#30202) 2024-12-10 20:16:34 +01:00
Régis Hanol
35656a1d5f
DEV: attempt to fix some system spec flakes (#30182)
Since 3e7f0867ea, I started seeing some specs fail due to the following error

```plain
Error occurred while rendering: top-level application > discourse-root > topic > discourse-topic > topic-navigation > plugin-outlet > plugin-connector > topic-presence-display

/assets/plugins/discourse-presence.js - Uncaught TypeError: Cannot destructure property 'whisperer' of 'this.currentUser' as it is null.
```

For some reasons I can't fanthom, the presence components seem to be rendered even though they're using outlets that are only rendered when a user is signed in... 🤷‍♂️

Lost too much time trying to reproduce so I ended up adding this `if (!this.currentUser) { return; }` condition to both "presence display" component to (hopefully) fix these flakes.
2024-12-09 18:01:22 +01:00