Commit Graph

3470 Commits

Author SHA1 Message Date
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
Discourse Translator Bot
9f32bef544
Update translations (#28438) 2024-08-20 17:54:10 +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
Robert
0679e6eb7a
FIX: make poll voter list expansion persistent (#28352)
* FIX: voter list expansion

* naming improvement

* extend and refine test
2024-08-19 15:55:22 +10: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
Jarek Radosz
355dbb928a
Revert "DEV: Use on modifier (or @action param) (#28323)" (#28338)
This reverts commit e3e5710b3d.
2024-08-13 12:39:24 +02:00
Jarek Radosz
e3e5710b3d
DEV: Use on modifier (or @action param) (#28323)
instead of `onclick` prop
2024-08-13 10:50:09 +02:00
Robert
47f749744f
FIX: poll when config is on_close only show results when poll is closed (#28299)
See: https://meta.discourse.org/t/cant-edit-topic-with-poll-bug-occurs/320845?u=merefield

When the Poll is set to "results ON_CLOSE", vote numbers for each option are only streamed to the browser when the vote is Closed. It is therefore not possible to render the Results.

The current issue is that when you refresh the page, for those that have voted the default view is results. For this type of poll this should NOT happen. The Results view in this mode should not be possible to see until closure, even for the Author.

Because the votes are not yet serialised when this kind of poll remains open, an attempt to display results causes a JavaScript exception and in any case does not make logical sense.

So the fix here is making sure the default view, for Polls that have results on close, is the voting view until the Poll is Closed.

I've added a test to cover this scenario.

Additionally, this requires a refresh of the page when the poll admin actions a Close to ensure the results are serialized in.
2024-08-13 09:29:16 +02:00
Robert
60d62f1b7e
FIX: poll ranked choice voter list corrupting on expand (#28315)
Initially, the poll results display a maximum of 25 voters per option. If the number of voters exceeds this limit, a button allows users to load additional pages of voters.

When this button is clicked, a method is called to retrieve the additional voter information. However, there was a bug where the local tracked object was not properly updated for ranked choice voters. This is due to the existence of two attributes per option: one indicating whether new data is currently loading, and the other containing the list of voters.

Instead of updating the entire option key with the voters list, the fix requires updating the voters attribute only.

This is a small but critical change. The pull request also includes a new test that significantly increases coverage, addressing this issue and beyond.
2024-08-13 09:28:28 +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
Kris
df18bcd029
A11Y: remove redundant tabindex=0 from polls (#28320) 2024-08-12 14:42:06 -04:00
Kris
c0611a06e5
UX: remove poll button bg color to avoid highlight issue (#28319) 2024-08-12 14:39:37 -04:00
Jan Cernik
043fc0a117
UX: Small topic map improvements and fixes (#28215) 2024-08-12 15:37:05 -03:00
Gabriel Grubba
157c8e660a
FEATURE: Change tags sent in topic_tags_changed trigger in automation plugin (#28318)
* FEATURE: Change tags sent in topic_tags_changed trigger in discourse_automation

Before, it was sending the old tags and the current tags in topic.
Now, it sends the removed tags and the added tags in the topic.

* DEV: update `missing_tags` to be `removed_tags`

* DEV: add spacing for better readability
2024-08-12 14:05:16 -03: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
Penar Musaraj
0d289a5690
UX: Do not delete narrative bot PM when skipping user tips (#28265)
Should fix https://meta.discourse.org/t/skip-tips-option-in-user-tip-should-not-delete-welcome-message/303420

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-08-08 12:12:01 -04: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
锦心
c8c859762b
FEATURE: Absolute Numbers in Poll (#28240)
What does this add?
===================

This PR adds an extra button to the poll to show the absolute number of
people who voted for each option. This button will only be added for
the single/multi-select bar chart.

Related meta topic: https://meta.discourse.org/t/absolute-numbers-in-polls/32771
2024-08-07 11:46:29 +02:00
Kris
76b28ed836
UX: fix user profile button wrap, clean up styles (#28255) 2024-08-06 17:47:51 -04:00
Robert
e145735c1d
DEV: poll flakey spec 2024-08-06 08:39:03 +02:00
Joffrey JAFFEUX
a333d71d4c
FIX: ensures tags/categories are present (#28230)
Prior to this fix the query in stalled_topic_finder would assume that tags/categories would be nil or an array of ids. However it can be an empty array, in this case the query will not return results.
2024-08-05 22:26:12 +02:00
Krzysztof Kotlarek
300ef67481
UX: move admin flag form to form-kit (#28187)
Rewrite the admin flag form to use FormKit. This is a draft because waiting for Checkbox improvements.
2024-08-05 11:01:25 +10: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
ec46487870
FEATURE: Added trigger for topic tags changed (#28176)
* FEATURE: Added trigger for topic tags changed

* DEV: register new file in plugin.rb

* DEV: update to use already existing `:topic_tags_changed` event

* DEV: Add tests to topic_tags_changed trigger

remove `watching_user` field

* DEV: add more tests to topic_tags_changed_spec.rb

* DEV: update tests and implementation for topic tags changed automation trigger

* DEV: update checking for tags changed automation

* DEV: Update argument application for `handle_topic_tags_changed`
2024-08-02 09:58:51 -03:00