Commit Graph

45312 Commits

Author SHA1 Message Date
Sam
7b4e338c0e
FIX: fallback to default push notification icon if none exists (#16961)
Due to some changes we started notifying via push notifications on other
families of notifications. There are a total of about 30 or so possible
notification you could get, some can be pushed.

This fallback means that if for any reason we are unable to find an icon
for a push notification we just fallback to the Discourse logo.

Also go with a simple reply icon for watching first post.

Note, that in production `image_url` can return an exception if an image is
missing. This is not the case in test / development.
2022-06-01 12:00:05 +10:00
Sam
bc8f651501
FIX: do not looks for plugin test js in production (#16962)
Previous to this fix, in production we were getting 500 errors from
bootstrap.json cause script_asset_path can not find plugin-tests

Opted for the simplest fix that is omitting the files in production
2022-06-01 10:49:53 +10:00
Jean
9ac85d6163
DEV: add request data to the before_session_destroy event (#16905) 2022-05-31 18:18:56 -04:00
Discourse Translator Bot
41fa278c00
Update translations (#16958) 2022-05-31 16:14:37 +02:00
Jarek Radosz
4f423fa548
PERF: Improve to-markdown speed, update the code (#16939)
## `to-markdown` function performance improvement

### Small example

```html
<span>test</span>
```

Before: 63 `Tag` objects created; 4,090 ops/sec ±2.77%
After: 1 `Tag` object created; 151,707 ops/sec ±2.64%

### Large example

```html
<div>
  <p>lorem <b>ipsum</b></p>
  <p>lorem <b>ipsum</b></p>
  <p>lorem <b>ipsum</b></p>
  <p>lorem <b>ipsum</b></p>
  <p>lorem <b>ipsum</b></p>

  <aside class="quote no-group">
    <blockquote>
      <aside class="quote no-group">
        <blockquote>
          <p dir="ltr">test</p>
        </blockquote>
      </aside>
      <p dir="ltr">test2</p>
    </blockquote>
  </aside>

  <div>
    <p><span>test</span> <span>test</span> <span>test</span></p>
    <p><span>test</span> <span>test</span> <span>test</span></p>
    <p><span>test</span> <span>test</span> <span>test</span></p>
    <p><span>test</span> <span>test</span> <span>test</span></p>
    <p><span>test</span> <span>test</span> <span>test</span></p>
  </div>
</div>
```

Before: 2394 `Tag` objects created; 179 ops/sec ±2.35%
After: 38 `Tag` objects created; 4,346 ops/sec ±2.62%

### Note

discourse-spoiler-alert ~~needs~~ (needed) to be updated as it modifies to-markdown code.

### Included commits

* DEV: Minor code transforms
* PERF: Don't create unnecessary Tag instances
* DEV: Remove a now obsolete constructor argument
* DEV: Rename constant
* DEV: Use built-in functions, string interpolation
* DEV: De-jQuerify
2022-05-31 13:17:08 +02:00
Jarek Radosz
711cd7c85d
DEV: Add to-markdown decorator functions (#16943)
To be used in discourse-spoiler-alert
2022-05-31 11:06:41 +02:00
Chapoi
69bab5e5a0
UX: update chat menu popover styling (#16955) 2022-05-31 09:51:50 +02:00
Sam
020c77440e
FEATURE: allow for overlapping DiscourseConnect secrets per domain (#16915)
Previously we limited Discourse Connect provider to 1 secret per domain.

This made it pretty awkward to cycle secrets in environments where config
takes time to propagate

This change allows for the same domain to have multiple secrets

Also fixes internal implementation on DiscourseConnectProvider which was
not thread safe as it leaned on class variables to ferry data around

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
Co-authored-by: David Taylor <david@taylorhq.com>
2022-05-31 15:24:04 +10:00
Alan Guo Xiang Tan
30bd1dcefd
DEV: More efficiently trigger topic tracking state on state change (#16952)
* When loading topics in bulk, only trigger state change callbacks after
all the topics have been loaded and we determine that state has actually
changed.

* State change callbacks are also only triggered when state has changed.

The use of JSON.stringify might raise some performance concerns here as this is a
performance sensitive codepath. However, I measured the time for each
`_setState` function call locally, by wrapping the function call with
`performance.now()`, and did not see any significant overhead.
2022-05-31 10:20:55 +08:00
dependabot[bot]
b9e230e7fa
Build(deps): Bump bootsnap from 1.11.1 to 1.12.0 (#16956)
Bumps [bootsnap](https://github.com/Shopify/bootsnap) from 1.11.1 to 1.12.0.
- [Release notes](https://github.com/Shopify/bootsnap/releases)
- [Changelog](https://github.com/Shopify/bootsnap/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Shopify/bootsnap/compare/v1.11.1...v1.12.0)

---
updated-dependencies:
- dependency-name: bootsnap
  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>
2022-05-31 10:20:33 +08:00
Andrei Prigorshnev
c5c9b2eced
DEV: do not trigger the user-status:changed event twice (#16954) 2022-05-30 19:23:21 +04:00
David Taylor
38324da6db
DEV: Add event for plugins to customize system messages (#16953) 2022-05-30 14:01:21 +01:00
Andrei Prigorshnev
943cae82da
FEATURE: propagate user status via message bus (#16944) 2022-05-30 13:41:53 +04:00
Andrei Prigorshnev
46302f0d40
DEV: Avoid unnecessary sendWidgetAction function call (#16941) 2022-05-30 13:06:51 +04:00
dependabot[bot]
9931914203
Build(deps): Bump rack from 2.2.3 to 2.2.3.1 (#16948)
Bumps [rack](https://github.com/rack/rack) from 2.2.3 to 2.2.3.1.
- [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.3...2.2.3.1)

---
updated-dependencies:
- dependency-name: rack
  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-05-30 12:13:06 +10:00
Martin Brennan
662c713347
FEATURE: Highlight None option by default for bookmarks (#16949)
Since the default for the bookmark modal is to have no
reminder if you create a bookmark by clicking out of
the modal or pressing the Save button, this commit highlights
None by default.

Also changes the bookmark component to not use @on for Ember
lifecycle, we don't use that style
2022-05-30 11:56:06 +10:00
dependabot[bot]
6ad6e1223d
Build(deps): Bump regexp_parser from 2.4.0 to 2.5.0 (#16945)
Bumps [regexp_parser](https://github.com/ammar/regexp_parser) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/ammar/regexp_parser/releases)
- [Changelog](https://github.com/ammar/regexp_parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ammar/regexp_parser/compare/v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: regexp_parser
  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-05-30 09:44:20 +08:00
dependabot[bot]
7a860f8f63
Build(deps-dev): Bump parallel_tests from 3.10.1 to 3.11.0 (#16946)
Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.10.1 to 3.11.0.
- [Release notes](https://github.com/grosser/parallel_tests/releases)
- [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md)
- [Commits](https://github.com/grosser/parallel_tests/compare/v3.10.1...v3.11.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>
2022-05-30 09:43:32 +08:00
dependabot[bot]
eb1ad8b5cf
Build(deps): Bump msgpack from 1.5.1 to 1.5.2 (#16947)
Bumps [msgpack](https://github.com/msgpack/msgpack-ruby) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/msgpack/msgpack-ruby/releases)
- [Changelog](https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog)
- [Commits](https://github.com/msgpack/msgpack-ruby/compare/v1.5.1...v1.5.2)

---
updated-dependencies:
- dependency-name: msgpack
  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-05-30 09:43:15 +08:00
Martin Brennan
e8ca927b12
FIX: Add bookmark quick access tests and fix username (#16934)
The commit fcc2e7ebbf to promote
polymorphic bookmarks did not correctly set the username for
the quick access bookmark menu based on the new serializer
values, so the username is not being shown in the bookmark
quick access menu. This commit fixes it, and also adds additional
tests for that menu and updates the user fixtures to reflect
the current state of the bookmarks endpoint.
2022-05-30 10:00:05 +10:00
Jarek Radosz
d065ec0f7b
FIX: Correctly handle nested quotes in to-markdown (#16938)
Given this html:

```
<aside class="quote no-group">
  <blockquote>
    <aside class="quote no-group">
      <blockquote>
        <p dir="ltr">test</p>
      </blockquote>
    </aside>
    <p dir="ltr">test2</p>
  </blockquote>
</aside>
```

The result was an invalid markdown:

```
[quote]
[quote]
> test
> [/quote]
>
>
>
> test2
[/quote]
```

Now the result is:

```
[quote]
[quote]
test
[/quote]

test2
[/quote]
```
2022-05-27 22:05:43 +02:00
dependabot[bot]
16bb0beefd
Build(deps): Bump unf_ext from 0.0.8.1 to 0.0.8.2 (#16929) 2022-05-27 17:34:44 +02:00
Andrei Prigorshnev
25e4095c9c
FIX: respect user timezone in emails about silencing and suspending (#16918) 2022-05-27 13:58:54 +04:00
Joffrey JAFFEUX
0c590963c3
FIX: changing date should recompute input (#16937)
This also fixes the time part being lost when changing the date.
2022-05-27 11:57:09 +02:00
David Taylor
80bd971420
UX: Show message if rebake fails (#16925)
Previously, errors would only be displayed in the developer console.
2022-05-27 10:39:29 +01:00
David Taylor
8fe3934856
UX: Make YouTube playlist onebox full width to match video onebox (#16936) 2022-05-27 10:39:12 +01:00
Andrei Prigorshnev
5c596273a0
FEATURE: user status (#16875) 2022-05-27 13:15:14 +04:00
Martin Brennan
ac59168dde
FIX: Incorrect URL for bookmark quick action menu (#16932)
The bookmarkable_type instead of the bookmarkable_url
was being used for the link to the bookmark for the quick
access menu, leading to links like /ChatMessage. This
fixes the issue, follow up PR with tests for the quick
access menu to follow.
2022-05-27 14:33:24 +10:00
dependabot[bot]
d001093f83
Build(deps): Bump rubocop from 1.29.1 to 1.30.0 (#16930)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.29.1 to 1.30.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.29.1...v1.30.0)

---
updated-dependencies:
- dependency-name: rubocop
  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-05-27 11:19:15 +08:00
Martin Brennan
5ebad3be0a
FIX: Further refine duplicate bookmark delete query (#16931)
In f00e282067 we added this
DELETE query to delete duplicate for_topic bookmarks, we
just need this further refinement to the WHERE clause to
avoid deleting post bookmarks.
2022-05-27 08:22:23 +10:00
Sérgio Saquetim
3222078e6e
UX: Reordered topics in INSTALL-cloud.md to add a 'Before you start' section (#16919)
* UX: Reordered topics in INSTALL-cloud.md to add a 'Before you start' section

* Change 'Installing Discourse' to 'Installation'
2022-05-26 14:17:32 -03:00
Daniel Waterworth
f00e282067
FIX: Delete extraneous topic bookmarks (#16926)
Otherwise the migration can fail

Co-authored-by: David Taylor <david@taylorhq.com>
2022-05-26 11:58:15 -05:00
David Taylor
95e7e10417
DEV: Fix paths for narrative bot jobs (#16924)
These incorrect paths were causing the regular jobs to be loaded in a `Jobs::Jobs` module in development mode, which would cause various weird issues.

https://meta.discourse.org/t/228155
2022-05-26 13:19:55 +01:00
David Taylor
b850c12793
PERF: Lazily lookup emoji-picker selected-diversity (#16917)
Looking up values from the `emojiStore` calls out to the browser's localStorage API and then decodes a JSON blob. This makes it relatively slow.

Previously we were doing this lookup in the emoji-picker's `init()` function, even if `isActive` was false. If many inactive emoji pickers are rendered simultaneously (e.g. for discourse-chat reactions), this performance hit quickly adds up.

This commit updates the service to notify about changes, and uses a computed property to provide a cached value in the emoji-picker.
2022-05-26 12:37:09 +01:00
Michael Fitz-Payne
aabbc9e63e DOC(cache_critical_dns): add program description
Describes the behaviour and configuration of the cache_critical_dns
script, mainly cribbed from commit messages. Tries to make this program
a bit less of an enigma.
2022-05-26 14:26:57 +10:00
Martin Brennan
61b9e3ee30
FIX: InlineOneboxer watched word censor error (#16921)
In 7328a2bfb0 we changed the
InlineOneboxer#onebox_for method to run the title of the
onebox through WatchedWord#censor_text. However, it is
allowable for the title to be nil, which was causing this
error in production:

> NoMethodError : undefined method gsub for nil:NilClass

We just need to check whether the title is nil before trying
to censor it.
2022-05-26 14:01:44 +10:00
Alan Guo Xiang Tan
037436047d
DEV: Allow a simplier way to register a link under sidebar topics section (#16916) 2022-05-26 09:01:37 +08:00
Martin Brennan
641c4e0b7a
FEATURE: Make S3 presigned GET URL expiry configurable (#16912)
Previously we hardcoded the DOWNLOAD_URL_EXPIRES_AFTER_SECONDS const
inside S3Helper to be 5 minutes (300 seconds). For various reasons,
some hosted sites may need this to be longer for other integrations.

The maximum expiry time for presigned URLs is 1 week (which is
604800 seconds), so that has been added as a validation on the
setting as well. The setting is hidden because 99% of the time
it should not be changed.
2022-05-26 09:53:01 +10:00
dependabot[bot]
08cd7a3849
Build(deps): Bump timeout from 0.2.0 to 0.3.0 (#16920)
Bumps [timeout](https://github.com/ruby/timeout) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/ruby/timeout/releases)
- [Commits](https://github.com/ruby/timeout/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: timeout
  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-05-26 00:35:03 +02:00
Sérgio Saquetim
102e3a8cf2
DEV: Add hook for plugins modify how slugs are computed (#16907)
Allows plugins to hook into and change how topic slugs are computed.
2022-05-25 19:05:06 -03:00
Bianca Nenciu
7328a2bfb0
FIX: Apply censored words to inline onebox (#16873)
Censored watched words were not censored inside the title of an inline
oneboxes. Malicious users could exploit this behaviour to insert bad
words. The same issue has been fixed for regular Oneboxes in commit
d184fe59ca.
2022-05-25 14:51:47 +03:00
dependabot[bot]
6268fe7495
Build(deps-dev): Bump parallel_tests from 3.10.0 to 3.10.1 (#16906)
Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.10.0 to 3.10.1.
- [Release notes](https://github.com/grosser/parallel_tests/releases)
- [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md)
- [Commits](https://github.com/grosser/parallel_tests/compare/v3.10.0...v3.10.1)

---
updated-dependencies:
- dependency-name: parallel_tests
  dependency-type: direct:development
  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-05-25 12:29:31 +02:00
dependabot[bot]
becdd393fa
Build(deps): Bump jquery-rails from 4.4.0 to 4.5.0 (#16896)
Bumps [jquery-rails](https://github.com/rails/jquery-rails) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/rails/jquery-rails/releases)
- [Changelog](https://github.com/rails/jquery-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/jquery-rails/compare/v4.4.0...v4.5.0)

---
updated-dependencies:
- dependency-name: jquery-rails
  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-05-25 12:29:10 +02:00
Alan Guo Xiang Tan
f589d05cf9
DEV: Plugin API for plugins to add links to sidebar topics section (#16732) 2022-05-25 15:54:32 +08:00
Alan Guo Xiang Tan
072faa08bb DEV: Reenable wizard test after fixing auto start for wizard qunit tests
`run-qunit.js` does not expect QUnit tests to start automatically but
our wizard QUnit setup did not respect the `qunit_disable_auto_start`
URL param. Hence, tests would start running automatically and when a
subsequent `QUnit.start()` function call is made, we ended up getting a
`QUnit.start cannot be called inside a test context.` error.

This error can be consistently reproduced in the `discourse:discourse_test` container but not in
the local development environment. I do not know why and did not feel
like it is important at this point in time to know why.
2022-05-25 15:12:27 +08:00
Alan Guo Xiang Tan
05212f6cc3 DEV: Skip wizard tests while we investigate why it fails on CI 2022-05-25 13:48:09 +08:00
Alan Guo Xiang Tan
8471eabf62 DEV: Add env to skip wizard tests 2022-05-25 13:48:09 +08:00
Penar Musaraj
ebdfc536dd
Revert "FEATURE: Include participants in PN search data (#16855)" (#16904)
This reverts commit 71c74a262d.
2022-05-25 15:08:36 +10:00
Alan Guo Xiang Tan
0b8177de54
DEV: Remove unnecessary logic in TopicTrackingState on the client side (#16900)
There is no need for the extra protection on the client side if there is
a bug on the server side. In fact, we want the bug to be surfaced so
that it can be fixed on the server side.
2022-05-25 11:28:57 +08:00
Martin Brennan
0d16d77401
DEV: Allow for null bookmark in bookmark-icon (#16909)
Sometimes we need to render the icon as a call to action
to create a bookmark at which point the bookmark does
not yet exist, so we need to just show the normal bookmark
icon and a create title.

Also adds a CSS class for the bookmark existing and not existing
for styling.
2022-05-25 13:22:59 +10:00