Commit Graph

47679 Commits

Author SHA1 Message Date
Joffrey JAFFEUX
a5dac26769
DEV: attempts to move all Jobs.run_immediately! at top (#19688) 2023-01-03 11:32:27 +01:00
Alan Guo Xiang Tan
f04e454628
Version bump to v3.0.0.beta15 (#19685) 2023-01-03 14:29:26 +08:00
Martin Brennan
b57f9c73a4
DEV: Skip all chat specs with Jobs.run_immediately! (#19684)
These specs are causing issues around AR connection pools
and busy connections, try skipping them for now, e.g. see
https://github.com/discourse/discourse/actions/runs/3826965835/jobs/6511173680
and /t/82525
2023-01-03 16:02:15 +10:00
Joffrey JAFFEUX
b235799792
FIX: more stable system tests (#19678)
This commit is a series of fixes to improve stability of system tests following the use of threadsafe:

* Jobs.run_immediately in before block was causing issues
* During test a js error could be caused by an undefined this.details in chat-live-pane
* Apply the chat composer click trick everywhere when sending a message, it ensures we are not hiding anything with autocomplete
* There was another case not using send_message yet
2023-01-03 14:53:41 +10:00
David Taylor
431b129d8b
DEV: Update bundler to 2.4.1 (#19662) 2023-01-03 10:01:36 +08:00
dependabot[bot]
523f86d422
Build(deps): Bump puma from 6.0.1 to 6.0.2 (#19679)
Bumps [puma](https://github.com/puma/puma) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: puma
  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>
2023-01-03 10:01:00 +08:00
Alan Guo Xiang Tan
af76f291e6
PERF: Avoid running redundant bookmarks query for anon viewing topic (#19659)
The `TopicView#bookmarks` method is called by `TopicViewSerializer` and `PostSerializer`
so we want to avoid running a meaningless query when user is not
present.
2023-01-03 10:00:36 +08:00
Alan Guo Xiang Tan
24db6fbb73
PERF: Memoize topic level checks in PostGuardian (#19647)
When loading posts in a topic, the topic level guardian
checks are run multiple times even though all the posts belong to the
same topic. Profiling in production revealed that this accounted for a
significant amount of request time for a user that is not staff or anon.
Therefore, we're optimizing this by adding memoizing the topic level
calls in `PostGuardian`. Speficifally, the result of
`TopicGuardian#can_see_topic?` and `PostGuardian#can_create_post?`
method calls are memoized per topic.

Locally profiling shows a significant improvement for normal users
loading a topic with 100 posts.

Benchmark script command: `ruby script/bench.rb --unicorn --skip-bundle-assets --iterations 100`

Before:

```
topic user:
  50: 114
  75: 117
  90: 122
  99: 209
topic.json user:
  50: 67
  75: 69
  90: 72
  99: 162
```

After:

```
topic user:
  50: 101
  75: 104
  90: 107
  99: 184
topic.json user:
  50: 53
  75: 53
  90: 56
  99: 138
```
2023-01-03 09:00:42 +08:00
Alan Guo Xiang Tan
be1ae9411b
PERF: Remove redundant DB queries from TopicView (#19658)
This commit removes 3 redundant DB queries when loading posts.

1. `@posts` will eventually have to be loaded so we can avoid two
additional queries.

2. No need to preload topic association of posts as we're already
dealing with a fixed topic in `TopicView`.
2023-01-03 08:17:52 +08:00
Joffrey JAFFEUX
d8a19b2c9a
FIX: correctly uses request_uri to generate load_more_url (#19680)
Before this change we were generating an incorrect absolute URL: `https://chat/api/channels...`
2023-01-03 00:19:13 +01:00
Joffrey JAFFEUX
96e2d92129
FIX: at this point in time component can be destroyed (#19677)
Especially possible in tests
2023-01-02 19:17:10 +01:00
Joffrey JAFFEUX
cb2f684a43
FIX: correctly always return a promise from loadMore (#19676)
This commit also fixes an issue where `loading = false` was never called when the server had nothing new to return.
2023-01-02 15:55:45 +01:00
Roman Rizzi
2f61d26e3d
PERF: Make chat mention notifications async. (#19666)
This PR removes the limit added to max_users_notified_per_group_mention during #19034 and improve the performance when expanding mentions for large channel or groups by removing some N+1 queries and making the whole process async.

* Fully async chat message notifications

* Remove mention setting limit and get rid of N+1 queries
2023-01-02 11:54:52 -03:00
Joffrey JAFFEUX
b8100ad1ae
DEV: enables threadsafe for system tests
It should fix flakeys we have due to using_session. This commit is also fixing tests which were failing constantly with treadsafe enabled.

A test has also bene skipped as the issue couldn't be found so far.

More info: https://github.com/teamcapybara/capybara#threadsafe-mode
2023-01-02 15:17:21 +01:00
Joffrey JAFFEUX
b97fff444e
FIX: ensures loading more doesn’t erase filter on browse (#19675) 2023-01-02 14:40:13 +01:00
dependabot[bot]
e82689c1bf
Build(deps): Bump mini_portile2 from 2.8.0 to 2.8.1 (#19624)
Bumps [mini_portile2](https://github.com/flavorjones/mini_portile) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/flavorjones/mini_portile/releases)
- [Changelog](https://github.com/flavorjones/mini_portile/blob/main/CHANGELOG.md)
- [Commits](https://github.com/flavorjones/mini_portile/compare/v2.8.0...v2.8.1)

---
updated-dependencies:
- dependency-name: mini_portile2
  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>
2023-01-02 14:25:01 +01:00
dependabot[bot]
129e1429a2
Build(deps): Bump rack from 2.2.4 to 2.2.5 (#19628)
Bumps [rack](https://github.com/rack/rack) from 2.2.4 to 2.2.5.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/2.2.4...v2.2.5)

---
updated-dependencies:
- dependency-name: rack
  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>
2023-01-02 14:24:04 +01:00
dependabot[bot]
a032f45421
Build(deps): Bump css_parser from 1.12.0 to 1.13.0 (#19668)
Bumps [css_parser](https://github.com/premailer/css_parser) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/premailer/css_parser/releases)
- [Changelog](https://github.com/premailer/css_parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/premailer/css_parser/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: css_parser
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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>
2023-01-02 13:20:11 +01:00
dependabot[bot]
8ed525f9ce
Build(deps): Bump highline from 2.0.3 to 2.1.0 (#19669)
Bumps [highline](https://github.com/JEG2/highline) from 2.0.3 to 2.1.0.
- [Release notes](https://github.com/JEG2/highline/releases)
- [Changelog](https://github.com/JEG2/highline/blob/master/Changelog.md)
- [Commits](https://github.com/JEG2/highline/commits)

---
updated-dependencies:
- dependency-name: highline
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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>
2023-01-02 13:20:02 +01:00
dependabot[bot]
94b9cc8de3
Build(deps): Bump rubocop from 1.41.1 to 1.42.0 (#19670)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.41.1 to 1.42.0.
- [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.1...v1.42.0)

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

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>
2023-01-02 13:19:54 +01:00
dependabot[bot]
eb02ff6447
Build(deps-dev): Bump bullet from 7.0.4 to 7.0.5 (#19671)
Bumps [bullet](https://github.com/flyerhzm/bullet) from 7.0.4 to 7.0.5.
- [Release notes](https://github.com/flyerhzm/bullet/releases)
- [Changelog](https://github.com/flyerhzm/bullet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/flyerhzm/bullet/compare/7.0.4...7.0.5)

---
updated-dependencies:
- dependency-name: bullet
  dependency-type: direct:development
  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>
2023-01-02 13:19:45 +01:00
dependabot[bot]
1664a9d950
Build(deps): Bump eslint in /app/assets/javascripts (#19672)
Bumps [eslint](https://github.com/eslint/eslint) from 8.30.0 to 8.31.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.30.0...v8.31.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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>
2023-01-02 13:19:37 +01:00
dependabot[bot]
567bca8d23
Build(deps-dev): Bump minitest from 5.16.3 to 5.17.0 (#19673)
Bumps [minitest](https://github.com/seattlerb/minitest) from 5.16.3 to 5.17.0.
- [Release notes](https://github.com/seattlerb/minitest/releases)
- [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc)
- [Commits](https://github.com/seattlerb/minitest/compare/v5.16.3...v5.17.0)

---
updated-dependencies:
- dependency-name: minitest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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>
2023-01-02 13:19:26 +01:00
dependabot[bot]
348953f882
Build(deps): Bump json5 from 2.2.1 to 2.2.2 (#19657)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

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>
2023-01-02 11:10:02 +01:00
Gerhard Schlager
702f27e6ee
DEV: Add labels for plugin locale files (#19664)
translator-bot will use them to allow filtering of core plugins
2022-12-31 00:37:15 +01:00
Discourse Translator Bot
6f570752ab
Update translations (#19663) 2022-12-30 17:49:48 +01:00
Joffrey JAFFEUX
908add79de
DEV: moves channel-archive-status to channels subscriptions (#19567)
It was quite an oddball because its a global subscription created on each channel. channels manager now allows us to elegantly solve this case.
2022-12-30 15:30:36 +01:00
David Taylor
584a6e3552
FIX: Update nginx config for v1.23 (#19651)
NGINX v1.23 concatenates duplicate headers into a single comma-separated string. We were doing an equality check on `x-forwarded-proto`. If the request includes multiple `x-forwarded-proto` headers then this check would fail under NGINX v1.23, and our config assumed an `http` connection.

This commit updates the config to check for `https` at the end of the header, thereby restoring the old behavior when multiple `x-forwarded-proto` request headers are sent.
2022-12-30 12:35:26 +00:00
David Taylor
eebe2f256c
DEV: Skip s3 asset deletion when in readonly mode (#19611)
In some situations (e.g. disaster recovery), it may make sense to spin up a temporary readonly version of a cluster. In that situation, the s3 `expire_missing_assets` job would delete assets which are still in use by the canonical read-write version of the cluster.

To avoid that, this commit will skip deletion if the site is currently in readonly mode.
2022-12-30 11:35:40 +00:00
Régis Hanol
df1a0eaece
DEV: add .ruby-version to .gitignore (#19661)
We provide a `.ruby-version.sample` file that we use for warning developers
about the minimum recommended Ruby version to run Discourse.

d24dfe8f96/config/application.rb (L15-L20)

But if people copy the sample to a `.ruby-version` file it would be added
next time they commit.

This adds the `.ruby-version` file to `.gitignore` so it doesn't get commited
by mistake and developers can test Discourse on other versions of Ruby if
they want to.
2022-12-30 12:11:55 +01:00
Alan Guo Xiang Tan
0da79561c3
DEV: Improve/Fix script/bench.rb (#19646)
1. Fix bug where we were not waiting for all unicorn workers to start up
before running benchmarks.

2. Fix a bug where headers were not used when benchmarking. Admin
benchmarks were basically running as anon user.

3. Disable rate limits when in profile env. We're pretty much going to
hit the rate limit every time as a normal user.

4. Benchmark against topic with a fixed posts count of 100. Previously profiling script was just randomly creating posts
and we would benchmark against a topic with a fixed posts count of 30.
Sometimes, the script fails because no topics with a posts count of 30
exists.

5. Benchmarks are not run against a normal user on top of anon and
admin.

6. Add script option to select tests that should be run.
2022-12-30 07:25:11 +08:00
dependabot[bot]
63debd6d33
Build(deps): Bump rubocop-ast from 1.24.0 to 1.24.1 (#19656)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.24.0 to 1.24.1.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-ast/compare/v1.24.0...v1.24.1)

---
updated-dependencies:
- dependency-name: rubocop-ast
  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-30 06:51:10 +08:00
Rafael dos Santos Silva
01cbc64e19
FIX: Do not show push notification banner for MacOS (#19655) 2022-12-29 14:50:09 -03:00
Isaac Janzen
e5349e43af
DEV: Update group moderator behavior to better mimic staff (#19618)
# Context
When a topic is reviewable by a group we give those group moderators some admin abilities including the ability to delete a topic.

# Problem
There are two main problems:

1. Currently when a group moderator deletes a topic they are redirected to root (not the same for staff)
2. Viewing the categories deleted topics (`c/foo/1/?status=deleted`) does not display the deleted topic to the group moderator (not the same for staff).

# Fix
If the `deleted_by` user is part a group that matches the `reviewable_by_group` on a topic then don't redirect. This is the default interaction for staff to give them the ability to do things like restore the topic in case it was accidentally deleted.

To render the deleted topics as expected for the group moderator I am utilizing [the guardian scope of `guardian.can_see_deleted_topics?` for said category](https://github.com/discourse/discourse/pull/19618/files#diff-288e61b8bacdb29d9c2e05b42da6837b0036dcf1867332d977ca7c5e74a44297R802-R803)
2022-12-29 10:07:03 -06:00
Gerhard Schlager
7e33cb3665
FIX: Add missing email template for user_watching_category_or_tag (#19653)
Adds a spec to hopefully prevent this in the future.

Follow-up to aa3a9b6fea
2022-12-29 15:36:53 +01:00
Joffrey JAFFEUX
2644a4d303
DEV: removes chat-channel-settings-row (#19650)
This is dead code which should have been removed when `chat-settings-settings-modal` has been removed.
2022-12-29 13:50:01 +01:00
Joffrey JAFFEUX
4ba4959a26
FIX: various fixes to channel archive status (#19649)
- improves UI by displaying channel status on it's own line
- ensures channel status is correctly updated right after the request on frontend
- adds status on info page
2022-12-29 11:45:40 +01:00
Andrei Prigorshnev
5e844793d8
FIX: show status on mentions on just posted posts (#19639)
We show live user status on mentions starting from a76d864. But status didn’t appear on the post that appears on the bottom of the topic just after a user posted it (status appeared only after page reloading). This adds status to just posted posts.
2022-12-29 14:34:59 +04:00
dependabot[bot]
f7cfffa043
Build(deps-dev): Bump ruby-prof from 1.4.4 to 1.4.5 (#19645)
Bumps [ruby-prof](https://github.com/ruby-prof/ruby-prof) from 1.4.4 to 1.4.5.
- [Release notes](https://github.com/ruby-prof/ruby-prof/releases)
- [Changelog](https://github.com/ruby-prof/ruby-prof/blob/master/CHANGES)
- [Commits](https://github.com/ruby-prof/ruby-prof/compare/1.4.4...1.4.5)

---
updated-dependencies:
- dependency-name: ruby-prof
  dependency-type: direct:development
  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-29 09:49:41 +08:00
David Taylor
25ad99637d
FIX: Avoid race conditions when toggling presence state (#19648)
We need to set the local state of a channel before performing any async operations. Otherwise, multiple leave/join calls can race against each other and cause the local state to get out-of-sync with the server.

Followup to e70ed31a
2022-12-29 00:44:31 +00:00
David Taylor
083ef4c8a1
DEV: Move eslint-config-discourse to devDependencies (#19641) 2022-12-28 16:50:31 +00:00
Joffrey JAFFEUX
8a792bdf0b
FIX: cancels fetching messages when pane is destroyed (#19642)
Ultimately we would want a cleaner solution here where we correctly cancel in `willDestroy` hook but this is the safest move for now.
2022-12-28 16:01:41 +01:00
dependabot[bot]
ec1a7df112
Build(deps): Bump @babel/core in /app/assets/javascripts (#19595)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.20.5 to 7.20.7.
- [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.20.7/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  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-28 14:04:13 +00:00
David Taylor
f68d6cd6cd
FIX: DButton ellipsis argument (#19640)
This regressed in a8890295
2022-12-28 14:03:58 +00:00
David Taylor
9f0a095405 DEV: Add extra whitespace to tidy up prettified templates 2022-12-28 13:11:12 +00:00
David Taylor
c8e2e37fa7 DEV: Apply prettier to hbs files 2022-12-28 13:11:12 +00:00
David Taylor
104a16610a DEV: Configure prettier for hbs templates 2022-12-28 13:11:12 +00:00
dependabot[bot]
61b2d2eade
Build(deps): Bump @babel/standalone in /app/assets/javascripts (#19622)
Bumps [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone) from 7.20.6 to 7.20.11.
- [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.20.11/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/standalone"
  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-28 13:01:53 +00:00
dependabot[bot]
295289aeb3
Build(deps): Bump web-push from 9b1ab76 to 369df8f (#19635)
Bumps [web-push](https://github.com/xfalcox/web-push) from `9b1ab76` to `369df8f`.
- [Release notes](https://github.com/xfalcox/web-push/releases)
- [Commits](9b1ab768d1...369df8f475)

---
updated-dependencies:
- dependency-name: web-push
  dependency-type: direct:production
...

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-28 13:01:23 +00:00
David Taylor
e70ed31a45
PERF: Ignore repeated PresenceChannel leave/join calls (#19638)
If a consumer is calling leave or join on a channel repeatedly, that should not trigger additional HTTP requests
2022-12-28 13:00:08 +00:00