Commit Graph

2527 Commits

Author SHA1 Message Date
David Taylor
0b8fcb7c72
DEV: Update chat avatarUrl import to resolve deprecation (#22564) 2023-07-12 13:55:42 +01:00
chapoi
ab67b2bda9
UX: more border-radius removal from chat (#22542) 2023-07-12 14:30:06 +02:00
chapoi
9576aab391
UX: z-index for for tippy box in chat (#22541) 2023-07-12 14:29:44 +02:00
David Taylor
fb9948c79c
DEV: Make capabilities available outside of application instance (#22516)
Browser capabilities are inherently unconnected to the lifecycle of our app. Making them formally available outside of the service means that they can safely be used in non-app-linked functions without needing risky hacks like `helperContext()` or `discourse-common/lib/get-owner`.

One example of where the old hacks were problematic is the `translateModKey()` utility function. This is called in the root of the `discourse/components/modal/keyboard-shortcuts-help` es6 module. If anything (e.g. a theme/plugin) caused that es6 module to be `require()`d before the application was booted, a fatal error would occur.

Following this commit, `translateModKey()` can safely import and access `capabilities` without needing to worry about the app lifecycle.

The only potential downside to this approach is that the capabilities data now persists across tests. If any tests need to 'stub' capabilities, they will need to revert their changes at the end of the test (e.g. by using Sinon to stub a property).

This commit also updates some legacy references from `capabilities:main` to `service:capabilities`.
2023-07-12 09:38:25 +01:00
Joffrey JAFFEUX
aca0bf69ef
WIP: threads list pagination (#22502)
This implementation will need more work in the future. For simplification of tracking and other events (new thread, delete/restore OM...) we used the threads from `threadsManager` which makes pagination more complicated as we already have some results when we start.

Note this commit also simplify `Collection` to only have one `load` method which can be called repeatedly.
2023-07-12 09:38:44 +02:00
Alan Guo Xiang Tan
0106c9b4ca
DEV: Fix flaky chat navigation specs on CI (#22560)
Why this change?

The specs are flaky on CI and we've unable to figure out why so we've
decided to skip them only on CI for now. The tests are still ran in our
internal build so we still have some protection in place.
2023-07-12 09:16:35 +08:00
Martin Brennan
0f9e4da4ef
FIX: Chat thread race condition issues (#22533)
Trying to fix two issues:

1. Sometimes the publish_new! event for update_thread_original_message
   finishes running on the UI before the one for thread_created, in this
   case we just want to do nothing because thread_created will fetch the
   new thread along with its preview from the server if needed
2. Sometimes the thread GET and /read events were erroring because
   last_reply on the thread was nil, this was potentially occuring because
   the thread_created event was coming through to the UI before the rest
   of MessageCreator was done, so we just move that after the big update
   to set thread_id for the new and existing messages in the reply
   chain
2023-07-12 09:15:16 +10:00
Discourse Translator Bot
3d231de12a
Update translations (#22537) 2023-07-11 16:20:52 +02:00
Alan Guo Xiang Tan
ab053ac669
UX: Remove section heading for community section (#22405)
Why is this change being made?

We've decided that the previous "community" section should look more
like a primary section that holds the most important navigation links
for the site and the word "community" doesn't quite fit that
description. Therefore, we've made the decision to drop the
section heading for the community section. 

As part of removing the section heading, the following changes are made
as well:

1. Button to customize the section has been moved to the "footer" of the
   "More..." section when `navigation_menu` site setting is set to `sidebar`. 
   When `navigation_menu` is set to `header dropdown`, a button to customize 
   the section is shown inline.

2. The section will no longer be collapsable.

3. The title of the section is no longer customisable as it is no longer
   displayed. As a technical note, we have not dropped any previous
   customisations of the section's title previously in case we have to
   bring back the header in the future.

4. The new topic button that was previously present in the header has
   been removed alongside the header. Admins can add a custom section
   link to the `/new-topic` route if there would like to make it easier for
   users to create a new topic in the sidebar.
2023-07-11 09:40:37 +08:00
chapoi
8c74bb6573
UX: lower border radius for channel cards (#22513) 2023-07-10 19:07:01 +02:00
Joffrey JAFFEUX
d52b0560ff
DEV: fixes flakey due to unordered array (#22515)
The `message_bus_channels` given to `MessageBus.last_ids(*message_bus_channels)` is not ordered, as a result the expectation of the tests could fail, this test ensures we check the contain of the input instead of content+order.
2023-07-10 17:26:29 +02:00
chapoi
0ce0bcd8ff
Remove border radius from chat (#22437)
* add border-radius-large variable

* UX: replace chat border-radius with variable
2023-07-10 15:07:38 +02:00
Joffrey JAFFEUX
8270d76f16
DEV: makes user-card-chat-button uses glimmer (#22496)
This commit also namespaces the component to now be: `<Chat::UserCardButton />`
2023-07-10 14:04:26 +02:00
Joffrey JAFFEUX
9830c40386
DEV: makes chat modals use the new <DModal /> component (#22495)
This commit also standardize the naming pattern of modals: `<Chat::Modal::FooBar />` and changes css class accordingly.

Co-authored-by: David Taylor <david@taylorhq.com>
2023-07-10 13:43:33 +02:00
David Taylor
ed2dae6d1a
FIX: Ensure dialogs are still rendered if triggered during boot (#22511)
When the loading slider is enabled, the rendering of `application.hbs` is slightly delayed compared to the old 'spinner' strategy. This means that if a route tried to render a dialog during its `model()` hook, the dialog wrapper element would not be present and an error would occur.

This commit detects that situation and delays rendering the error until the next runloop iteration. If the element is still not found, we print a useful error to the console.

In the long term, we should ideally convert the dialog service to use a pure-ember rendering strategy instead of leaning on a11y-dialog. But for now, this workaround should resolve the problems identified by the chat system specs.
2023-07-10 11:29:04 +01:00
chapoi
c7cebbfe38
UX: change z-index of thread resizer to be below emoji popup (#22505) 2023-07-10 12:27:55 +02:00
chapoi
c2b98802ea
UX: message creator spacing and sizing on mobile + fix text wrapping (#22508)
* UX: mobile more spacing and bigger

* UX: align text better

* UX: ellipsis and pill bg colour

* UX: disabled-chat msg styling
2023-07-10 12:27:26 +02:00
David Taylor
9a1a3906c4
DEV: Support rendering <DModal> as a <form> element (#22507) 2023-07-10 10:28:45 +01:00
Joffrey JAFFEUX
7339be7952
UX: do not show presence in message creator selection (#22506) 2023-07-10 11:04:06 +02:00
Joffrey JAFFEUX
af22f77d38
DEV: removes unused components (#22497)
Removes the following components which are not used anymore:
- d-progress-bar
- on-visibility-action
2023-07-10 09:54:45 +02:00
Joffrey JAFFEUX
03e495186f
FIX: makes chat user avatar show presence by default (#22490)
It's way more common to have presence enabled than disabled, so we should have been making it the default from start.

This commit also changes the namespace of `<ChatUserAvatar />` into `<Chat::UserAvatar />` and refactors tests.
2023-07-10 09:36:20 +02:00
Joffrey JAFFEUX
81a16a105e
DEV: makes <Chat::Admin::ExportMessage /> use glimmer (#22498) 2023-07-10 09:35:54 +02:00
Natalie Tay
64dec1368c
DEV: Cleanup an old spec (#22503)
Introduced in #22297, now clear to remove since we don't have a habit of keeping migration specs.
2023-07-10 11:34:17 +08:00
Guhyoun Nam
b70bd4366b
FEATURE: Separated 'trusted users can edit others' setting for trust level 3 & 4 (#21493) 2023-07-07 10:48:14 -05:00
Joffrey JAFFEUX
2dfeb5f0c2
FIX: typo in property name (#22489)
Sadly this function is one of the very hard to test codepaths of the app. We could in the future attempt to extract the content of the function to unit-test it.
2023-07-07 12:48:21 +02:00
Martin Brennan
3ea8203719
FIX: Track thread in UI when user sends first message (#22462)
When a user sends their first message in a thread we
automatically track the thread in the backend, but we
don't reflect this in the UI until the user re-opens
the thread. This commit fixes that by showing the new
tracking level in the UI.
2023-07-07 13:09:06 +10:00
Joffrey JAFFEUX
f0d82de5d9
DEV: fix flakeyness with drawer specs (#22476)
Chat drawer was using the `DiscourseURL` hook `afterRouteComplete`. This hook suffer from a very poor implementation which makes it very unreliable:

```javascript
if (typeof opts.afterRouteComplete === "function") {
  schedule("afterRender", opts.afterRouteComplete);
}
```

This commit attempts to return the promise from `handleURL` to directly use it and have a very reliable after transition hook.
2023-07-07 00:46:04 +02:00
Joffrey JAFFEUX
d41fa579c8
DEV: more resilient auto remove spec (#22472)
We have no guarantees on the last record here, it's easier and more stable to check all created records.
2023-07-06 21:44:53 +02:00
Joffrey JAFFEUX
c0808b2537
FIX: correctly makes dm creator to follow channel (#22470)
In previous changes we prevented creating a channel to also make users follow the channel. We were forcing recipients to follow the channel on message sent but this was not including the creator of the message itself.

This commit fixes it and also write an end-to-end system spec to cover these cases. The message creator service is currently being rewritten and should correctly test and ensure this logic is present.

This commit also makes changes on the frontend to instantly follow a DM when you open it, this change prevents a green dot to appear for a split second when you send a message in a channel you were previously not following. Only recipients will see the green dot.
2023-07-06 21:42:19 +02:00
Jarek Radosz
dc46acb851
DEV: Remove OK pretender helper (#22438)
We already have the `response` helper (which additionally sets the `Content-Type` header)

(also: all-caps name suggested a constant, not a function)
2023-07-06 20:39:23 +02:00
Isaac Janzen
b8cf50798b
DEV: Skip flaky visit-channel system tests (#22469)
Consistently seeing failures on 
- visit-channel
- navigation

specs
2023-07-06 13:17:37 -05:00
Joffrey JAFFEUX
250e3d881d
FIX: removes discourse-teams-sidebar support (#22465)
This plugin is now archived we don't need to carry this code anymore.
2023-07-06 15:40:24 +02:00
Joffrey JAFFEUX
30e4b898f5
FIX: limits legacy sidebar height (#22466)
Prior to this fix the sidebar was taking unlimited height.
2023-07-06 15:40:20 +02:00
Mark VanLandingham
3171fd1a0a
DEV: Introduce Chat Notices with publishing method (#22369) 2023-07-06 08:26:25 -05:00
Loïc Guitaut
5134b28d83 FIX: Add missing chat translations
Some error messages when creating a new chat message were not defined.
2023-07-06 11:35:02 +02:00
Martin Brennan
f69748e325
FIX: Mark threads read when threading enabled for a channel (#22458)
Since we create threads in the background regardless of whether
threading is enabled for a channel, we get the unexpected behaviour
of everyone having a lot of unread threads when threading is enabled
for the channel.

To counteract this, when the admin enables threads for a channel
we can just run a high priority background job to mark all threads
as read in the channel for all users, so they are essentially
starting from a clean slate.
2023-07-06 16:24:56 +10:00
Martin Brennan
9b14bf82dc
FIX: Show replies count on thread indicator regardless of participants (#22459)
Followup to 802fb3b194

We should not hide the replies count if there is only 1 participant
for a thread, because this makes it look like the last reply is the
only reply.
2023-07-06 14:31:18 +10:00
Martin Brennan
1cd512a03a
DEV: Normalize key modifier checks for keyboard shortcuts (#22451)
This introduces a PLATFORM_KEY_MODIFIER const that
can be used both client and server side, to determine
whether we should be using the Meta or Ctrl key based
on whether the user is on Windows/Linux or Mac.
2023-07-06 13:34:24 +10:00
Alan Guo Xiang Tan
4c810703c1
FIX: Avoid transitioning when a chat thread component is destroyed (#22457)
Why this change?

Before this commit, there is a chance that we will transition the user
to a different route if the chat thread component has been destroyed
prior to the request for fetching messasges in a chat thread returning.

This commit makes it such that we simply ignore the request if the chat
thread component has been destroyed.

We believe this is the cause of the flaky system tests in plugins/chat/spec/system/navigation_spec.rb
which we've been seeing on CI.
2023-07-06 10:53:28 +08:00
Alan Guo Xiang Tan
ff38bccb80
DEV: Fix number of chars for chat message content in fabricator (#22454)
Why this change?

`Faker::Lorem.paragraph` generates a differrent length of string
every time. When a string happens to be long, it can change the UI
across system test runs making it harder to reason about our system
tests across multiple runs since the state is never really consistent.

We will just generate a paragraph with a fixed length going forward so
that the UI remains consistent. This should make certain tests which
relies on the UI being in a certain state to become less flaky.
2023-07-06 10:34:57 +08:00
Alan Guo Xiang Tan
cb9ae1eb1f
DEV: Fix flaky chat drawer system test (#22452)
Why this change?

This change ensures that we scroll to the top of the message when
hovering over a message to ensure that the message actions container
that appears on hover is not hidden in the chat drawer when the content
of the chat message is long.
2023-07-06 09:03:42 +08:00
Alan Guo Xiang Tan
9a65c78d87
DEV: Avoid waiting full capybara default wait time (#22449)
Why this change?

`not_to be_open` ends up calling `has_css?` on a selector that will
never appear so it ends up waiting the full default wait time.
2023-07-06 08:16:58 +08:00
Martin Brennan
37a8036b2d
FIX: Better handling of deleted thread original messages (#22402)
This commit includes several fixes and improvements to thread
original message handling:

1. When a thread's original message is deleted, the thread no longer
   counts as unread for a user
2. When a thread original message is deleted and the user is looking
   at the thread list, it will be removed from the list
3. When a thread original message is restored and the user is looking
   at the thread list, it will be added back to the list if it was
   previously loaded
2023-07-06 09:47:34 +10:00
Joffrey JAFFEUX
478c4b1a74
DEV: prevents message actions to hide drawer's header (#22448)
In specific conditions (generally a small drawer, with a long message) it is possible to have the message’s actions menu to be displayed hover the drawer's header.

This is particularly hard to fix correctly using popper due to our positioning which is slightly at the limit of the container.

The proposed fix targets mostly the specs by ensuring the messages actions will be hidden before attempting to click any header's button.
2023-07-06 07:33:39 +08:00
Alan Guo Xiang Tan
772334a346
DEV: Add more helpful assertions for flaky system tests in CI (#22432)
Why this change?

In CI, we know we're clicking a link to a chat channel's threads list.
However, the threads list is not loaded and we want to add more
assertions here to try and figure out why. By asserting for the current
URL, we will at least know that the transition to the URL is successful.
2023-07-06 07:08:59 +08:00
Joffrey JAFFEUX
972e0f74ff
FIX: more consistent composer focus and replying indicator (#22443) 2023-07-05 22:24:53 +02:00
Joffrey JAFFEUX
2ce9364c08
FIX: do not filter on category name (#22442) 2023-07-05 21:12:39 +02:00
Joffrey JAFFEUX
cfdf5b9518
FIX: correctly show unread and presence (#22441)
- Presence needs to be explicitly set on the component now
- We were not checking and testing correctly the presence of the unread indicator in the menu
2023-07-05 21:01:23 +02:00
Kris
4cec091f1a
REFACTOR: improve poll info layout (#22353) 2023-07-05 12:20:18 -04:00
Joffrey JAFFEUX
d75d64bf16
FEATURE: new jump to channel menu (#22383)
This commit replaces two existing screens:
- draft
- channel selection modal

Main features compared to existing solutions
- features are now combined, meaning you can for example create multi users DM
- it will show users with chat disabled
- it shows unread state
- hopefully a better look/feel
- lots of small details and fixes...

Other noticeable fixes
- starting a DM with a user, even from the user card and clicking <kbd>Chat</kbd> will not show a green dot for the target user (or even the channel) until a message is actually sent
- it should almost never do a full page reload anymore

---------

Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
Co-authored-by: Jordan Vidrine <30537603+jordanvidrine@users.noreply.github.com>
Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
2023-07-05 18:18:27 +02:00