Commit Graph

1785 Commits

Author SHA1 Message Date
Discourse Translator Bot 2eee6fb644
Update translations (#19150) 2022-11-22 15:01:19 +01:00
Loïc Guitaut 01392ab90c FIX: Delete associated channel upon category deletion
Currently when a category is deleted, if it has an associated chat
channel, the latter won’t be deleted automatically.

The fix is quite simple as we were simply missing a `dependent:
:destroy` option on the existing relation.
2022-11-22 10:04:29 +01:00
Joffrey JAFFEUX e9863b145c
UX: ensures browse view input is focused on page load (#19137)
No test as I don't think it's worth the complexity of a test.
2022-11-22 08:57:17 +01:00
Joffrey JAFFEUX d127d2acdf
FIX: allows to change sound when no sound was ever set (#19136)
It fixes a bug which was only allowing users with a sound to change it. Users with `none` could not change it again after a full page reset.
2022-11-22 08:57:06 +01:00
Kris bc61629d0f
A11Y: improved titles for chat in the sidebar (#19134) 2022-11-22 09:24:39 +08:00
Joffrey JAFFEUX 5573257158
FIX: enable_auto_join_users was used in create channel (#19128)
7e39a21de1
broke the explanation of the check box on `create-channel` view.

Actions:
- uses core yes_value/no_value
- re-add the correct translation for `enable_auto_join_users`
- removes `disable_auto_join_users` which is not used anymore
2022-11-21 14:28:11 +01:00
Joffrey JAFFEUX 3f24a5e9e2
FIX: better chat-message-actions position (#19111)
- prevents menu to hide underlying text
- prevents `chat-message-actions` to close when hovering dropdown of 3
dots button as mouse would hover an other message due to the small space
between `chat-message-actions` menu and the dropdown of the 3 dots
button

<!-- 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. -->
2022-11-21 09:10:52 +01:00
Martin Brennan 05b740036e
FEATURE: Add TL1 to chat_allowed_groups by default (#19116)
By doing this, we will:

* Have an open, but safe default People reach `@trust_level_1` pretty
quickly, but `@trust_level_0` is still excluded by default, to limit new
accounts joining and immediately spamming or otherwise abusing channels.
* Make it easier to change the default By keeping `@staff` in the
default, we make it easy for admins to remove `@trust_level_1` and
optionally add additional groups to their liking.
2022-11-21 09:17:40 +10:00
Martin Brennan d3f02a1270
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.

**Serverside**

We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.

Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.

The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.

When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.

**Markdown**

The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.

This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.

**Chat Channels**

This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.

------

**Known Rough Edges**

- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 08:37:06 +10:00
Kris 8dff9a7fd2
UX: padding adjustment for empty channel message (#19105) 2022-11-18 14:25:22 -05:00
Joffrey JAFFEUX 26fadbdece
FIX: hides user card button when current user can't DM (#19093) 2022-11-17 23:44:05 +01:00
Loïc Guitaut 3fd0423b1b FEATURE: Stop hiding “allow archiving channels” setting 2022-11-17 11:03:42 +01:00
Discourse Translator Bot 33f601c8ad
Update translations (#19033) 2022-11-16 11:39:47 +01:00
chapoi 7e39a21de1
UX: redesign of chat settings + add chat retention info (#19017)
* UX: redesign of chat settings
2022-11-16 11:10:42 +01:00
Joffrey JAFFEUX df7730d938
UX: improves arrow support in chat emoji picker (#19038) 2022-11-16 08:52:48 +01:00
chapoi 3277a858bf
UX: add channel header offset to browse page height (#19030) 2022-11-15 11:35:40 +01:00
Joffrey JAFFEUX 59cb0b656c
FEATURE: introduces `chat_max_direct_message_users` setting (#18997)
This setting limits the number of users in a direct message. 0 means you can only create a direct message with yourself.

Co-authored-by: David McClure <dave@xerotrope.org>
2022-11-15 10:40:28 +01:00
Joffrey JAFFEUX 8f5936871c
FIX: prevents arrow keys to bubble into parents components (#19000)
ember-template-link doesn’t recommend keydown, but listening on keyup won't work to prevent the scroll of the container
2022-11-14 16:53:22 +01:00
Joffrey JAFFEUX c6949a26c5
FIX: only applies scroll position to full page (#19011)
No tests as:
- scroll position is not always supe reliable
- this should all be replaced by sidebar and is not supposed to change much
2022-11-14 13:21:27 +01:00
Krzysztof Kotlarek 3d5753c42b
FIX: Allow sidebar links to register didInsert actions (#19010)
Previously `this.chatService.appEvents.on(
"chat:user-tracking-state-changed"...)` was registered on constructor and disabled on `willDestroy`. Constructor is evaluated only once, so when the section was collapsed and collapsed then the events were not observed anymore.

didInsert allows evaluating code each time a component is rendered.
2022-11-14 10:36:46 +01:00
Joffrey JAFFEUX 895898b363
FIX: correctly opens drawer to message id when given (#18994) 2022-11-14 08:16:09 +01:00
Joffrey JAFFEUX 27c15bfd53
FIX: ensures composer is focused after edit (#18999)
- afterRender is not needed as it's already done in the `chat:focus-composer` event
- removes `focusComposer` function which is duplicating logic
2022-11-14 08:15:20 +01:00
Joffrey JAFFEUX 1a1d1424ed
FIX: only checks for full page instead of preference (#18998)
Checking for preference is unsure when in standalone chat app (eg: electron app), this is much more resilient and simple.
2022-11-14 08:15:02 +01:00
Joffrey JAFFEUX 88ede43ec5
FIX: correctly highlights active channel (#18991)
Prior to this change, only hovering the row would highlight it.
2022-11-11 22:32:06 +01:00
Joffrey JAFFEUX a578bc2f5f
FIX: adds back recurring to send_message automation (#18990)
Also uses new way to get channel title
2022-11-11 15:58:05 +01:00
Joffrey JAFFEUX c8beefc1ee
FIX: reimplements chat audio into a service (#18983)
This implementation attempts to be more resilient to background tab.

Notes:
- adds support for immediate arg in @debounce decorators
- fixes a bug in discourseDebounce which was not supporting immediate arg in tests
- chat-audio-manager has no tests as audio requires real user interaction and is hard to test reliably
2022-11-11 13:11:41 +01:00
Joffrey JAFFEUX 795687160d
UX: adds chat section in settings and hide it in plugins (#18984) 2022-11-11 12:43:20 +01:00
Joffrey JAFFEUX 66130dc8c1
REFACTOR: handles every chat resource as an URL (#18961)
- Note this is also tweaking the UI a little bit as we are now using links/buttons in the header as needed
- It disables the find ideal channel in drawer mode, if loading `/chat` in drawer mode it will either reopen at the last position or just stay on index
2022-11-11 06:39:15 +01:00
Joffrey JAFFEUX 07e1b0591f
REFACTOR: chat-msgactions (#18969)
- s/chat-msg-actions/chat-message-actions
- s/chat-msgactions-hover/chat-message-actions-container
- creates dedicated css files for this component
- removes useless code
- removes grayscale
2022-11-10 15:08:14 +01:00
Joffrey JAFFEUX c0a4823203
UX: tweaks to msg actions menu (#18966)
- allows to scroll while hovering the menu
- correctly changes message background color while hovering menu
- prevents a bug where it would sometimes close the menu while moving from menu to the 3 dots expanded dropdown. This was caused by the gap between header/body of the 3 dots dropdown, which would sometimes allow to create a mouseover event on a possible different underlying message
- removes recent/favorite reactions on drawer mode
- grayscale reactions until hover
- boxshadow on msgactions container
- removes useless code
2022-11-10 07:42:37 +01:00
Keegan George 3d376c71b6
A11Y: Improve accessibility for saved status message (#18950)
Toggling channel settings shows a status message when saved. This status message is not accessible to screen readers. This commit ensures that the status message is made accessible.
2022-11-09 10:12:35 -08:00
Roman Rizzi 698c3ced15
FIX: Deliver chat summaries when allowed groups include "everyone" (#18955)
The mailer in charge of sending chat summary emails applies a filter to ensure only members of groups listed in the `chat allowed groups` setting receive them. However, when you set it to `everyone`, nobody will be notified because
we treat this group differently and don't create `GroupUser` records for every user on the site.

This commit changes the mailer to skip the filter when the `everyone` ID is in the list.
2022-11-09 10:54:47 -03:00
Martin Brennan de2382a652
DEV: Fix broken slug migration (#18951)
Follow up c6764d8c74
2022-11-09 11:08:02 +10:00
Martin Brennan c6764d8c74
FIX: Automatically generate category channel slugs (#18879)
This commit automatically ensures that category channels
have slugs when they are created or updated based on the
channel name, category name, or existing slug. The behaviour
has been copied from the Category model.

We also include a backfill here with a simplified version
of Slug.for with deduplication to fill the slugs for already
created Category chat channels.

The channel slug is also now used for chat notifications,
and for the UI and navigation for chat. `slugifyChannel`
is still used, but now does the following fallback:

* Uses channel.slug if it is present
* Uses channel.escapedTitle if it is present
* Uses channel.title if it is present

In future we may want to remove this altogether
and always rely on the slug being present, but this
is currently not possible because we are not generating
slugs for DM channels at this point.
2022-11-09 10:28:31 +10:00
Joffrey JAFFEUX 4e6909cc5a
FIX: uses i18n for saved text (#18949) 2022-11-09 00:15:57 +01:00
Discourse Translator Bot d7844a797f
Update translations (#18948) 2022-11-09 00:00:28 +01:00
Joffrey JAFFEUX 074aa5eb5e
FIX: handles starting draft dm from sidebar (#18946) 2022-11-08 23:58:11 +01:00
Roman Rizzi 74a9859a12
FIX: Migrate values before adding a not null constraint. (#18940)
Since the migration was added as a post migration, we'll try to add the constraint first, causing a NotNullViolation exception.

This only affects sites that were last deployed more than two days ago.
2022-11-08 16:11:03 -03:00
Joffrey JAFFEUX 21570410ab
FIX: makes sidebar links respect drawer mode (#18918)
Clicking a link of the sidebar will now open the drawer and load the correct channel.

This solution should correctly solve these cases:

closing drawer, clicking sidebar channel, should open the drawer on correct channel
visiting /chat then visiting / and clicking sidebar channel, should open full page chat on correct channel
2022-11-08 16:23:13 +01:00
Loïc Guitaut 9c482a645c FIX: Allow deletion of categories when chat channel is not present
Currently it’s not possible to delete a category if an associated chat
channel is present even if there are no messages in this channel.
This can lead to annoying situations for our users.

This patch addresses the issue by checking if the channel is empty
instead of just checking if there is a channel.
2022-11-08 10:25:39 +01:00
Martin Brennan ac7bf98ad1
DEV: Load client site settings YML into JS tests (#18413)
Our method of loading a subset of client settings into tests via
tests/helpers/site-settings.js can be improved upon. Currently we have a
hardcoded subset of the client settings, which may get out of date and not have
the correct defaults. As well as this plugins do not get their settings into the
tests, so whenever you need a setting from a plugin, even if it has a default,
you have to do needs.setting({ ... }) which is inconvenient.

This commit introduces an ember CLI build step to take the site_settings.yml and
all the plugin settings.yml files, pull out the client settings, and dump them
into a variable in a single JS file we can load in our tests, so we have the
correct selection of settings and default values in our JS tests. It also fixes
many, many tests that were operating under incorrect assumptions or old
settings.

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2022-11-08 09:17:43 +10:00
Martin Brennan 4116094e54
FIX: Make chat editor IDs not null (#18903)
Follow up to 766bcbc684

Makes ChatMessage.last_editor_id and ChatMessageRevision.user_id
NOT NULL since they are always filled in now and the last commit
had a migration to backfill this data.
2022-11-08 09:06:13 +10:00
Martin Brennan c66743ee3d
FIX: Make ChatMessageUpdater check editing access for guardian (#18902)
Follow up to 766bcbc684

This fixes a gaffe from that commit where I passed in the
guardian to ChatMessageUpdater but then forgot to remove
the old way of setting the guardian and user instance variables
from the chat_message that was passed in.

Also, it moves the ensure_can_edit_message! check from the
controller into ChatMessageUpdater so all the access
checks are in the same place.
2022-11-08 09:04:18 +10:00
Joffrey JAFFEUX 0a02a5d05a
FIX: follow up to #7fca078 (#18915)
- prevents triggering chat:open-channel two times
- builds a correct URL for home page
2022-11-07 19:31:08 +01:00
Joffrey JAFFEUX e0edfa9345
FIX: retention reminder is absolute and needs relative parent (#18913) 2022-11-07 19:10:09 +01:00
Rafael dos Santos Silva 3174e8e60f
DEV: DiscourseEvents for chat messages (#18914) 2022-11-07 19:06:10 +01:00
Joffrey JAFFEUX 7fca07821b
FIX: simplfies previous route handling (#18895)
This commits makes sure we correctly wait for the end of the transition to reopen the drawer on the correct channel/view. Also fixes a bug when previous URL was `/` and causing a double transition.
2022-11-07 14:48:18 +01:00
chapoi 091d83af60
UX: Chat index tweaks (#18905)
- rounded avatar
- cut off avatar
- no index background
2022-11-07 12:26:46 +01:00
maiki 4e4302c608
UX: Fix spelling and capitalization (#18886)
@discourse-translator-bot keep_translations_and_approvals
2022-11-07 10:40:34 +01:00
Joffrey JAFFEUX a51e5e1987
DEV: separates preferred-chat-mode service (#18883)
Also adds end to end system tests to ensure navigation scenarios are working correctly. This separation will make it easier to implement state in/out from chat.
2022-11-07 09:04:43 +01:00
Martin Brennan 766bcbc684
FIX: Add editing user ids to ChatMessage and ChatMessageRevision (#18877)
This commit adds last_editor_id to ChatMessage for parity with Post in
core, as well as adding user_id to the ChatMessageRevision record since
we need to know who is making edits and revisions to messages, in case
in future we want to allow more than just the current user to edit chat
messages. The backfill for data here simply uses the record's creating
user ID, but in future if we allow other people to edit the messages it
will use their ID.
2022-11-07 09:04:47 +10:00
Joffrey JAFFEUX 11f3618b80
DEV: initial system tests for chat and plugins (#18881)
This is a very basic to ensure it's working and open future possible work
2022-11-04 15:06:24 +01:00
Joffrey JAFFEUX 49a0129b0d
FIX: prevents chat to enter in endless loop when getting 404 (#18867)
Doing DOM operations in finally would cause them to happen even when the request was a failure. Consequence of these DOM operations would be new request, which would also end up in a 404, and so on.

This commit simply moves the DOM operations in the then block where it should be safe to make.
2022-11-03 19:52:44 +01:00
chapoi c122c032bb
Ux sidebar muted icon (#18856)
* UX: sidebar muted channel opacity and colour change

* UX: visual state for active on muted channel
2022-11-03 16:00:21 +01:00
Loïc Guitaut abcaa1a961 DEV: Rename direct message related models
This is a followup of the previous refactor where we created two new
models to handle all the dedicated logic that was present in the
`ChatChannel` model.

For the sake of consistency, `DMChannel` has been renamed to
`DirectMessageChannel` and the previous `DirectMessageChannel` model is
now named `DirectMessage`. This should help reasoning about direct
messages.
2022-11-03 14:39:23 +01:00
chapoi 2f510cbd05
FIX: Do not limit scope to direct messages (#18855) 2022-11-03 09:17:23 +01:00
Keegan George 0028149ed4
UX: Add back button in chat browse screen on mobile (#18849) 2022-11-03 09:06:30 +01:00
Joffrey JAFFEUX 9ff091dc01
FIX: the notification data on the client expects an identifier (#18850) 2022-11-03 09:06:05 +01:00
chapoi 1c52e11d48
UX: scope chat-channel-title hover effect (#18854) 2022-11-03 09:04:57 +01:00
Alan Guo Xiang Tan d446ad3290
UX: Muted style for entire chat section link when muted (#18852) 2022-11-03 08:37:39 +09:00
Keegan George 2e984f2eca
UX: Increase padding of back button in chat draft screen (#18848)
To increase hit target size for easier press on mobile devices
2022-11-02 21:28:41 +01:00
Discourse Translator Bot 82425b23ee
Update translations (#18813) 2022-11-02 15:13:47 +01:00
Roman Rizzi 0a5f548635
DEV: Move `discourse-chat` to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
2022-11-02 10:41:30 -03:00
Daniel Waterworth 167181f4b7
DEV: Quote values when constructing SQL (#18827)
All of these cases should already be safe, but still good to quote for
"defense in depth".
2022-11-01 14:05:13 -05:00
Discourse Translator Bot 5f02f11acc
Update translations (#18740) 2022-10-25 17:00:49 +02:00
Penar Musaraj 595fc3ef22
A11Y: add keyboard support to youtube embeds (#18710) 2022-10-21 16:32:53 -04:00
Jarek Radosz 8304f40f84
FIX: Correctly debounce various functions (#18673)
Debouncing inline anonymous functions does not work.

This fixes all instances of that error by extracting the function or using the new `@debounce(delay)` decorator
2022-10-20 13:28:09 +02:00
David Taylor 9a4072fe31
DEV: Load plugin CSS in tests (#18668) 2022-10-19 18:10:06 +01:00
Discourse Translator Bot 0af2837b73
Update translations (#18642) 2022-10-19 15:19:28 +02:00
David Taylor f5419521f0
DEV: Support colocation of component templates in plugins (#18598)
This allows plugins to colocate component JS and HBS under `/plugins/{name}/assets/javascripts/discourse/components`.

`discourse-presence` is updated to use this new pattern, which also serves as an integration test for this part of the build pipeline.
2022-10-17 09:38:20 +01:00
Jarek Radosz a5156d18ff
DEV: Modernize controller unit tests (#17412)
Aligns controller tests with the Ember standard, by using `module` and `setupTest` instead of our custom `discourseModule`)
2022-10-14 13:15:58 +02:00
Jarek Radosz 4170b9bb58
DEV: Use more css vars (#18561)
Followup to #18518

This time it's mostly line-height vars and a couple of other uncommon vars.
2022-10-12 16:05:42 +02:00
Jarek Radosz ea326906e3
DEV: Use css var font sizes (#18518)
For consistency and and the ability to change all font sizes at once in the dev tools
2022-10-12 15:31:59 +02:00
Natalie Tay 1631394826
FEATURE: Show relative time when date is omitted (#18547) 2022-10-12 11:23:34 +08:00
David Taylor a0eb8092f0
FIX: Ensure local date format shortcuts work correctly (#18541)
Followup to 03b7b7d1bc
2022-10-11 11:25:32 +01:00
David Taylor a10a81244c
FIX: Ensure poll type toggle buttons function correctly (#18540)
Followup to 03b7b7d1bc
2022-10-11 11:20:18 +01:00
Natalie Tay e391f71c04
FIX: Determining local date same range is erroring when there is no date (#18509) 2022-10-07 21:07:27 +08:00
Natalie Tay 7d8cda9858
FEATURE: Omit showing day when 'to' day is same as 'from' day (#18500)
Essentially,

Saturday at 2:50 PM -> Saturday at 4:38 PM becomes
Saturday at 2:50 PM -> 4:38 PM (Singapore)

Also, the displayed dates are shortened when the standalone date
is within two days. So despite the 'from' and 'to' date being the
same day, it may show 'Saturday' for 'from', and the specific date
for the 'to'. This corrects the behaviour.

(so if the current date and time is Thursday 5PM, the 'from' date
below is within 2 days, but the 'to' date is not)
Saturday at 2:50 PM -> 8 October 2022 at 9:38 PM becomes
Saturday at 2:50 PM -> 9:38 PM
2022-10-07 09:39:41 +08:00
Dan Gebhardt 03b7b7d1bc
DEV: Remove usage of {{action}} modifiers - Take 2 (#18476)
This PR enables the [`no-action-modifiers`](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-action-modifiers.md) template lint rule and removes all usages of the `{{action}}` modifier in core.

In general, instances of `{{action "x"}}` have been replaced with `{{on "click" (action "x")}}`. 

In many cases, such as for `a` elements, we also need to prevent default event handling to avoid unwanted side effects. While the `{{action}}` modifier internally calls `event.preventDefault()`, we need to handle these cases more explicitly. For this purpose, this PR also adds the [ember-event-helpers](https://github.com/buschtoens/ember-event-helpers) dependency so we can use the `prevent-default` handler. For instance:

```
<a href {{on "click" (prevent-default (action "x"))}}>Do X</a>
```

Note that `action` has not in general been refactored away as a helper yet. In general, all event handlers should be methods on the corresponding component and referenced directly (e.g. `{{on "click" this.doSomething}}`). However, the `action` helper is used extensively throughout the codebase and often references methods in the `actions` hash on controllers or routes. Thus this refactor will also be extensive and probably deserves a separate PR.

Note: This work was done to complement #17767 by minimizing the potential impact of the `action` modifier override, which uses private API and arguably should be replaced with an AST transform.

This is a followup to #18333, which had to be reverted because it did not account for the default treatment of modifier keys by the {{action}} modifier.

Commits:
* Enable `no-action-modifiers` template lint rule
* Replace {{action "x"}} with {{on "click" (action "x")}}
* Remove unnecessary action helper usage
* Remove ctl+click tests for user-menu
   These tests now break in Chrome when used with addEventListener. As per the comment, they can probably be safely removed.
* Prevent default event handlers to avoid unwanted side effects
   Uses `event.preventDefault()` in event handlers to prevent default event handling. This had been done automatically by the `action` modifier, but is not always desirable or necessary.
* Restore UserCardContents#showUser action to avoid regression
   By keeping the `showUser` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showUser` argument that's been passed.
* Revert EditCategoryTab#selectTab -> EditCategoryTab#select
   Avoid potential breaking change in themes / plugins
* Restore GroupCardContents#showGroup action to avoid regression
   By keeping the `showGroup` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showGroup` argument that's been passed.
* Restore SecondFactorAddTotp#showSecondFactorKey action to avoid regression
   By keeping the `showSecondFactorKey` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showSecondFactorKey` property that's maintained on the controller.
* Refactor away from `actions` hash in ChooseMessage component
* Modernize EmojiPicker#onCategorySelection usage
* Modernize SearchResultEntry#logClick usage
* Modernize Discovery::Categories#showInserted usage
* Modernize Preferences::Account#resendConfirmationEmail usage
* Modernize MultiSelect::SelectedCategory#onSelectedNameClick usage
* Favor fn over action in SelectedChoice component
* Modernize WizardStep event handlers
* Favor fn over action usage in buttons
* Restore Login#forgotPassword action to avoid possible regression
* Introduce modKeysPressed utility
   Returns an array of modifier keys that are pressed during a given `MouseEvent` or `KeyboardEvent`.
* Don't interfere with click events on links with `href` values when modifier keys are pressed
2022-10-05 13:08:54 +01:00
David Taylor 585c584fdb
Revert "DEV: Remove usage of `{{action}}` modifiers (#18333)" (#18469)
This reverts commit ba27ee1637.

We found some issues with handling of cmd/ctrl/shift + click on `<a` elements
2022-10-04 12:27:26 +01:00
Dan Gebhardt ba27ee1637
DEV: Remove usage of `{{action}}` modifiers (#18333)
This PR enables the [`no-action-modifiers`](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-action-modifiers.md) template lint rule and removes all usages of the `{{action}}` modifier in core.

In general, instances of `{{action "x"}}` have been replaced with `{{on "click" (action "x")}}`. 

In many cases, such as for `a` elements, we also need to prevent default event handling to avoid unwanted side effects. While the `{{action}}` modifier internally calls `event.preventDefault()`, we need to handle these cases more explicitly. For this purpose, this PR also adds the [ember-event-helpers](https://github.com/buschtoens/ember-event-helpers) dependency so we can use the `prevent-default` handler. For instance:

```
<a href {{on "click" (prevent-default (action "x"))}}>Do X</a>
```

Note that `action` has not in general been refactored away as a helper yet. In general, all event handlers should be methods on the corresponding component and referenced directly (e.g. `{{on "click" this.doSomething}}`). However, the `action` helper is used extensively throughout the codebase and often references methods in the `actions` hash on controllers or routes. Thus this refactor will also be extensive and probably deserves a separate PR.

Note: This work was done to complement #17767 by minimizing the potential impact of the `action` modifier override, which uses private API and arguably should be replaced with an AST transform.

Commits:
* Enable `no-action-modifiers` template lint rule
* Replace {{action "x"}} with {{on "click" (action "x")}}
* Remove unnecessary action helper usage
* Remove ctl+click tests for user-menu
   These tests now break in Chrome when used with addEventListener. As per the comment, they can probably be safely removed.
* Prevent default event handlers to avoid unwanted side effects
   Uses `event.preventDefault()` in event handlers to prevent default event handling. This had been done automatically by the `action` modifier, but is not always desirable or necessary.
* Restore UserCardContents#showUser action to avoid regression
   By keeping the `showUser` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showUser` argument that's been passed.
* Revert EditCategoryTab#selectTab -> EditCategoryTab#select
   Avoid potential breaking change in themes / plugins
* Restore GroupCardContents#showGroup action to avoid regression
   By keeping the `showGroup` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showGroup` argument that's been passed.
* Restore SecondFactorAddTotp#showSecondFactorKey action to avoid regression
   By keeping the `showSecondFactorKey` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showSecondFactorKey` property that's maintained on the controller.
* Refactor away from `actions` hash in ChooseMessage component
* Modernize EmojiPicker#onCategorySelection usage
* Modernize SearchResultEntry#logClick usage
* Modernize Discovery::Categories#showInserted usage
* Modernize Preferences::Account#resendConfirmationEmail usage
* Modernize MultiSelect::SelectedCategory#onSelectedNameClick usage
* Favor fn over action in SelectedChoice component
* Modernize WizardStep event handlers
* Favor fn over action usage in buttons
* Restore Login#forgotPassword action to avoid possible regression
2022-10-04 10:42:46 +02:00
Penar Musaraj cc4af80c7d
DEV: refactor bootbox alerts (#18292) 2022-09-27 14:47:13 -04:00
Discourse Translator Bot 5dea425ee9
Update translations (#18381) 2022-09-27 19:07:56 +02:00
Penar Musaraj 86ecb6c58b
DEV: update yes/no confirmation dialogs (#18181) 2022-09-14 11:06:56 -04:00
Discourse Translator Bot d00cd3295e
Update translations (#18183) 2022-09-13 16:04:18 +02:00
Jarek Radosz fa58eea64e
DEV: Minor code cleanup (#18225)
Various small changes made while debugging MessageBus-related tests.
2022-09-12 14:05:21 +02:00
Discourse Translator Bot 1ed4442c10
Update translations (#18134) 2022-08-30 20:17:57 +02:00
Discourse Translator Bot d7ce2d40dd
Update translations (#18053) 2022-08-23 17:24:36 +02:00
Mayfield 542cd1ff90
FIX: allow extra whitespace when asking discobot to perform a bot command (#17738) 2022-08-18 13:32:30 -04:00
Penar Musaraj b930f4886a
UX: Add flat text button styles and use in date/time cancel modal (#17892)
Also fixes an A11Y issue with the date/time cancel button.
2022-08-15 15:06:03 -04:00
Penar Musaraj 0d6fd1a606
A11Y: Add clearer focus states for date picker elements (#17890)
Affects date dropdowns, prev/next month arrows and day grid.
2022-08-15 14:50:07 -04:00
David Taylor 6cac35ca29 DEV: Update JS class sorting to match new lint rule 2022-08-15 09:28:31 +01:00
David Taylor 3c81683955 DEV: Rename `UriHelper.escape_uri` to `.normalized_encode`
This is a much better description of its function. It performs idempotent normalization of a URL. If consumers truly need to `encode` a URL (including double-encoding of existing encoded entities), they can use the existing `.encode` method.
2022-08-09 11:55:25 +01:00
Loïc Guitaut 3eaac56797 DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
Discourse Translator Bot f06e586c19
Update translations (#17756) 2022-08-02 16:54:12 +02:00
Penar Musaraj a799268b66
FIX: Bugs with year selector and erase button (#17749) 2022-08-02 09:58:38 -04:00
Alan Guo Xiang Tan 0d5bded434
DEV: `message-bus:main` -> `service:message-bus` (#17748)
The former has been deprecated
2022-08-02 13:25:51 +08:00
David Taylor 9534f13256
DEV: Replace `site-settings:main` with `service:site-settings` (#17734)
This will allow consumers to inject it using `siteSettings: service()` in preparation for the removal of implicit injections in Ember 4.0. `site-settings:main` is still available and will print a deprecation notice.
2022-08-01 09:43:33 +01:00
Andrei Prigorshnev 023835cdad
DEV: a new `d-tooltip` component (#17513) 2022-07-28 18:33:20 +04:00
Phil Pirozhkov 493d437e79
Add RSpec 4 compatibility (#17652)
* Remove outdated option

04078317ba

* Use the non-globally exposed RSpec syntax

https://github.com/rspec/rspec-core/pull/2803

* Use the non-globally exposed RSpec syntax, cont

https://github.com/rspec/rspec-core/pull/2803

* Comply to strict predicate matchers

See:
 - https://github.com/rspec/rspec-expectations/pull/1195
 - https://github.com/rspec/rspec-expectations/pull/1196
 - https://github.com/rspec/rspec-expectations/pull/1277
2022-07-28 10:27:38 +08:00