Commit Graph

43473 Commits

Author SHA1 Message Date
2364626ded FEATURE: Change all core to use uppy-image-uploader (#14428)
Instead of using image-uploader, which relies on the old
UploadMixin, we can now use the uppy-image-uploader which
uses the new UppyUploadMixin which is stable enough and
supports both regular XHR uploads and direct S3 uploads,
controlled by a site setting (default to XHR).

At some point it may make sense to rename uppy-image-uploader
back to image-uploader, once we have gone through plugins
etc. and given a bit of deprecation time period.

This commit also fixes `for_private_message`, `for_site_setting`,
and `pasted` flags not being sent via uppy uploads onto the
UploadCreator, both via regular XHR uploads and also through
external/multipart uploads.

The uploaders changed are:

* site setting images
* badge images
* category logo
* category background
* group flair
* profile background
* profile card background
2021-10-19 13:25:42 +10:00
92afa74d92 Mark shared-edits plugin as official (#14639) 2021-10-19 10:38:06 +08:00
903a9e1c0d DEV: Centralize logic for applying order to filtered posts. (#14634)
Instead of leaking ordering of the posts all around the class, we
centralize it in a method making the code easier to understand. In a
future PR, we will also introduce a plugin API to allow custom ordering
and the change in this commit helps to faciliate that.
2021-10-19 10:37:46 +08:00
1d131fcaff FIX: Clarify None Needed option when editing bookmarks (#14633)
This commit makes the following change to the Edit Bookmark
modal window for clarity:

* If the user is editing an existing bookmark without a reminder set,
hide the "none needed" option. This will draw more attention to the
delete button.
* If the user is editing an existing bookmark with a reminder set for the
future, change the "none needed" option to say "remove reminder, keep bookmark"

To do this, I needed to provide an option to override the labels
for time shortcuts in certain cases, so I could keep the NONE shortcut
but have the different wording.
2021-10-19 10:32:20 +10:00
560216b6a1 UX: Adjust quick search input width (#14640)
Ensures input takes up all available space (without contents overlapping icons).
2021-10-18 17:01:08 -07:00
919a9a902a FIX: Hide full screen toggle button when textarea is disabled (#14638) 2021-10-18 16:00:22 -04:00
073e5ccd83 UX: Better topic search experience (#14625) 2021-10-18 13:17:27 -04:00
7a4a1744a2 UX: Show fewer toolbar icons in mobile composer (#14621) 2021-10-18 10:16:10 -04:00
70634198a4 UX: Display full-page user search in a grid (#14636)
Two reasons for this change:
1. Better utilization of the screen space (i.e. displaying more than 5 entries on a 13" display)
2. Making user link elements smaller fixes user-card positioning (it no longer displays far to the right, away from the user name/avatar)
2021-10-18 15:36:30 +02:00
6275658e3d FEATURE: Add setting to disable notifications for topic category edits (#14632) 2021-10-18 09:04:01 -04:00
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
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
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
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
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
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
11763a5e8d FEATURE: Add reversed and type to allowed attributes (#14626) 2021-10-18 12:11:13 +11:00
7c7dd2335b FIX: Category and tag picker alignment on mobile (#14622) 2021-10-15 10:25:11 -04:00
69381663eb REVERT: "DEV: APIs to disable PWA badging and unsubscribe from user notifications (#14595)" (#14620)
This reverts commit e1d317566827bab78a1a34da8172834e31f5b7c1.
2021-10-15 08:45:55 -05:00
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
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
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
c34c24ffe4 DEV: Remove unused code from TopicView. (#14605) 2021-10-15 10:23:13 +08:00
316e4daa19 DEV: Refactor TopicView#filter_posts for readability. (#14606) 2021-10-15 10:22:49 +08:00
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
7c7e03e54b FIX: correct api version after minor bump (#14615) 2021-10-15 09:21:51 +08:00
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
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
2a7280ac48 FIX: Improve quick search speed and result highlights (#14610) 2021-10-14 15:24:11 -04:00
9b835e1003 DEV: Allow register options to be passed to registerServiceWorker (#14609) 2021-10-14 10:41:28 -05:00
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
d76d418e5d FIX: also track textContent mutations (#14607)
Tracking innerHTML was not enough to catch every mutations.
2021-10-14 12:14:48 +02:00
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
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
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
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
0616a5ac7c UX: Better visibility for context search (#14599) 2021-10-13 15:52:17 -04:00
8b25aaed14 DEV: Export register service worker logic (#14598) 2021-10-13 13:19:20 -05:00
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
e1d3175668 DEV: APIs to disable PWA badging and unsubscribe from user notifications (#14595) 2021-10-13 11:47:30 -05:00
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
74706bab10 UX: Add Enter hint to search dropdown (#14587) 2021-10-13 12:09:28 -04:00
a3fde50b62 A11Y: Don't output aria label identical to title (#14586) 2021-10-13 11:19:38 -04:00
11bd3438c4 FIX: groups using users icon were lacking margin in search (#14591) 2021-10-13 12:38:35 +02:00
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
76c9de2d04 UX: Add missing translation (#14592) 2021-10-13 11:23:53 +02:00
b59c419253 FIX: attempts to observe preview mutation asap (#14590) 2021-10-13 09:28:55 +02:00
00e8baffa2 FIX: attempts to enforce caret position in filter (#14589) 2021-10-13 08:19:34 +02:00
308823a253 FIX: Use absolute URLs in search shortcut (#14585) 2021-10-13 10:14:45 +05:30
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 ae13839f98b1b2530a4727a09feee89d7a6ebd88
2021-10-13 09:20:56 +11:00