Commit Graph

43263 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan
fb5a062b1f
DEV: Remove TopicView#first_post_id. (#14631)
The method was only used for mega topics but it was redundant as the
first post can be determined from using the condition where
`Post#post_number` equal to one.
2021-10-18 14:47:47 +08:00
Martin Brennan
b69c2f7311
DEV: Fix wasm_bindgen double loading errors in Firefox (#14630)
When we are calling the loadLibs function, which in turn calls:

importScripts(settings.mozjpeg_script);
importScripts(settings.resize_script);

For the media-optimization-worker service worker, we are getting
an error in Firefox, which balks at wasm_bindgen, a global
variable defined with let, being redefined when the module loads.
This causes image processing to fail in Firefox when more than one
image is uploaded at a time.

The solution to this is to just check whether the scripts are
already imported, and if so do not import them again.

Chrome doesn't seem to care about this variable redefinition
and does not error, and it seems to be expected behaviour that
the script can be loaded multiple times (see https://github.com/w3c/ServiceWorker/issues/1041)
2021-10-18 15:47:50 +10:00
Martin Brennan
ca7fd77a94
DEV: Bump uppy module versions for retryable prepareUploadParts (#14629)
This commit bumps the following uppy modules:

* @uppy/aws-s3
* @uppy/aws-s3-multipart
* @uppy/core
* @uppy/drop-target
* @uppy/xhr-upload

This is done so we can use the new functionality for retrying
failed prepareUploadParts calls, introduced in
e435f4a917.

I also needed to make some changes to composer-upload-uppy to
support this retrying, while at the same time being able to
throw a bootbox with the error message if the number of retries
are exceeded.
2021-10-18 15:28:27 +10:00
Alan Guo Xiang Tan
235d069300
DEV: Reduce an additional DB query in TopicView for ignored users. (#14619)
`TopicView#first_post_id` does a pluck which we can avoid because the
first post will always have a `Post#post_number` of 1.
2021-10-18 09:58:13 +08:00
dependabot[bot]
779eeb65b3
Build(deps): Bump redis from 4.4.0 to 4.5.1 (#14627)
Bumps [redis](https://github.com/redis/redis-rb) from 4.4.0 to 4.5.1.
- [Release notes](https://github.com/redis/redis-rb/releases)
- [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/redis-rb/compare/v4.4.0...v4.5.1)

---
updated-dependencies:
- dependency-name: redis
  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>
2021-10-18 09:57:23 +08:00
dependabot[bot]
b11b8f001c
Build(deps): Bump openssl from 2.2.0 to 2.2.1 (#14628)
Bumps [openssl](https://github.com/ruby/openssl) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/ruby/openssl/releases)
- [Changelog](https://github.com/ruby/openssl/blob/master/History.md)
- [Commits](https://github.com/ruby/openssl/compare/v2.2.0...v2.2.1)

---
updated-dependencies:
- dependency-name: openssl
  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>
2021-10-18 09:57:00 +08:00
Qursch
11763a5e8d
FEATURE: Add reversed and type to allowed attributes (#14626) 2021-10-18 12:11:13 +11:00
Penar Musaraj
7c7dd2335b
FIX: Category and tag picker alignment on mobile (#14622) 2021-10-15 10:25:11 -04:00
Mark VanLandingham
69381663eb
REVERT: "DEV: APIs to disable PWA badging and unsubscribe from user notifications (#14595)" (#14620)
This reverts commit e1d3175668.
2021-10-15 08:45:55 -05:00
dependabot[bot]
2427ea6613
Build(deps): Bump json from 2.5.1 to 2.6.0 (#14612)
Bumps [json](https://github.com/flori/json) from 2.5.1 to 2.6.0.
- [Release notes](https://github.com/flori/json/releases)
- [Commits](https://github.com/flori/json/commits)

---
updated-dependencies:
- dependency-name: json
  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>
2021-10-15 09:51:13 +02:00
Alan Guo Xiang Tan
baae453012
DEV: Remove useless assignment in TopicView#filter_posts_paged. (#14618)
Assignment is already done in `TopicView#filter_posts_by_ids`
2021-10-15 15:49:22 +08:00
Rafael dos Santos Silva
6ad76520b8
FEATURE: Cache CORS preflight for MessageBus (#14616)
* FEATURE: Cache CORS preflight for MessageBus

Followup for b301a6b for MessageBus
2021-10-15 00:23:53 -03:00
Alan Guo Xiang Tan
c34c24ffe4
DEV: Remove unused code from TopicView. (#14605) 2021-10-15 10:23:13 +08:00
Alan Guo Xiang Tan
316e4daa19
DEV: Refactor TopicView#filter_posts for readability. (#14606) 2021-10-15 10:22:49 +08:00
Rafael dos Santos Silva
b301a6b3db
FEATURE: Cache CORS preflight requests for 2h (#14614)
* FEATURE: Cache CORS preflight requests for 2h

Browsers will cache this for 5 seconds by default. If using MessageBus
in a different domain, Discourse will issue a new long polling, by
default, every 30s or so. This means we would be issuing a new preflight
request **every time**. This can be incredibly wasteful, so let's cache
the authorization in the client for 2h, which is the maximum Chromium
allows us as of today.

* fix tests
2021-10-14 22:37:53 -03:00
Krzysztof Kotlarek
7c7e03e54b
FIX: correct api version after minor bump (#14615) 2021-10-15 09:21:51 +08:00
Krzysztof Kotlarek
2e09dc8885
FEATURE: add downloadCalendar to plugin api (#14603)
New download calendar feature should be exposed via api
2021-10-15 09:14:35 +11:00
Gerhard Schlager
a85c876dbe
DEV: Remove warnings on console (#14608)
We don't use oxipng from the image_optim gem and rake tasks complained that constants have already been initialized.
2021-10-14 23:17:47 +02:00
Penar Musaraj
2a7280ac48
FIX: Improve quick search speed and result highlights (#14610) 2021-10-14 15:24:11 -04:00
Mark VanLandingham
9b835e1003
DEV: Allow register options to be passed to registerServiceWorker (#14609) 2021-10-14 10:41:28 -05:00
David Taylor
567c470361
FIX: Allow staff to view pending/expired invites of other users (#14602)
`/u/username/invited.json?filter=expired` and `/u/username/invited.json?filter=pending` APIs are already returning data to admins. However, the `can_see_invite_details?` boolean was false, which prevented the Ember frontend from showing the tabs correctly. This commit updates the guardian method to match reality.
2021-10-14 15:57:01 +01:00
Joffrey JAFFEUX
d76d418e5d
FIX: also track textContent mutations (#14607)
Tracking innerHTML was not enough to catch every mutations.
2021-10-14 12:14:48 +02:00
Osama Sayegh
7f3468e7d5
FIX: Decorate posts that are loaded after the initial render in post stream (#14600)
To clarify, this problem is not about the topic posts stream, it's about posts streams like the user Activity one in the profile page (or in technical terms anything using the `{{user-stream}}` component).

Post decorations are currently applied inside a `didInsertElement` hook of the `{{user-stream}}` component. However, when the user scrolls the component will load more posts but these will be missing decorations because the `didInsertElement` is only fired once at the beginning of the component lifecycle.

This PR makes the component keep track of the last decorated post/DOM node, and when new posts are loaded the component fire an event for each new post and pass the post's DOM node with the event. Our plugin API 

(I noticed this problem when I was working on https://github.com/discourse/discourse-follow/pull/37)

Co-authored-by: Robin Ward <robin.ward@gmail.com>
2021-10-14 08:10:13 +03:00
dependabot[bot]
82945a3d21
Build(deps): Bump puma from 5.5.1 to 5.5.2 (#14601)
Bumps [puma](https://github.com/puma/puma) from 5.5.1 to 5.5.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/v5.5.1...v5.5.2)

---
updated-dependencies:
- dependency-name: puma
  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>
2021-10-14 09:43:20 +08:00
Krzysztof Kotlarek
9062fd9b7a
FIX: improvements for download local dates (#14588)
* FIX: do not display add to calendar for past dates

There is no value in saving past dates into calendar

* FIX: remove postId and move ICS to frontend

PostId is not necessary and will make the solution more generic for dates which doesn't belong to a specific post.

Also, ICS file can be generated in JavaScript to avoid calling backend.
2021-10-14 09:22:44 +11:00
David Taylor
ae0ca39bd1
FIX: Ensure embedded replies/reply-to links open in _blank (#14597)
In most cases, these links are handled in JavaScript, so the `href` and `target` are not used. However, when the `link-to-post` refers to a post which is not currently loaded in the DOM (e.g. it is the OP), then the href is used, and we need to add a `target` to prevent page navigation within the embed iframe.
2021-10-13 21:34:30 +01:00
Penar Musaraj
0616a5ac7c
UX: Better visibility for context search (#14599) 2021-10-13 15:52:17 -04:00
Mark VanLandingham
8b25aaed14
DEV: Export register service worker logic (#14598) 2021-10-13 13:19:20 -05:00
Gerhard Schlager
9ab9eda40e
PERF: Reduce work when external sources are allowed in InlineUploads (#14594)
It also fixes a bug in `match_bbcode_img()` which didn't check `block_given?` for all conditions.
2021-10-13 18:59:05 +02:00
Mark VanLandingham
e1d3175668
DEV: APIs to disable PWA badging and unsubscribe from user notifications (#14595) 2021-10-13 11:47:30 -05:00
David Taylor
bc68da24cd
DEV: Fix presence testing in legacy ember environment (#14596)
The legacy testing environment will remove the User.current() value before disposing of controllers/components. Presence often involves making HTTP calls during disposal of components, so this can cause issues.

Production, and the modern Ember-CLI environment, do not require this hack, so it is behind an `isTesting() && isLegacyEmber()` check.
2021-10-13 17:24:19 +01:00
Penar Musaraj
74706bab10
UX: Add Enter hint to search dropdown (#14587) 2021-10-13 12:09:28 -04:00
Penar Musaraj
a3fde50b62
A11Y: Don't output aria label identical to title (#14586) 2021-10-13 11:19:38 -04:00
Joffrey JAFFEUX
11bd3438c4
FIX: groups using users icon were lacking margin in search (#14591) 2021-10-13 12:38:35 +02:00
Bianca Nenciu
c4843fc1c1
FEATURE: Allow admins to permanently delete posts and topics (#14406)
Sometimes administrators want to permanently delete posts and topics
from the database. To make sure that this is done for a good reasons,
administrators can do this only after one minute has passed since the
post was deleted or immediately if another administrator does it.
2021-10-13 12:53:23 +03:00
Gerhard Schlager
76c9de2d04
UX: Add missing translation (#14592) 2021-10-13 11:23:53 +02:00
Joffrey JAFFEUX
b59c419253
FIX: attempts to observe preview mutation asap (#14590) 2021-10-13 09:28:55 +02:00
Joffrey JAFFEUX
00e8baffa2
FIX: attempts to enforce caret position in filter (#14589) 2021-10-13 08:19:34 +02:00
Penar Musaraj
308823a253
FIX: Use absolute URLs in search shortcut (#14585) 2021-10-13 10:14:45 +05:30
Alan Guo Xiang Tan
e3c724f79f
PERF: Use a subquery when excluding a tag from topic query. (#14577)
When a tag with alot of topics is used, we end up allocating a Ruby
array of all the topic ids. Instead, we can just use a subquery here and
handle all of the exclusion logic in PG.

Follow-up to ae13839f98
2021-10-13 09:20:56 +11:00
dependabot[bot]
5ffb810c68 Build(deps): Bump puma from 5.5.0 to 5.5.1
Bumps [puma](https://github.com/puma/puma) from 5.5.0 to 5.5.1.
- [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/v5.5.0...v5.5.1)

---
updated-dependencies:
- dependency-name: puma
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-12 17:29:12 -04:00
Yasuo Honda
9a083a550c FIX: BackupRestore::DatabaseRestorer failures with Ruby 3
Implemented workaround suggested at
https://github.com/freerange/mocha/issues/445#issuecomment-644944003
2021-10-12 17:25:51 -04:00
Vinoth Kannan
1b99f99ff7
UX: remove aria-label for buttons when title attribute exists. (#14529)
Both `aria-label` and `title` have the same value and NVDA reading both the texts while navigating between buttons. NVDA already has an open issue https://github.com/nvaccess/nvda/issues/7841. We're removing `aria-label` until they fix it.
2021-10-12 23:55:59 +05:30
David Taylor
100095af50
UX: Improve route hierarchy in for user-invites (#14583)
Previously the sidebar was being rendered in the `-show` routes, which meant that it disappeared and re-appeared when each tab was loading. This commit creates a parent `user-invited` route with the sidebar, and then renders the `-show` view in an outlet.

To avoid an extra HTTP request, the invite counts for the sidebar are fetched by the `-show` routes, and then applied to the parent controller. This means that there can be a very slight delay before the counts are displayed, but it is almost unnoticeable in normal use.
2021-10-12 17:39:47 +01:00
Joffrey JAFFEUX
be7dcf694e
DEV: correct argument names for addGlobalNotice (#14582) 2021-10-12 17:01:54 +02:00
Osama Sayegh
228264d17c
Revert "DEV: add routes_lazy_route to boost boot-up time (#14545)" (#14581)
This reverts commit f5cf647e57.

The gem breaks usage of Rails URL helpers when used outside views and
controllers, for example in
88ecb83382/app/models/upload.rb (L239-L242)
the `upload_short_path` method call fails with an undefined method
exception when this gem is enabled.
2021-10-12 17:30:38 +03:00
Arpit Jalan
d2f9108470
FIX: show group filter only when user is logged in and groups are present (#14578) 2021-10-12 19:46:39 +05:30
Discourse Translator Bot
b44119cdb2
Update translations (#14579) 2021-10-12 16:00:22 +02:00
Penar Musaraj
915c93625a
DEV: Add pluginApi support for quick search tips (#14556) 2021-10-12 09:54:00 -04:00
Andrei Prigorshnev
88ecb83382
FEATURE: stop using email as source for username and name suggestions for Single Sign On (#14541)
We don't want to be using emails as source for username and name suggestions in cases when it's possible that a user have no chance to intervene and correct a suggested username. It risks exposing email addresses.
2021-10-12 17:25:54 +04:00