Commit Graph

44427 Commits

Author SHA1 Message Date
dependabot[bot]
430d004fe4
Build(deps): Bump stackprof from 0.2.18 to 0.2.19 (#16053)
Bumps [stackprof](https://github.com/tmm1/stackprof) from 0.2.18 to 0.2.19.
- [Release notes](https://github.com/tmm1/stackprof/releases)
- [Changelog](https://github.com/tmm1/stackprof/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tmm1/stackprof/compare/v0.2.18...v0.2.19)

---
updated-dependencies:
- dependency-name: stackprof
  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>
2022-02-26 14:42:40 +01:00
Jarek Radosz
d432e402a2
DEV: Update sinon (#16056) 2022-02-26 13:50:19 +01:00
Jarek Radosz
ff530264f4
DEV: Fix a nokogiri deprecation (#16060)
```
warning: Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.
```
2022-02-26 03:52:11 +01:00
Jarek Radosz
4020738eed
DEV: Fix specs deprecations (#16059) 2022-02-26 03:51:39 +01:00
Jarek Radosz
b05fddaa7c
DEV: Clean up the decorators file (#16058) 2022-02-26 02:33:25 +01:00
Jarek Radosz
29e601c13a
DEV: Fix the javascript:update rake task (#16057)
The source of the moment tz name package has changed in #15761
2022-02-26 02:06:12 +01:00
Ella E
baa4bcda23
FIX: on mobile, overflow on post controls if there are many buttons (#16054) 2022-02-25 15:03:58 -07:00
Roman Rizzi
54ad50eda1
FIX: Respect the cooldown window when editing a flagged topic. (#16046)
When staff decides to hide a flagged post, and it's the first post on the topic, the post owner shouldn't be able to edit either of them until the cooldown finishes. Edit either of them automatically, unhides the post, and makes the topic visible when there's a flag involved.

Reported on meta: https://meta.discourse.org/t/users-can-edit-flagged-topic-title-when-they-should-not-be-able-to/217796
2022-02-25 11:09:31 -03:00
Osama Sayegh
770971a95e
DEV: Bump rack-mini-profiler to 3.0.0 (#16052)
This version improves the performance of Mini Profiler's snapshots page. For more details see 3e6f7e561b.
2022-02-25 14:23:52 +03:00
Dan Ungureanu
ae5eab06ad
FEATURE: Add ENV to control themes:update errors (#16051)
This commit introduces a new environment variable `RAISE_THEME_ERRORS`
that can control what happens when `theme:update` Rake task errors. It
can have three possible values: `0` to always print errors, `1` to
always raise on error, or be absent to use the default behavior which
raises errors only for default sites.
2022-02-25 11:54:42 +02:00
Krzysztof Kotlarek
3e5fb90ce6
FIX: new indirectly muted category (#16043)
When a new category is created and the parent category is muted or indirectly muted, the new category should be indirectly muted as well.
2022-02-25 13:08:22 +11:00
Sam
c71afdfdb0
FIX: avoid validations when destroying posts (#16049)
Previously email validations could fire when deleting posts if for
certain reasons any user validations fail on the user objects

This kind of condition could happen in core due to a corruption of a
user record, or via a plugin that introduces a new validation on User
2022-02-25 11:20:54 +11:00
Jeff Wong
85f1ec643d
FIX: Move selectable_avatars_mode_validator_spec to new directory (#16048)
Lib specs moved in 45cc16098d
Move the new selectable_avatars_mode_validator_spec to the new location
Remove the old selectable_avatars_enabled_validator_spec

follow-up of d1bdb6c65d
2022-02-24 13:57:26 -08:00
Jeff Wong
d1bdb6c65d
FEATURE: upload an avatar option for uploading avatars with selectable avatars (#15878)
* FEATURE: upload an avatar option for uploading avatars with selectable avatars

Allow staff or users at or above a trust level to upload avatars even when the site
has selectable avatars enabled.

Everyone can still pick from the list of avatars. The option to upload is shown
below the selectable avatar list.

refactored boolean site setting into an enum with the following values:

disabled: No selectable avatars enabled (default)
everyone: Show selectable avatars, and allow everyone to upload custom avatars
tl1: Show selectable avatars, but require tl1+ and staff to upload custom avatars
tl2: Show selectable avatars, but require tl2+ and staff to upload custom avatars
tl3: Show selectable avatars, but require tl3+ and staff to upload custom avatars
tl4: Show selectable avatars, but require tl4 and staff to upload custom avatars
staff: Show selectable avatars, but only allow staff to upload custom avatars
no_one: Show selectable avatars. No users can upload custom avatars

Co-authored-by: Régis Hanol <regis@hanol.fr>
2022-02-24 12:57:39 -08:00
Roman Rizzi
00bb5f3a9d
FIX: Use the category's text-only description in the category-chooser (#15735)
The category description is derived from a topic's cooked text and contains HTML elements. When we display it inside the category chooser in places like the composer, we don't want these elements to alter the component in any way.

Context: https://meta.discourse.org/t/some-html-tags-not-stripped-from-category-description/215017
2022-02-24 12:14:24 -03:00
Bianca Nenciu
e0b683f98e
FEATURE: Automatically select share URL (#16025)
The URL will be selected for easy copying immediately after the share
popup shows up.
2022-02-24 12:21:20 +11:00
Kris
582091a698
DEV: allow min_posts to be automatically passed (#16042) 2022-02-23 20:06:17 -05:00
Jordan Vidrine
8cb344ddde
UX: Change color functions to match original primary, tertiary functions (#16040)
* UX: Change the way new primary colors are calculated
2022-02-23 15:41:50 -06:00
Bianca Nenciu
82a9109ae3
FEATURE: Show topic visited state on search page (#15994)
The visited state used user's history instead of the data from the
server.
2022-02-23 21:24:26 +02:00
Osama Sayegh
9c1ab97c01
DEV: Ensure Mini Profiler's cookie_path is not empty or nil (#16039)
Follow-up to 9c50c69bd2.
2022-02-23 22:18:58 +03:00
Penar Musaraj
c80730ea4a
UX: Improve timeline touch hit areas (#16038) 2022-02-23 17:55:48 +01:00
Loïc Guitaut
e871865a61 FIX: Sanitize parameters provided to user actions
Currently, providing things like `filter[%24acunetix]=1` to
`UserActionsController#index` will throw an exception because instead of
getting a string as expected, we get a hash instead.

This patch simply uses `#permit` from strong parameters properly: first
we apply it on the whole parameters, this way it filters the keys we’re
interested in. By doing this, if the value is a hash for example, the
whole key/value pair will be ignored completely.
2022-02-23 15:46:40 +01:00
Jeff Wong
9c50c69bd2
FIX: dev subfolder session cookies (#16031)
rack-mini-profiler was setting a cookie path of / which was clobbering
the session cookie path of Discourse.base_path.

Fixes some issues when local dev is unable to read or write from/to
the user session, such as during omniauth CSRF checks.
2022-02-23 06:42:57 -08:00
David Taylor
cd6b7459a7
DEV: Improve background-request information in request_tracker (#16037)
This will allow consumers (e.g. the discourse-prometheus plugin) to separate topic-timings and message-bus requests. It also fixes the is_background boolean for subfolder sites.
2022-02-23 12:45:42 +00:00
Jarek Radosz
44824bfa3d
DEV: Don't check this.element in @afterRender (#16033)
This would allow to use the decorator in tag-less components and in controllers.
2022-02-23 11:35:20 +01:00
Joffrey JAFFEUX
8244b4b163
DEV: prevents warnings with EMBER_CLI being redefined (#16035)
Example error:

```
/__w/discourse/discourse/lib/tasks/assets.rake:3: warning: already initialized constant EMBER_CLI
/__w/discourse/discourse/lib/tasks/assets.rake:3: warning: previous definition of EMBER_CLI was here
```
2022-02-23 10:51:31 +01:00
Jarek Radosz
cecfc7ce79
FIX: Don't warn on empty .discourse-compatibility (#16032) 2022-02-23 09:44:37 +01:00
Osama Sayegh
586d572e05
FIX: Don't advance draft sequence when editing topic title (#16002)
This commit handles the edge case where a draft is lost with no warnings if the user edits the title (or category/tags) of a topic while they're replying.to the same topic. Repro steps are as follows:

1. Start replying to a topic and type enough to get a draft saved.
2. Scroll up to the topic title and click the pencil icon next to the topic title, change the title, category and/or tags, and then save the changes.
3. Reload the page and you'll see that the draft is gone.

This happens because we only allow 1 draft per topic per user and when you edit the title of a topic that you're replying to, from the server perspective it'll look like as if you've submitted your reply so it will advance the draft sequence for the topic and delete the draft.

The fix in this commit makes `PostRevisor` skip advancing the draft sequence when a topic's title is edited using the pencil button next to the title.

Internal ticket: t60854.

Co-authored-by: Robin Ward <robin.ward@gmail.com>
2022-02-23 10:39:54 +03:00
Osama Sayegh
799e27d15d
FIX: Respect text direction inside quotes (#16004)
Meta topic: https://meta.discourse.org/t/rtl-direction-is-broken-in-quotes/217639?u=osama.

Posts in Discourse are by default always rendered in the same direction as the rest of site, for example if the site is RTL, a post in that site is always rendered RTL even if it's made of an LTR language entirely. However, this behavior can be changed by enabling the `support mixed text direction` site setting which makes our posts rendering engine consider each "paragraph" in the post and apply an appropriate direction (using the `dir` attribute) on it based on its content/language.

I put paragraph in quotes because technically we only loop through the immediate children of the HTML element that contains the post cooked HTML and do this direction check on them. Most of the time the immediate children are actually paragraphs, but not always. The direction of an element is determined by checking its `textContent` property against a regular expression that checks all characters are RTL characters and based on the regular expression result the `dir` attribute is set on the element.

This technique doesn't work so well on quotes because they may contain multiple paragraphs which may be in different languages/directions. For example: if a site's language is Arabic (RTL language) and the `support mixed text direction` setting is enabled, regular paragraphs outside quotes are rendered as expected with the right direction depending on the paragraph's language. However, paragraphs within a quote are all (incorrectly) rendered in a single direction, LTR or RTL, regardless of whether they're of different languages/directions or not.

The reason for this is that when we're determining the direction for the quote, it's considered as one element and the direction is set on the whole quote. But for complex quotes that contain mixed paragraphs, we need to be more surgical and apply direction on individual paragraphs/elements within the quote.

This commit adds special handling for quotes to ensure that:

* the quote top bar (the avatar plus the chevron and arrow) always match the site direction
* each immediate paragraph (`<p>` elements) under `<blockquote>` in the quote gets a direction based on its content.

For before/after screenshots, see PR #16004.
2022-02-23 10:26:45 +03:00
Martin Brennan
599a72768c
DEV: Add force_quote_link option to PrettyText (#16034)
This option will make it so the [quote] bbcode will always
include the HTML link to the quoted post, even if a topic_id
is not provided in the PrettyText#cook options. This is so
[quote] bbcode can be used in other places, like chat messages,
that always need the link and do not have an "off-topic" ID
to use.
2022-02-23 16:13:46 +10:00
dependabot[bot]
59f627d9dd
Build(deps): Bump pg from 1.3.2 to 1.3.3 (#16030)
Bumps [pg](https://github.com/ged/ruby-pg) from 1.3.2 to 1.3.3.
- [Release notes](https://github.com/ged/ruby-pg/releases)
- [Changelog](https://github.com/ged/ruby-pg/blob/master/History.rdoc)
- [Commits](https://github.com/ged/ruby-pg/compare/v1.3.2...v1.3.3)

---
updated-dependencies:
- dependency-name: pg
  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>
2022-02-22 23:06:39 +01:00
tshenry
3b6da9045f
DEV: Mark discourse-automation as official (#16029) 2022-02-22 13:31:54 -08:00
Penar Musaraj
715ec0d72f
DEV: Normalize ol and ul styling (#16027) 2022-02-22 22:17:41 +01:00
David Taylor
3712c958fa
PERF: Only subscribe to /new when logged in (#16028)
The 'new' tab doesn't exist for anonymous users. Every 'new' topic also publishes a message on the `/latest` channel, so the blue banner at the top of the topic-list will still be functional
2022-02-22 19:35:59 +00:00
Ayke Halder
e4d10a1f5f
DEV: cleanup is-loading state of d-button component (#16012)
* DEV: remove duplicate code in button component template

* DEV: refactor is-loading state of d-button component

Before this change on initialisation `forceDisabled` is set `false` and then might change to `undefined` - depending on the use of the button component. This change ensures a boolean value for `forceDisabled`.

The added test works with and without the new change. The test is added as it represents the default use case for most buttons.
2022-02-22 12:40:47 -05:00
Sam
d4d3580761
PERF: perform all cached counting in background (#15991)
Previously cached counting made redis calls in main thread and performed
the flush in main thread.

This could lead to pathological states in extreme heavy load.

This refactor reduces load and cleans up the interface
2022-02-22 16:45:25 +00:00
David Taylor
98a7fa3d1a
PERF: Bump message_bus to 4.2 (#16026)
This includes upstream performance improvements. For details, see 1baa1ea4a5
2022-02-22 16:16:02 +00:00
David Taylor
f6c852bf8e
PERF: Use a shared message for replies to tracked topics (#16022)
Previously we were publishing one messagebus message per user which was 'tracking' a topic. On large sites, this can easily be 1000+ messages. The important information in the message is common between all users, so we can manage with a single message on a shared channel, which will be much more efficient.

For user-specific values (notification_level and last_read_post_number), the JS app can infer values which are 'good enough'. Correct values will be loaded as soon as a topic-list containing the topic is visited.
2022-02-22 15:27:46 +00:00
Discourse Translator Bot
50da1375ca
Update translations (#16024) 2022-02-22 14:20:23 +01:00
Ayke Halder
e392fc56fa
DEV: refactor components to use discourse-computed decorator without reference to this (#16011)
Most computed properties are already implemented this way. These changes make the missing ones also use it.
2022-02-22 13:45:38 +01:00
dependabot[bot]
895dfd6714
Build(deps): Bump nokogiri from 1.13.1 to 1.13.3 (#16023)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.1 to 1.13.3.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/v1.13.3/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.1...v1.13.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>
2022-02-22 13:43:17 +01:00
dependabot[bot]
2bb729c589
Build(deps): Bump rubocop-ast from 1.15.2 to 1.16.0 (#16020)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.15.2 to 1.16.0.
- [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.15.2...v1.16.0)

---
updated-dependencies:
- dependency-name: rubocop-ast
  dependency-type: indirect
  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>
2022-02-22 13:06:15 +01:00
Joffrey JAFFEUX
f5ec32bc8c
FEATURE: adds the user_promoted event to webhooks (#15996) 2022-02-22 10:57:18 +01:00
dependabot[bot]
316206a991
Build(deps): Bump parser from 3.1.0.0 to 3.1.1.0 (#16018)
Bumps [parser](https://github.com/whitequark/parser) from 3.1.0.0 to 3.1.1.0.
- [Release notes](https://github.com/whitequark/parser/releases)
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.1.0.0...v3.1.1.0)

---
updated-dependencies:
- dependency-name: parser
  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>
2022-02-22 14:47:45 +11:00
Martin Brennan
fa0c796baf
DEV: Fix SMTP bounce regexp (#16019)
Never trust me with regexp. Follow up to
01ef1d08fc,
which did not take into account codes in
the format X.X.XX (with the 2 digits on the end)
2022-02-22 08:54:01 +10:00
Dan Ungureanu
685d186351
FIX: Show invite button if users can be invited (#16014)
This used to be shown regardless new users could be invited to the
forum.
2022-02-21 23:57:17 +02:00
Bianca Nenciu
90c3695ab0
FEATURE: Rename Reset Read bulk action to Defer (#15972)
It is enabled only if defer is enabled in user options too and if the
button shows up in the topic's footer.
2022-02-21 22:45:01 +02:00
Bianca Nenciu
94883dd326
FIX: Show links with 0 clicks in top links section (#16016)
This is useful to moderators to see if users post spam links.
2022-02-21 22:15:38 +02:00
Bianca Nenciu
ae1d2d957f
FEATURE: Replace share post popup with share modal (#15875)
This uniformizes the topic share modal and the post link popup. It also
introduces a new feature which can notify the user of a post.
2022-02-21 22:14:28 +02:00
Rafael dos Santos Silva
5c9ca07119
FEATURE: Disable indexing of non-canonical pages by default (#16015)
Enables the setting introduced in 5647819 by default, as early results
show improvement in websites crawl budget.
2022-02-21 16:16:22 -03:00