Commit Graph

47604 Commits

Author SHA1 Message Date
Osama Sayegh
18467d4067
DEV: Fix new features notification flakey specs (#19596) 2022-12-23 11:17:42 +08:00
Alan Guo Xiang Tan
c2a733a95a
DEV: Make recent creation of chat index idempotent (#19603) 2022-12-23 10:23:57 +08:00
Joffrey JAFFEUX
f1e808153c
FIX: flakey spec due to autocomplete (#19598)
The autocomplete could show and hide the invite link causing the test to fail. Clicking the composer input forces the autocomplete disappear.
2022-12-23 10:35:02 +10:00
Joffrey JAFFEUX
2c295f76fe
FIX: increment wait to prevent a specific flakey spec (#19599)
I could repro the same failure by doing: `page.driver.browser.network_conditions = { offline: false, latency: 3000, throughput: 0 }`

Wait shouldn't be needed as we wait for selector, but I couldn't find a better solution on this case for now.
2022-12-23 10:34:25 +10:00
Martin Brennan
86cafc7237
FIX: Autocomplete fadeout arrow key chat fix (#19600)
Autocomplete with fadeout was not scrolling on arrow
key press in chat, since the input is treated slightly
differently. We just need to find the fadeout div sooner.

Follow up to 64a7a2aac2
2022-12-23 10:31:30 +10:00
Martin Brennan
85b14a0359
DEV: Move chat transcript tests into system specs (#19434)
We are all in on system specs, so this commit moves all the chat quoting acceptance tests (some of which have been skipped for a while) into system specs.
2022-12-23 10:04:41 +10:00
Martin Brennan
641a1a6b44
FIX: Allow for nested chat transcripts (#19572)
The way our markdown raw_html hoisting worked, we only
supported one level of hoisting the HTML content. However
when nesting [chat] transcript BBCode we need to allow
for multiple levels of it. This commit changes opts.discourse.hoisted
to be more constant, and the GUID keys that have the hoisted
content are only deleted by unhoistForCooked rather than
the cook function itself, which prematurely deletes them
when they are needed further down the line.
2022-12-23 09:56:30 +10:00
Martin Brennan
788bcb7736
DEV: Fix hashtag system spec flakys (#19574)
Honestly seems like it's being in some weird loop for
discourse/hashtag_autocomplete_spec.rb for this:

```ruby
  within topic_page.post_by_number(2) do
      cooked_hashtags = page.all(".hashtag-cooked", count: 2)

      expect(cooked_hashtags[0]["outerHTML"]).to eq(<<~HTML.chomp)
      <a class=\"hashtag-cooked\" href=\"#{category.url}\" data-type=\"category\" data-slug=\"cool-cat\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>Cool Category</span></a>
      HTML
      expect(cooked_hashtags[1]["outerHTML"]).to eq(<<~HTML.chomp)
      <a class=\"hashtag-cooked\" href=\"#{tag.url}\" data-type=\"tag\" data-slug=\"cooltag\"><svg class=\"fa d-icon d-icon-tag svg-icon svg-node\"><use href=\"#tag\"></use></svg><span>cooltag</span></a>
      HTML
    end
```

I see this many times in the full logs with `SELENIUM_VERBOSE_DRIVER_LOGS=1`:

```
COMMAND FindElements {
   "using": "css selector",
   "value": "#post_2"
}

Followed by:

COMMAND FindChildElements {
   "id": "26dfe542-659b-46cc-ac8c-a6c2d9cbdf0a",
   "using": "css selector",
   "value": ".hashtag-cooked"
}
```

Over and over and over, there are 58 such occurrences. I am beginning to
think `within` is just poison that should be avoided.
2022-12-23 09:23:29 +10:00
Rafael dos Santos Silva
e430f22936
FIX: Ensure we have a patched version of CGI gem (#19588)
* FIX: Ensure we have a patched version of CGI gem

Per https://github.com/ruby/cgi/pull/29 the current shipped version of
the CGI gem doesn't allow for leading dots in domain names, which breaks
setting cookies like `.example.com`.

* Update Gemfile

Co-authored-by: Jarek Radosz <jradosz@gmail.com>

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2022-12-22 19:52:20 -03:00
Joffrey JAFFEUX
46b51ade83
DEV: more reliable send message helper (#19594) 2022-12-22 23:23:54 +01:00
dependabot[bot]
6ea6b385e0
Build(deps): Bump rubocop from 1.41.0 to 1.41.1 (#19590)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.41.0 to 1.41.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.41.0...v1.41.1)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-22 22:33:57 +01:00
Alan Guo Xiang Tan
a7f30cfcf7
PERF: Fix N+1 queries on /categories route (#19585)
Featured topics are eventually serialized by `ListableTopicSerializer`
which calls `Topic#image_url` which requires us to preload
`Topic#topic_thumbnails`.
2022-12-23 04:29:49 +08:00
Alan Guo Xiang Tan
a8ee56ebee
PERF: Remove unnecessary query from TopicQuery.remove_muted_tags (#19586)
When `default_tags_muted` site settings has not been set, there is no
need to execute the query.
2022-12-23 04:29:17 +08:00
chapoi
b756866334
UX: switch webkit to pseudoelement for fadeout (#19587) 2022-12-22 21:23:58 +01:00
Ella E
3c0a4b37d0
UX: Setup wizard copy changes and vertically stack logo fields (#19583)
* copy changes to setup wizard step title
* make logo upload stacking; tweaks on medium size screen view
2022-12-22 10:15:09 -07:00
David Taylor
84bc4bf3d5
DEV: Do not print verbose console.debug messages in system specs (#19581)
Verbose messages are not shown by default in the chrome dev console. This commit applies the same behavior to system specs.

The main motivation here is to hide the version info which Ember prints every time the application boots.

```text
http://localhost:31337/assets/vendor.js 47142:16 "DEBUG: -------------------------------"
http://localhost:31337/assets/vendor.js 47142:16 "DEBUG: Ember  : 3.28.11"
http://localhost:31337/assets/vendor.js 47142:16 "DEBUG: jQuery : 3.6.0"
http://localhost:31337/assets/vendor.js 47142:16 "DEBUG: -------------------------------"
```
2022-12-22 16:47:33 +00:00
David Taylor
b1b53da71d
DEV: Improve performance of system test sign_in helper (#19579)
Previously, calling `sign_in` would cause the browser to be redirected to `/`, and would cause the Ember app to boot. We would then call `visit()`, causing the app to boot for a second time.

This commit adds a `redirect=false` option to the `/session/username/become` route. This avoids the unnecessary boot of the app, and leads to significantly faster system spec run times.

In local testing, this takes the full system-spec suite for chat from ~6min to ~4min.
2022-12-22 16:03:27 +00:00
Joffrey JAFFEUX
b11e7fb901
DEV: mute audio in system specs (#19578) 2022-12-22 15:03:03 +01:00
Joffrey JAFFEUX
daff62e3cb
FIX: re-enables using_session tests (#19564) 2022-12-22 14:40:36 +01:00
Jarek Radosz
dc3473fe06
DEV: Modernize chat's component tests (#19577)
1. `test()` and `render()` instead of `componentTest()`
2. Angle brackets
3. `strictEqual()`/`true()`/`false()` assertions

This removes all remaining uses of `componentTest` from core
2022-12-22 14:35:18 +01:00
Penar Musaraj
8546c2084a
DEV: Load SVG sprites during system spec runs (#19497)
Co-authored-by: David Taylor <david@taylorhq.com>
2022-12-22 08:13:43 -05:00
Jarek Radosz
263cd02a27
DEV: Get rid of all discourseModule uses (#19576)
QUnit's `module` and `setupTest` is the way
2022-12-22 13:13:28 +01:00
Joffrey JAFFEUX
d54f347883
FIX: prevents playing chat sound when in DnD (#19575)
I couldn't figure a sane way to test this, I'm open to suggestions.
2022-12-22 11:19:54 +01:00
Andrei Prigorshnev
c0b21bf9cf
FIX: styles of user status on mentions (#19563)
Reported in https://meta.discourse.org/t/users-mentions-wrongly-show-their-status-with-the-emoji/249534.

The problem was that we had styles for user status on mentions in the calendar plugin. So it looked fine on sites with Discourse Calendar but not on sites without it.
2022-12-22 14:15:52 +04:00
dependabot[bot]
c933dbfc2c
Build(deps): Bump @ember/test-helpers in /app/assets/javascripts (#19566)
Bumps [@ember/test-helpers](https://github.com/emberjs/ember-test-helpers) from 2.9.1 to 2.9.3.
- [Release notes](https://github.com/emberjs/ember-test-helpers/releases)
- [Changelog](https://github.com/emberjs/ember-test-helpers/blob/v2.9.3/CHANGELOG.md)
- [Commits](https://github.com/emberjs/ember-test-helpers/compare/v2.9.1...v2.9.3)

---
updated-dependencies:
- dependency-name: "@ember/test-helpers"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-22 10:38:01 +01:00
Martin Brennan
64a7a2aac2
FIX: Autocomplete arrow scroll for mention (#19571)
Follow up to 8820e9418a,
only the hashtag autocomplete has a fadeout scroll, so
we still need to scroll on the original div in some
cases (e.g. mentions)
2022-12-22 17:01:51 +10:00
Joffrey JAFFEUX
bef1966ca5
FIX: prevents creating a null User object (#19569)
Following the removal of user in current_user_membership we were now doing: `User.create(null)`.

I don't think it has any impact but this is just wasteful and could lead to issues if used.
2022-12-22 12:39:53 +10:00
Alan Guo Xiang Tan
954b39f5ec
FIX: Sidebar preferences link shown when navigation menu is legacy (#19568) 2022-12-22 07:58:06 +08:00
Joffrey JAFFEUX
f6174587ef
FIX: triggers update last read when message is not staged (#19565) 2022-12-21 22:55:34 +01:00
Alan Guo Xiang Tan
4eee1320b0
PERF: Fix N+1 queries when serializing topic posters (#19545)
At the time of writing, this is how the `TopicPosterSerializer` looks
like:

```
class TopicPosterSerializer < ApplicationSerializer
  attributes :extras, :description

  has_one :user, serializer: PosterSerializer
  has_one :primary_group, serializer: PrimaryGroupSerializer
  has_one :flair_group, serializer: FlairGroupSerializer
end
```

Within `PosterSerializer`, the `primary_group` and `flair_group`
association is requested on the `user` object. However, the associations
have not been loaded on the `user` object at this point leading to the
N+1 queries problem. One may wonder
why the associations have not been loaded when the `TopicPosterSerializer`
has `has_one :primary_group` and `has_one :flair_group`. It turns out that `TopicPoster`
is just a struct containing the  `user`, `primary_group` and
`flair_group` objects. The `primary_group` and `flair_group`
ActiveRecord objects are loaded seperately in `UserLookup` and not preloaded when querying for
the users. This is done for performance reason so that we are able to
load the `primary_group` and `flair_group` records in a single query
without duplication.
2022-12-22 05:30:29 +08:00
Alan Guo Xiang Tan
6bcf558bae
PERF: Stop serializing user in ChatChannelSerializer#current_user_membership (#19527)
The client already has all the information about the current user so
there is no need for us to be serializing the current `User` object each
time per channel that is preloaded.

In production, profiling shows that this unneeded serializing
adds a roughly 5% overhead to a request.
2022-12-22 05:30:06 +08:00
Rafael dos Santos Silva
aa1e8790e5
FIX: Prometheus plugin expects webrick in production (#19562)
* FIX: Prometheus plugin expects webrick in production

* newline
2022-12-21 18:20:07 -03:00
Joffrey JAFFEUX
48ac5d5db9
FIX: corrects a regression with last_read_message_id (#19553)
This commit also adds a system to correctly track this case.
2022-12-21 19:49:32 +01:00
Bianca Nenciu
58479fe10b
DEV: Pass kwargs to defined method (#19552) 2022-12-21 19:02:40 +02:00
Joffrey JAFFEUX
b4b14c4d95
FIX: allows an admin to access users preferences (#19559) 2022-12-21 17:52:53 +01:00
David Taylor
335893ae91
DEV: Correct private-fork -> private-mirror (#19560)
Followup to 7eb9482ba9
2022-12-21 16:52:35 +00:00
David Taylor
7eb9482ba9
DEV: Skip 'push' workflow events for discourse-private-mirror (#19556)
We don't want 'push' workflows to run on this private fork (which is used for developing security-fixes before public disclosure)
2022-12-21 16:44:38 +00:00
David Taylor
f1ec8c869a
DEV: Fix FinalDestination::Resolver race condition (#19558)
We were adding to the resolver's work queue before setting up the `@lookup` and `@parent` information. That could lead to the lookup being performed on the wrong (or `nil`) hostname. This also lead to some flakiness in specs.
2022-12-21 16:02:24 +00:00
Joffrey JAFFEUX
2304761223
FIX: correctly sorts public channels (#19555) 2022-12-21 17:01:20 +01:00
David Taylor
a6af981e1b
DEV: Add retry logic to plugin:install_all_official (#19551)
This task sometimes fails in CI due to temporary network issues. Retrying twice should help resolve those situations without needing to manually restart the job.
2022-12-21 15:31:03 +00:00
Penar Musaraj
e90c2cabfc
UX: Temporarily revert autocomplete highlight change (#19554)
This affects custom themes too much, reverting for now while we work
on a more robust solution.
2022-12-21 10:11:53 -05:00
Joffrey JAFFEUX
c15b4212b6
FIX: better chat-api error handling (#19550)
- chat-message is not using chat-api yet and the `jsonMode` shouldn't have been added
- correctly error on `getChannel` not found
- adds/correct relevant system tests
2022-12-21 16:11:35 +01:00
Joffrey JAFFEUX
4f04a51e17
FIX: prevents chat-api to generate double slash URLS (#19549)
It was not causing any visible issue, but better generate the proper URL.
2022-12-21 16:07:21 +01:00
David Taylor
a56e679723
DEV: Add logging for flaky FinalDestination spec (#19548)
This test occasionally fails in CI. I haven't been able to reproduce the issue locally. This logging will print some extra information when the assertion fails.
2022-12-21 14:40:18 +00:00
Andrei Prigorshnev
2031b75055
FIX: Quoting a mention with status emoji breaks the mention (#19530) 2022-12-21 18:21:53 +04:00
Bianca Nenciu
8f9933d1dd
DEV: Add default results option to user-chooser (#19521)
defaultSearchResults search option can be used to show a list of results
by default, before any search ran, when the filter is empty.
2022-12-21 14:47:47 +02:00
Joffrey JAFFEUX
d2e24f9569
DEV: start glimmer-ification and optimisations of chat plugin (#19531)
Note this is a very large PR, and some of it could have been splited, but keeping it one chunk made it to merge conflicts and to revert if necessary. Actual new code logic is also not that much, as most of the changes are removing js tests, adding system specs or moving things around.

To make it possible this commit is doing the following changes:

- converting (and adding new) existing js acceptances tests into system tests. This change was necessary to ensure as little regressions as possible while changing paradigm
- moving away from store. Using glimmer and tracked properties requires to have class objects everywhere and as a result works well with models. However store/adapters are suffering from many bugs and limitations. As a workaround the `chat-api` and `chat-channels-manager` are an answer to this problem by encapsulating backend calls and frontend storage logic; while still using js models.
- dropping `appEvents` as much as possible. Using tracked properties and a better local storage of channel models, allows to be much more reactive and doesn’t require arbitrary manual updates everywhere in the app.
- while working on replacing store, the existing work of a chat api (backend) has been continued to support more cases.
- removing code from the `chat` service to separate concerns, `chat-subscriptions-manager` and `chat-channels-manager`, being the largest examples of where the code has been rewritten/moved.

Future wok:
- improve behavior when closing/deleting a channel, it's already slightly buggy on live, it's rare enough that it's not a big issue, but should be improved
- improve page objects used in chat
- move more endpoints to the API
- finish temporarily skipped tests
- extract more code from the `chat` service
- use glimmer for `chat-messages`
- separate concerns in `chat-live-pane`
- eventually add js tests for `chat-api`, `chat-channels-manager` and `chat-subscriptions-manager`, they are indirectly heavy tested through system tests but it would be nice to at least test the public API

<!-- 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-12-21 13:21:02 +01:00
Bianca Nenciu
269b6177c1
DEV: Remove fabrication hack for staff (#19528) 2022-12-21 14:02:40 +02:00
Martin Brennan
8820e9418a
FIX: Hashtag autocomplete scrolling arrow keys with fadeout (#19541)
Follow-up to 8db1f1892d,
this makes the hashtag autocomplete scrolling with arrow
keys work with the new fadeout element that is now used
for the scroll container.
2022-12-21 15:15:02 +10:00
Martin Brennan
e15b382666
FIX: Include tags inside tag groups for hashtag search (#19539)
We were using the `for_input: true` param when calling
DiscourseTagging, which is really meant for selecting tags
in the UI, which often need a parent tag selected first
before the child tags in tag group will show. We just
want to show all tags regardless of grouping in hashtag
search.`
2022-12-21 15:14:50 +10:00