Commit Graph

47555 Commits

Author SHA1 Message Date
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
Discourse Translator Bot ebe8b868bf
Update translations (#19633) 2022-12-28 13:32:29 +01:00
David Taylor d4d9d60a5f
DEV: Print system test logs with other test metadata (#19637)
Previously, browser logs would be printed to STDOUT halfway through the test run. This commit changes the behaviour so that the logs are included in the failure summary along with other rspec failure information.
2022-12-28 10:47:57 +00:00
David Taylor d24dfe8f96
DEV: Update minimum and recommended ruby versions (#19615)
Minimum: 2.7.0
Recommended: 3.1.3
2022-12-28 10:09:15 +00:00
Natalie Tay d914ea8366
FIX: Show topic titles in deleted-posts (#19610)
Show topic titles in deleted-posts
2022-12-28 16:07:06 +08:00
Ted Johansson 06db264f24
FIX: Gracefully handle DNS issued from SSRF lookup when inline oneboxing (#19631)
There is an issue where chat message processing breaks due to
unhandles `SocketError` exceptions originating in the SSRF check,
specifically in `FinalDestination::Resolver`.

This change gives `FinalDestination::SSRFDetector` a new error class
to wrap the `SocketError` in, and haves the `RetrieveTitle` class
handle that error gracefully.
2022-12-28 10:30:20 +08:00
Ted Johansson 462e14e279
DEV: Enable concurrent system tests (#19632)
Currently the `turbo:spec` task will fail when encountering system
tests as Capypara tries to use the same port for each process.

This simple change uses the same strategy as for databases, by just
incrementing the port number by `TEST_ENV_NUMBER` for each process.
2022-12-28 10:06:50 +08:00
Alan Guo Xiang Tan 070eac16a8
PERF: Optimize the performance of `TopicLink.topic_map` query (#19630)
Instead of relying on the `ILIKE` operator to filter out image links, we
can instead rely on the `TopicLink#extension` column which allows us to
more efficiently filter out image links.

This optimization mainly affects topics that are link heavy which is
common in topics with alot of replies. When profiling a production
instance for a topic with 10K replies and 2.5K `topic_links`, this
optimization reduces the query time from ~18ms to around ~4ms.
2022-12-28 08:10:36 +08:00
Joffrey JAFFEUX aad63d92d2
FIX: removes missed chat_channels legacy paths (#19634)
- chat-channel-by-name is no longer supported
- chat_channels_controller doesn’t exist anymore
2022-12-27 20:56:26 +01:00
Rafael dos Santos Silva 7b53973bd8
DEV: Use WebPush fork for OpenSSL 3 compat (#19627)
* DEV: Use WebPush fork for OpenSSL 3 compat

* add some context on gemfile changes
2022-12-27 15:28:13 -03:00
Vinoth Kannan 598233456d
FEATURE: Warn admins about private group name's exposure to anonymous users. (#19557)
Group names will be used as CSS classes in some components while rendering the public HTML output. It will happen when a group is set as the default primary for users. Or when a group has either a flair icon or flair upload. So we should warn the admins when they restrict the group's visibility level.

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2022-12-27 13:17:13 +05:30
Alan Guo Xiang Tan 1fd0e82da7
PERF: Fix N+1 queries problem on topic view page (#19629)
`User#flair_group` was not preloaded leading to the N+1 queries problem
when multiple users have flair groups.
2022-12-27 09:05:37 +08:00
Tobias Eigen 982adb1c65
UX: Improve copy for contact email and url description (#19621)
The admin settings for contact email and contact url did not explicitly indicate that they are visible to anons on /about page, and that when present the contact url replaces the contact email address. This change makes it so.
2022-12-27 05:53:28 +08:00
Jarek Radosz 60402f2b34
DEV: Label and ignore all default gems (#19617)
`licensed` fails to find gem's license if it's a default gem (see: https://stdgems.org) and the version you're requiring comes with the ruby version you're using.

A ruby upgrade or any change to Gemfile could trigger `licensed` failures, so it's better to ignore all default gems we're using.
2022-12-24 11:59:08 +01:00
Joffrey JAFFEUX df11457d56
FIX: correctly allows admin to visit a user chat's preferences page (#19619) 2022-12-23 21:18:09 +01:00
Joffrey JAFFEUX 03d32f26bb
FIX: correctly handles navigating to a message (#19614)
Recent changes surfaced the various issues with this codepath:
- we were not correctly reseting `messageLookup` leading to us trying to scroll to a non existing message in the view
- we were calling markAsRead which would scroll to the bottom, even if we had a target message
- we were not debouncing fetchMessages, which could cause multiple reload of the messages when loading it with a targetMessageId: first fetch from last read and then immediately fetch from targetMessageId
- other naming inconsistencies
- not handling drawer

This commit also adds tests for classic scenarios related to this use case.
2022-12-23 19:48:14 +01:00
Jan Cernik d633467c60
FIX: Whisper tooltip shows the allowed groups (#19509) 2022-12-23 15:42:46 -03:00
Jarek Radosz 6f4cf81401
DEV: Update bundler `licensed` config (#19607)
1. Add `cgi` (ruby terms)
2. Move `strscan`, ~~`ruby2_keywords`, and `openssl`~~ to "reviewed" section (update: two of those are postponed, need to debug stuff in our docker image)
3. Sort
2022-12-23 14:04:03 +01:00
Osama Sayegh d8b39810d2
DEV: Stop leaking state in dashboard controller specs (#19608)
A few specs in `dashboard_controller_spec.rb` set some state in redis but don't clean it up afterwards which causes other specs to fail when they're ran after `dashboard_controller_spec.rb`.

Related commit: 18467d4.
2022-12-23 15:41:30 +03:00
Jarek Radosz 953b823c5a
DEV: Deprecate `controllerFor` test helper (#19606)
After all the test changes it was only used in a single place in core 🤷

(also updated the recommendation in `assert.not` deprecation message)
2022-12-23 11:33:42 +01:00
Joffrey JAFFEUX 64dcd44c94
FIX: more reliable archive channel spec (#19605) 2022-12-23 10:25:51 +01:00
Martin Brennan 29638f0639
DEV: Add upload system specs for chat (#19604) 2022-12-23 08:41:10 +01:00
Joffrey JAFFEUX f17aed973e
FIX: ensures recovering network doesn't create unread mentions (#19597) 2022-12-23 07:38:45 +01:00
Gerhard Schlager 5926386d4f
FIX: Workaround a bug in the R2 gem (#19602) 2022-12-23 12:07:07 +08:00
Alan Guo Xiang Tan 1d926e88a9
FIX: Admin can't see user sidebar preferences of other users (#19570) 2022-12-23 11:45:29 +08:00