Commit Graph

52515 Commits

Author SHA1 Message Date
dependabot[bot]
a4fc7f983c
Build(deps): Bump rack-protection from 3.1.0 to 3.2.0 (#25080)
Bumps [rack-protection](https://github.com/sinatra/sinatra) from 3.1.0 to 3.2.0.
- [Changelog](https://github.com/sinatra/sinatra/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sinatra/sinatra/compare/v3.1.0...v3.2.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-02 08:40:40 +08:00
dependabot[bot]
c5fb3d45ba
Build(deps): Bump cbor from 0.5.9.6 to 0.5.9.8 (#25081)
Bumps [cbor](http://cbor.io/) from 0.5.9.6 to 0.5.9.8.

---
updated-dependencies:
- dependency-name: cbor
  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>
2024-01-02 08:40:27 +08:00
Sam
baa7c4cec7
FIX: allow styling of feedback on mobile (#25072)
(to test try using discourse-ai which displays feedback on mobile)


---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2023-12-30 08:57:16 +11:00
David Battersby
406f4c9e80
DEV: fix flaky back to forum spec (#25071)
Fixes a flaky test by ensuring Capybara finishes loading the topic page before attempting to open chat. The back to forum url relies on a tracked property (previous url), which is set when visiting the topic page.
2023-12-29 16:55:12 +08:00
Alan Guo Xiang Tan
2b3a572987
DEV: Attempt to fix flaky test by using click_button instead of click (#25070)
Why this change?

Some of the tests in `spec/system/table_builder_spec.rb` are flaky when
we are asserting that clicking the cancel button will close the modal.
This change attempts to fix it by using the `click_button` method
instead of `find` then `click` which is more reliable.
2023-12-29 14:39:37 +08:00
Alan Guo Xiang Tan
0756486b65
FIX: Adding form template to category dropdown can some times be empty (#25066)
Why this change?

A system test which was testing our ability to add a form template to a
category was flaky. This turned out to be a client side bug where the
`FormTemplateChooser` dropdown may not display any dropdown options if
the ajax request to fetch the categories form template has not been
completed when the dropdown is opened.

What does this change do?

Make use of select-kit's `triggerSearch` function to fetch the records
which will properly rerender the dropdown options.
2023-12-29 14:15:56 +08:00
Alan Guo Xiang Tan
ea910e291b
DEV: Remove assertion causing test to be flaky (#25069)
Why this change?

The assertion does not make use of Capybara's waiting strategy and is
not really testing anything meaningful by asserting for the src of the
img element.
2023-12-29 13:23:16 +08:00
Sam
c6cb319671
DEV: API allow post actions to optionally provide visual feedback
post action feedback is the mechanism in which we provide visual feedback
to the user when a post action is clicked, in cases where the action is a
background (hidden to user) for example: copying text to the clipboard

Core uses this to share post links, but other plugins (for example: AI) use
this to share post transcripts via the clipboard.

This adds a proper plugin API to consume this functionality

`addPostMenuButton` can provide a builder that specified a function as the action. 

This function will be called with an object that has both the current post and a method for showing feedback.
2023-12-29 15:59:43 +11:00
dependabot[bot]
f5380bb890
Build(deps): Bump nokogiri from 1.15.5 to 1.16.0 (#25064)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.15.5 to 1.16.0.
- [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.5...v1.16.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-29 12:45:38 +08:00
Joffrey JAFFEUX
40ce619edd
DEV: uses in: {} with lambda to work with eager_load (#25039)
When validating with a dynamic set of values, especially one that might change during runtime, we should use a lambda or a proc to ensure that the validation uses the most up-to-date set of values. This is particularly important when using config.eager_load = true, which can cause some elements to be loaded only once at startup, thus not reflecting changes made at runtime.

This was the root cause of the issues here, as we were adding more ReviewableScore types after initial load through: `register_reviewable_type Chat::ReviewableMessage`
2023-12-29 12:45:07 +08:00
Alan Guo Xiang Tan
6e8c2bb4ab
DEV: Improve error message when test fails (#25067)
Why this change?

The two tests being updated in question has been flaky on CI. However,
when using `be_forbidden`, the error message does not indicate what the
actual response code was making it hard for us to debug.

What does this change do?

Assert for the exact response status code we are expecting.
2023-12-29 12:44:41 +08:00
Gerhard Schlager
ce57969016
DEV: Add "migrations-tooling" label to PRs for import scripts (#25062)
Also, PRs for import scripts should automatically be assigned to the migrations-tooling group.
2023-12-28 21:26:05 +01:00
Gerhard Schlager
d7601388e5
DEV: Apply code format to import script (#25063) 2023-12-28 21:25:29 +01:00
Sebastian Wagner
050a285f40
FEATURE: Import Script for Fusionforge (#22281)
This is an import script for the forum/development platform https://www.fusionforge.org/projects/fusionforge
imports users, forums and posts including attachments
2023-12-28 20:36:30 +01:00
dependabot[bot]
a3a74ee4a5
Build(deps-dev): Bump sqlite3 from 1.6.9 to 1.7.0 (#25051)
Bumps [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) from 1.6.9 to 1.7.0.
- [Release notes](https://github.com/sparklemotion/sqlite3-ruby/releases)
- [Changelog](https://github.com/sparklemotion/sqlite3-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/sqlite3-ruby/compare/v1.6.9...v1.7.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-28 20:30:53 +01:00
Matías García Isaía
3e5d2cb2e3
Fix typos and internal links in INSTALL-cloud (#25058)
Looks like we added a section, thus changing all the internal links in the Table of Content.
2023-12-28 20:27:43 +01:00
Rafael dos Santos Silva
a6cf2d20e6
FEATURE: Topic crawler view bottom plugin outlet (#25060) 2023-12-28 15:16:30 -03:00
David Taylor
48ad326ba4
FIX: Handle deprecations correctly in server-side pretty-text (#25059)
`window.deprecationWorkflow` does not exist in the server-side pretty-text environment. This commit fixes the check and adds a general spec for deprecations triggered inside pretty-text
2023-12-28 16:35:06 +00:00
Isaac Janzen
8e58c6dd93
DEV: Add extension points to Admin User Fields (#25021)
- Add plugin outlet to `AdminUserFieldItem`
- Add ability to include custom fields when saving `AdminUserFieldItem` 
- Update plugin API with `includeUserFieldPropertiesOnSave` per ☝️ 
- Add `DiscoursePluginRegistry` to `UserFieldsController` to add custom columns
2023-12-28 08:24:24 -07:00
marstall
ddd750cda7
FEATURE: change /invites.json api endpoint to optionally accept array of emails (#24853)
https://meta.discourse.org/t/feature-request-sending-bulk-invitations-via-api/272423/18
2023-12-28 10:16:04 -05:00
Bianca Nenciu
14269232ba
DEV: No longer preload categories (#24950)
Categories will no longer be preloaded when `lazy_load_categories` is
enabled through PreloadStore.

Instead, the list of site categories will continue to be populated
by `Site.updateCategory` as more and more categories are being loaded
from different sources (topic lists, category selectors, etc).
2023-12-28 14:36:33 +02:00
Bianca Nenciu
c4396c6acf
DEV: Prefer Ember's RSVP over native Promise (#25049)
This causes an incompatibility in some plugins that are patching the
discovery-categories route, such as discourse-global-filter.
2023-12-28 14:15:35 +02:00
David Battersby
1061bf97e2
UI: chat header style improvements (#25057)
Small visual improvements for chat header on mobile:

- makes the Back to Forum target size slightly narrower
- makes the text color consistent between header and back button (and d-icon)
- makes the chat heading bold
2023-12-28 17:44:53 +08:00
Discourse Translator Bot
cd818ab63f
Update translations (#25041) 2023-12-28 10:12:53 +01:00
David Battersby
3d4b62651e
FIX: chat drawer routing fix for threads (#25056)
This change fixes a minor regression in the chat back button navigation.
2023-12-28 15:02:33 +08:00
Sam
d5e1b3e683
DEV: add test that ensure include_raw param continues to work (#25055)
Previously we hand no tests for `include_raw` which some consumers may
depend on.

Specifically, Discourse AI uses it to get raw markdown for a set of posts
on a topic.

Also cleans up tests so they lint with default ruby
2023-12-28 14:26:27 +11:00
Sam
b4c1b10969
FIX: copy link not working in non secure context (#25053)
In non secure contexts (HTTP vs HTTPS) which many run in development the
`clipboardCopy` method falls back to and an exec hack.

However, callers expect a promise from this method and the fallback just
returns a boolean.
2023-12-28 10:42:23 +11:00
David Battersby
a7fe2e1a48
FIX: pass args in chat header logo plugin outlet (#25050)
This change passes down all params to the home logo widget (rather than explicitly setting minimized). This will allow for flexible logo sizing in the Discourse full width theme component.
2023-12-27 19:43:20 +08:00
Alan Guo Xiang Tan
655c106101
DEV: Capture and log AR debug logs on GitHub actions for flaky tests (#25048)
Why this change?

We have been running into flaky tests which seems to be related to
AR transaction problems. However, we are not able to reproduce this
locally and do not have sufficient information on our builds now to
debug the problem.

What does this change do?

Noe the following changes only applies when `ENV["GITHUB_ACTIONS"]` is
present.

This change introduces an RSpec around hook when `capture_log: true` has
been set for a test. The responsibility of the hook is to capture the
ActiveRecord debug logs and print them out.
2023-12-27 14:40:00 +08:00
Ted Johansson
7852daa49b
DEV: Skip broken deprecated settings test until TL mapping is done (#25046)
These tests are still flaky (order dependence) just that now it doesn't fail the test, instead it creates an infinite loop. Skipping these for now. We know they work because they pass, but they leak into other tests. I think we can re-enable locally and either fix or remove this once TL migration is done.
2023-12-27 13:58:05 +08:00
dependabot[bot]
c92662cef9
Build(deps): Bump net-imap from 0.4.8 to 0.4.9 (#25026)
Bumps [net-imap](https://github.com/ruby/net-imap) from 0.4.8 to 0.4.9.
- [Release notes](https://github.com/ruby/net-imap/releases)
- [Commits](https://github.com/ruby/net-imap/compare/v0.4.8...v0.4.9)

---
updated-dependencies:
- dependency-name: net-imap
  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-12-27 13:51:57 +08:00
Arpit Jalan
d9ca6c3bb9
FIX: improve structured data based on recent changes (#25043)
This commit makes some improvements to a topic's structured data based
on the recommendation on meta topic: https://meta.discourse.org/t/google-structured-data-for-forums-and-profile-pages/286762/9
2023-12-27 11:13:16 +05:30
dependabot[bot]
596ba54302
Build(deps): Bump fastimage from 2.2.7 to 2.3.0 (#25029)
Bumps [fastimage](https://github.com/sdsykes/fastimage) from 2.2.7 to 2.3.0.
- [Changelog](https://github.com/sdsykes/fastimage/blob/master/CHANGELOG)
- [Commits](https://github.com/sdsykes/fastimage/compare/v2.2.7...v2.3.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-27 12:42:56 +08:00
Ted Johansson
b890eb1bd2
DEV: Convert min_trust_to_allow_self_wiki to groups (#25009)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_to_allow_self_wiki site setting to self_wiki_allowed_groups.

Nothing of note here. This is used in exactly one place, and there's no fallout.
2023-12-27 09:21:39 +08:00
dependabot[bot]
3c818ff07e
Build(deps): Bump tzinfo-data from 1.2023.3 to 1.2023.4 (#25028)
Bumps [tzinfo-data](https://github.com/tzinfo/tzinfo-data) from 1.2023.3 to 1.2023.4.
- [Release notes](https://github.com/tzinfo/tzinfo-data/releases)
- [Commits](https://github.com/tzinfo/tzinfo-data/compare/v1.2023.3...v1.2023.4)

---
updated-dependencies:
- dependency-name: tzinfo-data
  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-12-27 08:44:44 +08:00
dependabot[bot]
689fa512b6
Build(deps): Bump ember-auto-import from 2.7.1 to 2.7.2 in /app/assets/javascripts (#25025)
* Build(deps): Bump ember-auto-import in /app/assets/javascripts

Bumps [ember-auto-import](https://github.com/ef4/ember-auto-import/tree/HEAD/packages/ember-auto-import) from 2.7.1 to 2.7.2.
- [Release notes](https://github.com/ef4/ember-auto-import/releases)
- [Changelog](https://github.com/embroider-build/ember-auto-import/blob/main/packages/ember-auto-import/CHANGELOG.md)
- [Commits](https://github.com/ef4/ember-auto-import/commits/HEAD/packages/ember-auto-import)

---
updated-dependencies:
- dependency-name: ember-auto-import
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* Update lockfiles for ember version flag

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: discoursebuild <build@discourse.org>
2023-12-27 08:25:43 +08:00
dependabot[bot]
6e358e1b77
Build(deps-dev): Bump parallel_tests from 4.3.0 to 4.4.0 (#25030)
Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 4.3.0 to 4.4.0.
- [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md)
- [Commits](https://github.com/grosser/parallel_tests/compare/v4.3.0...v4.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-27 08:24:32 +08:00
chapoi
32c438387b
UX: make sidebar title static (#25040)
* UX: make sidebar title static

* tests
2023-12-26 13:37:32 +01:00
chapoi
3a20718526
UX: header avatar > change to aria-label (#25038) 2023-12-26 12:18:12 +01:00
David Battersby
67d736a045
FEATURE: chat header redesign on mobile (#24938)
This change simplifies the layout of our header when chat is open on mobile. The search icon and hamburger menu icons are also hidden and the Discourse logo is replaced by a ← Forum link to make it easier to continue where you left off within the forum (prior to this update the user could only go back to the forum index page).
2023-12-26 17:36:26 +08:00
Ted Johansson
b456320880
DEV: Skip flaky deprecated setting logging test (#25037)
There's a leaky test that breaks some controller tests if run first, creating an order-dependent flake.

This change fixes that, but in doing so also skips a low-value test that breaks from the fix. (Verified manually that it's working.)
2023-12-26 16:24:56 +08:00
Alan Guo Xiang Tan
043ba1d179
DEV: Fix job cluster concurrency spec timing out (#25035)
Why this change?

On CI, we have been seeing the "handles job concurrency" job timing out
on CI after 45 seconds. Upon closer inspection of `Jobs::Base#perform`
when cluster concurrency has been set, we see that a thread is spun up
to extend the expiring of a redis key by 120 seconds every 60 seconds
while the job is still being executed. The thread looks like this before
the fix:

```
keepalive_thread =
  Thread.new do
    while parent_thread.alive? && !finished
      Discourse.redis.without_namespace.expire(cluster_concurrency_redis_key, 120)
      sleep 60
    end
  end
```

In an ensure block of `Jobs::Base#perform`, the thread is stop by doing
something like this:

```
finished = true
keepalive_thread.wakeup
keepalive_thread.join
```

If the thread is sleeping, `keepalive_thread.wakeup` will stop the
`sleep` method and run the next iteration causing the thread to
complete. However, there is a timing issue at play here. If
`keepalive_thread.wakeup` is called at a time when the thread is not
sleeping, it will have no effect and the thread may end up sleeping for
60 seconds which is longer than our timeout on CI of 45 seconds.

What does this change do?

1. Change `sleep 60` to sleep in intervals of 1 second checking if the
   job has been finished each time.

2. Add `use_redis_snapshotting` to `Jobs::Base` spec since Redis is
   involved in scheduling and we want to ensure we don't leak Redis
keys.

3. Add `ConcurrentJob.stop!` and `thread.join` to `ensure` block in "handles job concurrency"
   test since a failing expectation will cause us to not clean up the
thread we created in the test.
2023-12-26 14:47:03 +08:00
Martin Brennan
89705be722
DEV: Add auto map from TL -> group site settings in DeprecatedSettings (#24959)
When setting an old TL based site setting in the console e.g.:

SiteSetting.min_trust_level_to_allow_ignore = TrustLevel[3]

We will silently convert this to the corresponding Group::AUTO_GROUP. And vice-versa, when we read the value on the old setting, we will automatically get the lowest trust level corresponding to the lowest auto group for the new setting in the database.
2023-12-26 14:39:18 +08:00
Natalie Tay
12131c8e21
FIX: CLS jumpiness in post-stream when ?page=N (#25034)
With certain conditions, this issue does not show up. The easiest way to reproduce this is probably to do either of this

- Use a 3G slow connection or;
- Add a breakpoint to scrolling-post-stream.topRefresh (anon)
- (and optionally lock-on.lock)

This issue is happening because there are multiple areas that set scroll location in the post stream when loading a topic. In our case, sometimes lock-on is triggering and scrolling to post_1, before ?page=2's post_21 is being scrolled to, due to posts above post_21 can finishing loading at different times. This causes some calculations to not add up, as being in the middle of a post stream has different calculations than being at the top of the post stream.
2023-12-26 14:31:49 +08:00
Alan Guo Xiang Tan
bf3e121323
DEV: Set config.eager_load = true on CI (#25032)
Why this change?

When running system tests on our CI, we have been occasionally seeing
server errors like:

```
Error encountered while proccessing /stylesheets/desktop_e58cf7f686aab173f9b778797f241913c2833c39.css
  NoMethodError: undefined method `+' for nil:NilClass
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/path/pattern.rb:139:in `[]'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:127:in `block (2 levels) in find_routes'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `each'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `each_with_index'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `block in find_routes'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:123:in `map!'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:123:in `find_routes'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:32:in `serve'
    /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/routing/route_set.rb:852:in `call'
```

While looking through various Rails issues related to the error above, I
came across https://github.com/rails/rails/pull/27647 which is a fix to
fully initialize routes before the first request is handled. However,
the routes are only fully initialize only if `config.eager_load` is set
to `true`. There is no reason why `config.eager_load` shouldn't be `true` in the
CI environment and this is what a new Rails 7.1 app is generated with.

What does this change do?

Enable `config.eager_load` when `env["CI"]` is present
2023-12-26 13:05:55 +08:00
Alan Guo Xiang Tan
a69b386556
DEV: Fix can't modify frozen string error when reporting server errors (#25033)
Follow up to 9d658591d6
2023-12-26 11:10:11 +08:00
Alan Guo Xiang Tan
cfec408bc1
DEV: Remove flaky tests report when there are too many failures (#25031)
Why this change?

Currently we only rerun failing tests to check if they are flaky tests
when there are 10 or less failing tests. When there are more than 10
failing tests in the first run, we assume that the odds of those tests
being flaky are low and do not rerun the tests. However, there was a bug
where we do not clean up the potential flaky tests being logged when
there are too many test failures. This resulted in those test failures
being treated as flaky tests.

What does this change do?

Clean up the flaky tests report when we do not rerun the tests.
2023-12-26 09:23:17 +08:00
Krzysztof Kotlarek
d03f6727b1
FIX: TL3 can convert their post to a wiki (#25023)
A bug that allowed TL1 to convert other's posts to wiki.

The issue was introduced in this PR: https://github.com/discourse/discourse/pull/24999/files

The wiki can be created if a user is TL3 and it is their own post - default 3 for setting `SiteSetting.min_trust_to_allow_self_wiki`

In addition, a wiki can be created by staff and TL4 users for any post.
2023-12-23 21:31:46 +11:00
Kris
c4f940aa31
UX: resize pm composer inputs for narrow screens (#25019) 2023-12-22 15:17:26 -05:00
Kris
02b117a852
FIX: scope PM background color to PMs (#25020) 2023-12-22 15:16:59 -05:00