Commit Graph

3505 Commits

Author SHA1 Message Date
David Taylor
7d8974d02f
UX: Upgrade to fontawesome 6.6.0 (#28778)
This upgrade is designed to be fully backwards-compatible. Any icon names which have changed will be automatically remapped to the new name. For now, this will happen silently. In future, once core & official themes/plugins have been updated, we will start raising deprecation errors to help theme/plugin authors update their code.

Extracted from https://github.com/discourse/discourse/pull/28715

Announcement at https://meta.discourse.org/t/were-upgrading-our-icons-to-font-awesome-6/325349

Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2024-09-09 14:40:56 +01:00
Kris
deb751dfe3
UX: remove btn-default class from chat thread tracking dropdown (#28789) 2024-09-06 15:14:29 -05:00
David Taylor
348abeecb1
DEV: Use icon-rendering API for local-dates (#28788)
This makes local-dates compatible with the fa6 upgrade in https://github.com/discourse/discourse/pull/28778
2024-09-06 20:51:57 +01:00
Joffrey JAFFEUX
ad7d5426d8
FIX: supports groups field in post_created_edited (#28783)
⚠️ This commit is a revert of a revert due to a migration which was causing `{}` metadata to be transformed into `{"value": [null]}`. The new migration shouldn't cause this and will also clean the existing errors, there shouldn't  be any data loss given the affected fields where not containing actual data. We might want to stop storing these empty fields in the future.

To achieve it, this commit does the following:
- create a new `groups field`, ideally we would have reused the existing group field, but many automations now have the expectation that this field will return a group id and not an array of group ids, which makes it a dangerous change
- alter the code in `post_created_edited` to use this new groups field and change the logic to use an array
- migrate the existing group fields post_created_edited automations to change name from `restricted_group` to `restricted_groups`, the component from `group` to `groups` and the metadata from `{"value": integer}` to `{"value": [integer]}`

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2024-09-06 17:22:42 +02:00
David Battersby
2a5e1aa8e6
FEATURE: only play chat sound when chat badge icon is shown (#28387)
Every time a desktop chat sound plays, there should be some visual cue as to why the sound was played in the first place.

This change follows the chat indicator preference:

- All New Messages - a blue dot is shown for all messages, so we attempt to play a sound every time
- Direct Messages, Mentions and Watched Threads - a green dot is shown for all urgent messages, so we attempt to play a sound for urgent chat notifications
- Only Mentions - only play chat sounds when user is mentioned
- Never - we never play chat sounds, as user wouldn’t know why the sound was played
2024-09-06 18:25:25 +04:00
Gabriel Grubba
a98d3d40f2
FEATURE: Add user to topic_tags_changed event (#28714)
* FEATURE: Add user to topic_tags_changed event

Add user to topic_tags_changed event context
Update automation plugin with new arguments in event
Update tests for new arguments

relates to https://github.com/discourse/discourse-chat-integration/pull/214

* DEV: change variable name for better readability

changed `tags` to be payload and used `values_at` to get the values of the keys
2024-09-06 11:23:30 -03:00
Joffrey JAFFEUX
5f5680dbaf
Revert "FIX: supports groups field in post_created_edited (#28773)" (#28781)
This reverts commit eb3a1c7217.
2024-09-06 16:10:53 +02:00
Joffrey JAFFEUX
eb3a1c7217
FIX: supports groups field in post_created_edited (#28773)
To achieve this this commit does the following:
- create a new `groups field, ideally we would have reused the existing group field, but many automations now have the expectation that this field will return a group id and not an array of group ids, which makes it a dangerous change
- alter the code in `post_created_edited` to use this new groups field and change the logic to use an array
- migrate the existing group fields post_created_edited automations to change name from `restricted_group` to `restricted_groups`, the component from `group` to `groups` and the metadata from `{"value": integer}` to `{"value": [integer]}`
2024-09-06 15:04:19 +02:00
David Battersby
a193bf4360
UX: update chat channel sorting (#28760)
Reverts chat channel sorting changes made in #28731 due to desktop sidebar.
2024-09-05 20:58:15 +04:00
Joffrey JAFFEUX
9b630c8cca
DEV: adds post_created_edited suport to chat (#28757) 2024-09-05 17:17:18 +02:00
David Battersby
b7cfd4e146
FIX: toggle chat drawer on channel thread list (#28759)
Chat toggle relies on using a height: auto to collapse drawer, however in channel threads we should be only displaying threads when drawer is expanded. Displaying threads conditionally based on drawer toggle status fixes this.
2024-09-05 19:01:12 +04:00
David Battersby
d5670069f5
UX: fix spacing of emoji in chat channel title (#28756)
Fixes a small spacing bug with emoji in channel titles
2024-09-05 16:43:06 +04:00
Joffrey JAFFEUX
81c5f1d75f
DEV: send_chat_message supports topic_tags_changed (#28755)
This will allow admins to use this script and trigger together.
2024-09-05 13:05:19 +02:00
David Battersby
e991574389
UX: chat drawer increase unread channel visibility (#28731)
This change increases the visibility of unread channels to make them stand out more in drawer mode (desktop).

When a channel is unread:

- it floats to the top;
- when multiple channels are unread, they are sorted alphabetically (equal to how it’s done on mobile)
- the unread indicator blue dot moves to directly right of the channel name
2024-09-05 13:36:50 +04:00
Joffrey JAFFEUX
67ce50c141
FIX: creating an automation without script should error (#28752)
This commit ensure we are properly showing an error to the end user and not just a vague 500.
2024-09-05 11:18:38 +02:00
Joffrey JAFFEUX
1a96269be0
DEV: adds topic_url/topic_title placeholders (#28754)
`topic_tags_changed` trigger now fills the {{topic_url}} and {{topic_title}} placeholders. `topic_url` is the relative URL.
2024-09-05 11:18:26 +02:00
Joffrey JAFFEUX
dc1afeac89
FIX: ensures message field is rendering placeholders (#28753)
A previous commit had broken this codepath, this commit ensures it's fixed and is adding a test. It's not testing the copy/paste behavior as fairly complex to test.
2024-09-05 11:18:21 +02:00
Loïc Guitaut
e94707acdf DEV: Drop WithServiceHelper
This patch removes the `with_service` helper from the code base.
Instead, we can pass a block with actions directly to the `.call` method
of a service.

This simplifies how to use services:
- use `.call` without a block to run the service and get its result
  object.
- use `.call` with a block of actions to run the service and execute
  arbitrary code depending on the service outcome.

It also means a service is now “self-contained” and can be used anywhere
without having to include a helper or whatever.
2024-09-05 09:58:20 +02:00
Osama Sayegh
a23773f83d
DEV: Deprecate show_in_ui argument of the register_stat API (#28727)
We need to start printing deprecation notices when the `show_in_ui` argument is used because it works only for the old about page which will be removed soon. For the new about page, we've introduced a new API `addAboutPageActivity` which is more flexible than a true/false argument on the server side.

Internal topic: t/136551.
2024-09-04 19:58:14 +03:00
David Taylor
e6edd52047
DEV: Remove widget wrapper from poll plugin (#28666)
- Uses `helper.renderGlimmer` with GJS to render the `<Poll` component without any widgets

- Moves some logic into component, so that only `@post`, `@poll` and `@titleHTML` need to be passed into the component (no more 'attrs')

- Updates `modifyClass` calls to modern syntax

- Replaces observer in `Post` model with a native setter & tracked property

- Replaced Poll EmberObject instances with TrackedObject

- Updated component tests with new arguments

- Updated some tests to qunit-dom

- Fixed up core `repliesBelow` and `repliesAbove` logic to create post models properly. Previously it was passing 'transformed' versions of posts into the model, which doesn't make sense.
2024-09-04 09:38:22 +01:00
David Battersby
a2f625a0ef
DEV: remove CSS for consolidated DM notifications (#28728)
Removes unused CSS that was a temporary fix for a new notification type that was later reverted.
2024-09-04 11:39:49 +04:00
David Battersby
fdcf4698fc
UX: Update Chat Group Name and Placeholder (#28703)
* UX: Update Chat Group Name and Placeholder

* update tests

* fix failing tests

* better checking of system user when setting dm title
2024-09-04 15:52:23 +10:00
Osama Sayegh
280adda09c
FEATURE: Support designating multiple groups as mods on category (#28655)
Currently, categories support designating only 1 group as a moderation group on the category. This commit removes the one group limitation and makes it possible to designate multiple groups as mods on a category.

Internal topic: t/124648.
2024-09-04 04:38:46 +03:00
Discourse Translator Bot
0171eb0c94
Update translations (#28705) 2024-09-03 11:46:50 -04:00
Krzysztof Kotlarek
7577231ba2
DEV: the ability to define setting areas (#28570)
A new setting attribute is used to define the areas (separated by `|`).

In addition, endpoint `/admin/config/site_settings.json` accepts new `filter_area` data.
2024-09-03 09:25:45 +10:00
Joffrey JAFFEUX
0a1432e1cc
FIX: ensures global notices are destroyed on post created (#28684)
Prior to this fix we could exit early if tags was `[]` as `tags && (tags & post.topic.tags.map(&:name)).empty?` would have returned true. This commit ensures it's not the case anymore and adds a test for it.

Co-Authored-By: Martin Brennan <mjrbrennan@gmail.com>
2024-09-02 21:17:10 +02:00
Discourse Translator Bot
b1e539c1b9
Update translations (#28682) 2024-09-02 18:00:43 +02:00
David Battersby
997fbc9757
FEATURE: Add ability to watch chat threads (#28639)
This change introduces a new thread notification level allowing users to get notified when someone replies to the thread.

Users who watch a thread will get a green notification on the chat icon and a user notification (blue). User notifications are consolidated based on thread id to prevent cluttering the original users notification area.

---------

Co-authored-by: Régis Hanol <regis@hanol.fr>
2024-09-02 16:45:55 +04:00
David Taylor
583c932173
DEV: Refactor complex initializers into classes (#28661)
We're working to remove all decorators from object-literal-properties. This commit refactors all initializers which were using these decorators into classes, where decorators are allowed. Also adds cleanup logic to the local-dates initializer, which was previously missing.
2024-09-02 10:08:07 +01:00
Martin Brennan
361e954c55
UX: Change admin plugins list to follow UI guidelines (#28478)
This commit introduces a little bit of duplication
since the old plugin UIs not using the new plugin show
page look different from ones like AI and Gamification
which have been converted. We can use the new admin
header component on the plugins list, but for the other
pages we are manually rendering a breadcrumb trail and
the list of plugin tabs.

Over time as we convert more plugins to use the new UI
guidelines and show page we can get rid of this duplication.
2024-08-30 14:53:36 +10:00
Discourse Translator Bot
68c9553251
Update translations (#28577) 2024-08-29 15:37:52 -04:00
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
Gabriel Grubba
0c9c7482b5
FIX: change eq to match_array in topic_tags_changed_spec.rb to solve flaky test (#28640)
The following test is flakey. We don't care about the order because we check if the tags are being sent.

```
Failure/Error: measurement = Benchmark.measure { example.run }

  expected: ["tag4", "tag5"]
       got: ["tag5", "tag4"]

  (compared using ==)
  
  ```
2024-08-29 11:25:58 -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
Roman Rizzi
715f49c3fe
FEATURE: Post created/edited trigger can skip posts created via email (#28615) 2024-08-28 17:34:35 -03:00
Loïc Guitaut
d26d45540e DEV: Use run_successfully matcher in service specs 2024-08-28 16:30:09 +02:00
Robert
c95f9dbf34
FIX: poll ensure ranked choice results can handle options with rich text and links (#28195)
cf. https://meta.discourse.org/t/links-in-ranked-choice-polls-do-not-render-correctly-in-results-view/319098
2024-08-28 15:48:50 +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
Joffrey JAFFEUX
7335b44d4f
UX: explain choices priorities (#28574)
This commit will add `highest priority` to first choice and `lowest priority` to the last choice to make it more explicit to the user.
2024-08-27 13:03:48 +02:00
David Battersby
910bfaf5f5
FIX: prevent desktop notification callbacks on mobile (#28527) 2024-08-26 15:49:49 +10:00
Joffrey JAFFEUX
6bdda3cb71
FIX: prevents creating post from impacting the app (#28518)
Create a topic can fail in many different ways and we don't want this to impact the rest of the application, the call will now be wrapped in a begin/rescue block and log an error if it fails.
2024-08-23 15:17:16 +02: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
Sam
7ab7e6bb23
FEATURE: allow plugins to specify keyboard shortcuts for hidden toolbar items (#28456)
Previous to this change there is no clean way to apply keyboard shortcuts
to things such as "add poll" and other hidden options in the toolbar

This allows shortcuts to be specified similar to how they are on the toolbar



Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-08-23 09:28:28 +10: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
Sérgio Saquetim
649cbad216
DEV: Use the glimmer header in the Styleguide (#28427) 2024-08-20 19:44:26 -03:00