Commit Graph

50021 Commits

Author SHA1 Message Date
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
dependabot[bot] eabceaefbe
Build(deps): Bump nokogiri from 1.15.2 to 1.15.3 (#22447)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.15.2 to 1.15.3.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.15.2...v1.15.3)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-06 07:03:57 +08:00
Sérgio Saquetim 4f2299949a
FIX: Prevent field name conflicts when using the `groups_for_users_search` modifier (#22446) 2023-07-05 19:58:21 -03: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
Jarek Radosz e72153dd1a
DEV: Remove unused raw-email code (#22364)
This code seems unused, since ~2016?
2023-07-05 18:13:30 +02:00
dependabot[bot] 07bb4453d9
Build(deps-dev): Bump @babel/standalone in /app/assets/javascripts (#22419)
Bumps [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone) from 7.22.5 to 7.22.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.6/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/standalone"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 17:05:32 +02:00
Isaac Janzen 2a598db08a
DEV: Convert second-factor-add-totp modal to component-based API (#22358)
This PR converts the `second-factor-add-totp` modal to make use of the new component-based API
2023-07-05 09:56:04 -05:00
dependabot[bot] 760668dfde
Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22418)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.22.5 to 7.22.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.6/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 16:47:28 +02:00
David Taylor d51baa3bb3
FEATURE: Introduce 'loading slider' for page navigations (#22042)
This brings the functionality from https://github.com/discourse/discourse-loading-slider into Discourse core. Default behaviour remains the same - the new slider mode can be enabled using the new 'page_loading_indicator' site setting.
2023-07-05 14:59:24 +01:00
Andrei Prigorshnev a9dfda2d66
DEV: fix flaky specs for user status tooltip (#22435)
A follow-up to 585a2e4e. A couple of tests with the new rich tooltip were flaky. 
We suppose the reason is some problem related to widgets lifecycle. This PR 
doesn't fix the issue, but isolates testing of the tooltip related logic related 
inside its own test, which should make it not flaky.

This is a temporal solution, we're going to move all these code to using 
glimmer components.
2023-07-05 16:46:09 +04:00
Isaac Janzen 239d56dd69
DEV: Convert group-add-members modal to component-based API (#22368) 2023-07-05 11:04:06 +01:00
Keegan George ad1b466cd4
DEV: Update JSON Editor to Glimmer and use new modalAPI (#22421) 2023-07-05 10:27:29 +01:00
Keegan George d458ca154c
DEV: Update keyboard shortcuts to glimmer and new modal api (#22422) 2023-07-05 10:13:16 +01:00
Alan Guo Xiang Tan 1e26a521c2
FIX: Error when loading a channel with threading enabled but no threads (#22434)
Without this fix, the following error is raised:

```
ActiveRecord::StatementInvalid:
  PG::SyntaxError: ERROR:  syntax error at or near ")"
  LINE 4:   WHERE thread_id IN ()
```
2023-07-05 14:33:49 +08:00
Alan Guo Xiang Tan 96b20077d9
DEV: Ignore requests to `/favicon.ico` requests in test env (#22431)
This is not a valid route and is causing routing errors to be raised in
the test env adding noise to the logs. We'll just "handle" the route in
the test env.
2023-07-05 12:11:15 +08:00
Alan Guo Xiang Tan de7110d539
DEV: Add process pid to `bin/turbo_tests --format documentation` output (#22429)
Why this change?

The process's pid is useful when we're trying to link output from
different processes together. In this case, we want to be able to link
the Rails server logs to the right rspec process.

Before:

[2] Viewing sidebar mobile collapses the sidebar when clicking outside of it

After:

[2] (#176342) Viewing sidebar mobile collapses the sidebar when clicking outside of it
2023-07-05 11:47:35 +08:00
Alan Guo Xiang Tan 14517785b2
DEV: Fix flaky system test when expanding chat message actions on mobile (#22428)
Why this change?

Chat system tests that opens the message actions on mobile have been
flaky on our CI. Those system test usually fails when the message
actions do not show up as expected causing subsequent actions to fail.

In the case of the `Reply to message - channel - mobile when the message has an existing thread replies to the existing thread`
system test, failure screenshot shows that we ended up navigating to the
thread instead of opening the message actions button. To understand why
this happens, we first need to understand that by default Capybara clicks
on the centre of an element. Also, we need to note that the HTML structure of
a chat message is like so:

```
<div class="chat-message-container">
  <div class="chat-message">
    <div class="chat-message-avatar" />
    <div class="chat-message-content" />
    <div class="chat-message-thread-indicator" />
  </div>
</div>
```

Since `PageObjects::Pages::ChatChannel#expand_message_actions_mobile`
attempts to click on the `.chat-message-contaier`, there is a
possibility that the center of that element is the
`.chat-message-thread-indicator` element which would explain why we
navigated to the thread list instead of opening up the message actions.
This is possible because the content of the original chat message as
well as the message excerpt in the thread is randomly generated where the
length of the message and how the text wraps on mobile can affect the
height of the `.chat-message-content` element as thus its position in
the `.chat-message-container` element. In most cases, the middle of the
`.chat-message-container` happens to be the `.chat-message-content`
which is why this test "flakes" sometimes.

What is the solution?

Instead of clicking on the `.chat-message-container`, we be more
specific and click on the `.chat-message-content` element instead.
2023-07-05 10:39:04 +08:00
Alan Guo Xiang Tan 858cc6aff2
DEV: Log server errors encountered when running system tests on CI (#22427)
Why is this change required?

We've been seeing flaky tests due to server errors on CI but are unable
to debug it because we do not log any of the errors. This change gives
us a fighting chance the next time we encounter a server error during
system test runs.

See
https://github.com/discourse/discourse/actions/runs/5459248864/jobs/9935049920?pr=22424
for an example of server errors encountered during system tests.
2023-07-05 09:46:48 +08:00
Martin Brennan e9e3f147f0
DEV: Unhide chat experimental threads site setting (#22426)
This is in preparation for the V1 thread announcement,
where we will begin to allow site admins to enable this
themselves.
2023-07-05 11:20:31 +10:00
Martin Brennan cd0dac5cd2
DEV: Add some modal PageObject open/closed assertions (#22425) 2023-07-05 11:02:46 +10:00
Alan Guo Xiang Tan 631089a4b0
DEV: Fix flaky edit nav menu tags system test (#22424)
Previously , the test was flaky and failing with a selenium stale
element error because we were retrieving the tag nodes with `all` and
then calling `.map(&:text)` on it. However, there is a chance that a
re-render happens and those nodes will end up being stale resulting in
the selenium error.
2023-07-05 08:40:16 +08:00
Alan Guo Xiang Tan 865f7a9852
DEV: Reduce number of parallel test processors to 3 for system tests (#22423)
This is an experiment to see if not saturating resources on a runner
with 8 vCPU leads to more stability on our CI.
2023-07-05 08:08:46 +08:00
dependabot[bot] 16673c920d
Build(deps): Bump rubocop from 1.54.0 to 1.54.1 (#22420)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.54.0 to 1.54.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.54.0...v1.54.1)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 07:32:46 +08:00
Joffrey JAFFEUX 40ec9ab97b
DEV: skip post-inline-mention test (#22417)
Mentions tests are flakey ATM
2023-07-04 23:12:08 +02:00
Isaac Janzen 3f91656c2d
DEV: Convert do-not-disturb modal to component-based API (#22394)
This PR converts the `do-not-disturb` modal to make use of the new component-based API
2023-07-04 15:27:41 -05:00
Isaac Janzen aaccb774de
DEV: Update default modal alert class (#22416)
This PR changes the default to not append any classes (when `@flashType` isn't present) and instead leans on the `alert` class for styling the alert which is a 1 to 1 match of the `alert-error` class.

8f21d2cf40/app/assets/stylesheets/common/base/alert.scss (L1-L4)

8f21d2cf40/app/assets/stylesheets/common/base/alert.scss (L22-L24)

In essence this changes the default modal alert styling from `success` to `error` if not overridden by `@flashType`
2023-07-04 15:22:14 -05:00
Keegan George 904450594d
DEV: Convert form template modals to new component-based API (#22196) 2023-07-04 12:42:36 -07:00
Gerhard Schlager e09ce99884
DEV: Slack import script (#22386)
It's very simple import script and currently imports only the following content:
* Users
* Messages as Discourse topics/posts
* Attachments

Each channel can be mapped to a category and tags. It uses regular expressions to convert formatted messages ("rich text") into Markdown used by Discourse. In the future we could convert the `blocks` attribute from each message into Markdown instead of applying regular expressions on the `text` attribute.
2023-07-04 21:37:45 +02:00
Renato Atilio ce0ddfba8c
FIX: mobile share canonical URL (#22370)
* FIX: mobile share canonical url

* FIX: test

* DEV: address PR comments
2023-07-04 15:02:52 -03:00
Isaac Janzen 8f21d2cf40
DEV: Convert second-factor-edit modals to component-based API (#22367)
This PR converts the following modals:
- `second-factor-edit-security-key`
- `second-factor-edit`

to make use of the new component-based API
2023-07-04 12:13:54 -05:00
David Taylor 1122454904
DEV: Error if invalid `@flashType` passed to modal (#22414) 2023-07-04 18:11:29 +01:00
Discourse Translator Bot 9ee1972a2c
Update translations (#22412) 2023-07-04 18:14:46 +02:00
Isaac Janzen 148431d521
DEV: Convert fullscreen modals to component-based API (#22248)
This PR converts the following modals:
- `fullscreen-code`
- `fullscreen-table`

to make use of the new component-based API
2023-07-04 10:35:10 -05:00
Isaac Janzen a579bd6b28
DEV: Convert second-factor-add-security-key modal to component-based API (#22351) 2023-07-04 16:15:37 +01:00
David Taylor 773e198cb3
DEV: Convert poll modals to new component-based API (#22164) 2023-07-04 15:25:34 +01:00
David Taylor e549b0f132
DEV: Ensure `DModal` model argument is still available during destroy (#22411)
Previously, the `@model` argument would be unset before the component's `willDestroy` hook was called. Wrapping up the component and the opts in a single tracked `activeModal` field, and then using the `#each` helper with an array of 1 element means that Glimmer will keep the `@model` argument available until the end of the component's lifecycle.
2023-07-04 14:40:41 +01:00
David Taylor 999014e8e5
DEV: Add `@bodyClass` argument to `<DModal>` component (#22410) 2023-07-04 10:26:46 +01:00
chapoi ee1dbd46c6
UX: Thread indicator small fixes (#22389)
* UX: make timestamp font size smaller

* UX: participants use copy instead of avatar

* FIX: Move thread participant count into i18n

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2023-07-04 10:32:09 +02:00
Alan Guo Xiang Tan 38a9694ff5
DEV: Skip flaky test introduced in 82d6420 (#22409) 2023-07-04 15:15:19 +08:00
Martin Brennan 56aef3c082
DEV: Fix or remove flaky chat specs (#22406)
* DEV: Fix flaky thread nav spec

When we transitioned from the chat thread panel under some conditions
the request for the thread would come back and realise the component
was destroyed, which was trying to do a transition to the channel
itself.

Now we check for the previous route here too and transition to the
correct route.

* DEV: Fix chat transcript spec relying on animation

The on-animation-end modifier is not reliable in system specs
because it fires instantly (we have disabled capybara animations)
so the showCopySuccess boolean can be mutated back to false straight
away.

Better to have a separate boolean tracked with a data-attr that we
can reliably inspect in the system spec.
2023-07-04 16:23:04 +10:00
Alan Guo Xiang Tan bb0698858f
DEV: Improve `PageObjects::Modals::SidebarEditTags#has_tag_checkboxes?` (#22407)
Why this change?

Improves the error message when stuff fails.

Before:

expected `#<PageObjects::Modals::SidebarEditTags:0x00007fa3877135e0>.has_tag_checkboxes?([#<Tag id: 1, name: "tag", created_at: "2023-07-04 05:21:12.914149000 +0000", updated_at: "2023-07-04..._topic_count: 0, target_tag_id: nil, description: nil, public_topic_count: 1, staff_topic_count: 1>])` to be truthy, got false

After:

expected to find visible css ".sidebar-tags-form .sidebar-tags-form__tag-label-name" 3 times, found 4 matches: "tag", "tag2", "tag3", "tag4"
2023-07-04 15:51:23 +10:00
Alan Guo Xiang Tan 454a4af0bf
DEV: Ensure browser network conditions is reset in system tests (#22404)
Why this change?

By ensuring the reset happens in an `ensure` code block, we ensure that
the code will always be run even if code fails or an error is raised.
This helps to prevent leaking custom network condition states and
improves the stability of our system tests.
2023-07-04 13:22:58 +08:00
Krzysztof Kotlarek 134dcdd63a
FEATURE: allow user to override watched_precedence_over_muted setting (#22340)
Recently, site setting watched_precedence_over_muted was introduced - https://github.com/discourse/discourse/pull/22252

In this PR, we are allowing users to override it. The option is only displayed when the user has watched categories and muted tags, or vice versa.
2023-07-04 15:08:29 +10:00
Alan Guo Xiang Tan 82d6420e31
PERF: Paginate loading of tags in edit nav menu tags modal (#22380)
What is the problem?

Before this change, we were relying on the  `/tags` endpoint which 
returned all the tags that are visible to a give user on the site leading to potential performance problems. 
The attribute keys of the response also changes based on the `tags_listed_by_group` site setting. 

What is the fix?

This commit fixes the problems listed above by creating a dedicate `#list` action in the
`TagsController` to handle the listing of the tags in the edit
navigation menu tags modal. This is because the `TagsController#index`
action was created specifically for the `/tags` route and the response
body does not really map well to what we need. The `TagsController#list`
action added here is also much safer since the response is paginated and
we avoid loading a whole bunch of tags upfront.
2023-07-04 11:36:39 +08:00
Alan Guo Xiang Tan 6ae4d6cd4c
DEV: Fix edit nav menu modals not appearing on mobile (#22403)
What is the problem?

This regressed in fe294ab1a7 and we did
not have any tests on mobile to catch the regression. The problem was
that we were conditionally rendering the edit nav menu modals component
in the sidebar. However, the sidebar is collapsed on mobile when a
button is clicked. When the sidebar collapses, the edit nav menu modals
ended up being destroyed with it.
2023-07-04 11:11:47 +08:00
Alan Guo Xiang Tan fe294ab1a7
DEV: Switch edit nav menu tags/categories modal to component (#22401)
Why this change?

A new component based API for modals was introduced in
b3a23bd9d6. This commit moves the edit
navigation menu tags and categories modal to the new API.
2023-07-04 09:45:21 +08:00