Commit Graph

39672 Commits

Author SHA1 Message Date
Dan Ungureanu 43557143fe
FIX: Reset invite when resending it (#11013)
Resending an invite moved the expire date in the future, but did not
invalidate it. For example, if an invite was sent to an email,
invalidated and then resent, it would still be left invalidated.
2020-10-26 12:26:43 +02:00
Martin Brennan 57d06518d4
FIX: Prevent slow bookmark first post reminder at query for topic (#11024)
On forums with a large amount of posts when a user had a bookmark in the topic, PostgreSQL was using an inefficient query plan to fetch the first post of the topic. When running this ActiveRecord query:

```
topic.posts.with_deleted.where(post_number: 1).first
```

The following query plan was produced:

```
 Limit  (cost=0.43..583.49 rows=1 width=891) (actual time=3850.515..3850.515 rows=1 loops=1)
   ->  Index Scan using posts_pkey on posts  (cost=0.43..391231.51 rows=671 width=891) (actual time=3850.514..3850.514 
rows=1 loops=1)
         Filter: ((topic_id = 160918) AND (post_number = 1))
         Rows Removed by Filter: 2274520
 Planning time: 0.200 ms
 Execution time: 3850.559 ms
(6 rows)
```

The issue here is the combination of ORDER BY and LIMIT causing the ineficcient Index Scan using posts_pkey on posts to be used. When we correct the AR call to this:

```
topic.posts.with_deleted.find_by(post_number: 1)
```

We end up with a query that still has a LIMIT but no ORDER BY, which in turn creates a much more efficient query plan:

```
Limit  (cost=0.43..1.44 rows=1 width=891) (actual time=0.033..0.034 rows=1 loops=1)
   ->  Index Scan using index_posts_on_topic_id_and_post_number on posts  (cost=0.43..678.82 rows=671 width=891) (actua
l time=0.033..0.033 rows=1 loops=1)
         Index Cond: ((topic_id = 160918) AND (post_number = 1))
 Planning time: 0.167 ms
 Execution time: 0.072 ms
(5 rows)
```

This query plan uses the correct index, `Index Scan using index_posts_on_topic_id_and_post_number on posts`. Note that this is only a problem on forums with a larger amount of posts; tiny forums would not notice the difference. On large forums a query for a topic that takes 1s without a bookmark can take 8-30 seconds, and even end up with 502 errors from nginx.
2020-10-26 14:30:31 +10:00
dependabot-preview[bot] 9c5b7a4396 Build(deps-dev): Bump simplecov from 0.19.0 to 0.19.1
Bumps [simplecov](https://github.com/simplecov-ruby/simplecov) from 0.19.0 to 0.19.1.
- [Release notes](https://github.com/simplecov-ruby/simplecov/releases)
- [Changelog](https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md)
- [Commits](https://github.com/simplecov-ruby/simplecov/compare/v0.19.0...v0.19.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-26 10:59:35 +08:00
dependabot-preview[bot] 01eb1dfe68 Build(deps): Bump rspec-support from 3.9.3 to 3.9.4
Bumps [rspec-support](https://github.com/rspec/rspec-support) from 3.9.3 to 3.9.4.
- [Release notes](https://github.com/rspec/rspec-support/releases)
- [Changelog](https://github.com/rspec/rspec-support/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-support/compare/v3.9.3...v3.9.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-26 10:59:15 +08:00
Arpit Jalan 9aa2723d57
UX: improve error message for already logged in users (#11020) 2020-10-24 21:21:01 +05:30
Robin Ward e246208756 Add new `cloneJSON` method for cloning an object
This is useful in tests where `deepMerge` would retain references to old
objects.
2020-10-23 14:48:05 -04:00
Penar Musaraj 6f5d8cad51
UX: Move category editing/creation to its own page (#10973)
* Move new/edit category modals to its own page

* Fix JS tests

* Minor fixes to new-category UI

* Add mobile toggle

* Use global pretender endpoint so plugins can benefit too

* Alignment fix

* Minor review fixes

* Styling refactor

* Move some SCSS out of the modal
2020-10-23 12:49:02 -04:00
jbrw 2bcca46cc5
FEATURE - ImageMagick jpeg quality (#11004)
* FEATURE - Add SiteSettings to control JPEG image quality

`recompress_original_jpg_quality` - the maximum quality of a newly
uploaded file.

`image_preview_jpg_quality` - the maximum quality of OptimizedImages
2020-10-23 12:38:28 -04:00
jbrw ce76553010
FEATURE: allow category group moderators to edit posts (#11005)
* FEATURE: allow category group moderators to edit posts

If the `enable_category_group_moderation` SiteSetting is enabled, posts should be editable by those belonging to the appropraite groups.
2020-10-23 12:37:44 -04:00
dependabot-preview[bot] 8a3a6face5 Build(deps): Bump rspec-expectations from 3.9.2 to 3.9.3
Bumps [rspec-expectations](https://github.com/rspec/rspec-expectations) from 3.9.2 to 3.9.3.
- [Release notes](https://github.com/rspec/rspec-expectations/releases)
- [Changelog](https://github.com/rspec/rspec-expectations/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-expectations/compare/v3.9.2...v3.9.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-23 11:50:59 -04:00
dependabot-preview[bot] e29fc2b82f Build(deps): Bump chunky_png from 1.3.12 to 1.3.13
Bumps [chunky_png](https://github.com/wvanbergen/chunky_png) from 1.3.12 to 1.3.13.
- [Release notes](https://github.com/wvanbergen/chunky_png/releases)
- [Changelog](https://github.com/wvanbergen/chunky_png/blob/master/CHANGELOG.rdoc)
- [Commits](https://github.com/wvanbergen/chunky_png/compare/v1.3.12...v1.3.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-23 11:49:53 -04:00
dependabot-preview[bot] 5aeb5afddb Build(deps): Bump stackprof from 0.2.15 to 0.2.16
Bumps [stackprof](https://github.com/tmm1/stackprof) from 0.2.15 to 0.2.16.
- [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.15...v0.2.16)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-23 11:32:48 -04:00
dependabot-preview[bot] 5fa707b58e Build(deps): Bump actionview_precompiler from 0.2.2 to 0.2.3
Bumps [actionview_precompiler](https://github.com/jhawthorn/actionview_precompiler) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/jhawthorn/actionview_precompiler/releases)
- [Commits](https://github.com/jhawthorn/actionview_precompiler/compare/v0.2.2...v0.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-23 11:32:00 -04:00
Robin Ward 3b8220cb3b FIX: State is leaking between tests, causing flakey failures
It seems `deepMerge` sometimes keeps references around. This code
performs a true copy and fixes the issue.
2020-10-23 10:33:06 -04:00
Roman Rizzi c0848a5cc4
FIX: Only include last_posted_at if there's a topic_user object. (#11011)
Trying to include this attribute when topic_user is nil causes an error when visiting a topic as anon. Additionally, we don't display the slow mode banner for these users.
2020-10-23 11:31:59 -03:00
Jordan Vidrine f85f5eb179
FIX: Add check for youtube thumbnail (#11000)
This commit adds a check for the youtube thumbnail class when enforcing max-image-dimensions.
2020-10-23 08:40:49 -05:00
Robin Ward 919f488358 REFACTOR: All remaining acceptance tests converted to new format
Also contains fixes to leaky state in pretender.
2020-10-23 09:28:13 -04:00
dependabot-preview[bot] 88c5a37efa
Build(deps): Bump rubocop-ast from 1.0.0 to 1.0.1 (#11008)
Bumps [rubocop-ast](https://github.com/rubocop-hq/rubocop-ast) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/rubocop-hq/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop-ast/compare/v1.0.0...v1.0.1)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-23 10:37:32 +02:00
Joffrey JAFFEUX b6492356cb
FIX: removes duplicate “ and adds ‘ and ’ (#11010) 2020-10-23 10:35:43 +02:00
Guo Xiang Tan 68fc2a18b1 FIX: Properly handle quotes and backslash in `Search.set_tsquery_weight_filter` 2020-10-23 08:43:34 +08:00
Jahan Gagan 500d22bf32 minor changes in site settings 2020-10-22 10:42:17 -04:00
Jahan Gagan cce03de616 EDIT: specs and translation updated 2020-10-22 10:42:17 -04:00
Jahan Gagan fab67fafc1 FIX: invite users with sufficient trust level 2020-10-22 10:42:17 -04:00
Joffrey JAFFEUX 281bf0b345
FIX: optimizes sk body position in RTL mode (#10997) 2020-10-22 16:08:11 +02:00
David Taylor 85f827ee1c
UX: Remove forgot password button from login-preferences (#10998)
Showing this button is confusing for sites which are using external authentication. Clicking 'log in' already pops up the login modal, which includes a forgot password link when appropriate.
2020-10-22 14:34:10 +01:00
dependabot-preview[bot] 63931e5e49
Build(deps): Bump rubocop-ast from 0.8.0 to 1.0.0 (#10993)
Bumps [rubocop-ast](https://github.com/rubocop-hq/rubocop-ast) from 0.8.0 to 1.0.0.
- [Release notes](https://github.com/rubocop-hq/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop-ast/compare/v0.8.0...v1.0.0)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-22 15:25:39 +02:00
Martin Brennan 0d63eb4124
FEATURE: Add detection of post date to use in bookmark modal (#10981)
This PR introduces a feature that will detect a date inside the post that a user is bookmarking, and offer that date as an option in the bookmark modal.

The logic is that we get the first date/time detected in the post. If it does not have a time, just a date, then we default to 8:00am for the time.
2020-10-22 16:23:46 +10:00
Sam Saffron 906ec87d26 DEV: Add more debugging context to onebox generation
Previously if a onebox timed out we would not present the users in the log
with any information regarding the onebox. This makes it very difficult to
debug.

This adds url/topic/user in the debugging output.
2020-10-22 12:50:22 +08:00
Krzysztof Kotlarek b2481adb40
FIX: persist secure image width and height if is given (#10994)
`max-width: 50%; max-height: 400px;` is a good fallback, however, if width and height are given and are smaller than fallback -  we should persist that smaller size.
2020-10-22 13:25:09 +11:00
Martin Brennan 64b0b50ac0
FIX: Pass user to Email::Sender to avoid broken reply key for group_smtp email (#10978)
Our Email::Sender class accepts an optional user argument, which is used to create a PostReplyKey record when present. This record is used to sub out the %{reply_key} placeholder in the Reply-To mail header, so if we do not pass in the user we get a broken Reply-To header.

This is especially problematic in the IMAP group SMTP situation, because these emails go to customers that we are replying to, and when they reply to us the email bounces! This fixes the issue by passing user to the Email::Sender when sending a group_smtp email but there is still more to do in another PR.

This Email::Sender optional user is a bit of a footgun IMO, especially because most of the time we use it there is a user we can source. I would like to do another PR for this after this one to make the parameter not optional, so we don't end up with these reply issues down the line again.
2020-10-22 10:49:08 +10:00
David Taylor abb00c3780
FIX: Restore users#topic_tracking_state route to api session_info scope (#10992)
This route was inadvertently removed in 1cec333f, and is required for showing new/unread counts in Discourse mobile apps
2020-10-21 19:44:34 +01:00
Osama Sayegh a04c300495
DEV: Add optional ENV variables for MiniProfiler snapshots transporter (#10985) 2020-10-21 19:37:28 +03:00
Joffrey JAFFEUX 6811902a70
FIX: converts “ and ” to " in local dates (#10987) 2020-10-21 17:16:36 +02:00
Joffrey JAFFEUX f4842ae283
FIX: attempts to convert french quotes to regular quotes in dates (#10986) 2020-10-21 16:36:51 +02:00
dependabot-preview[bot] a8d03e428d
Build(deps): Bump onebox from 2.1.3 to 2.1.4 (#10983)
Bumps [onebox](https://github.com/discourse/onebox) from 2.1.3 to 2.1.4.
- [Release notes](https://github.com/discourse/onebox/releases)
- [Changelog](https://github.com/discourse/onebox/blob/master/CHANGELOG.md)
- [Commits](https://github.com/discourse/onebox/compare/v2.1.3...v2.1.4)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-21 13:40:08 +05:30
Kris 08104e058a
UX: Fix mobile padding-top on mobile, follow up to da5841d (#10982) 2020-10-21 17:52:35 +11:00
Martin Brennan 3ae1f98dc8
DEV: Add env var to disable ActiveRecord logging in development (#10979)
If RAILS_DISABLE_ACTIVERECORD_LOGS=1 is passed when starting Rails, none of the query log output will show. This is very useful for debugging with breakpoints because logs are not flooding in constantly.
2020-10-21 12:06:12 +10:00
Angus McLeod 516e7e392b
FEATURE: Add non_automatic group type param to groups index API 2020-10-21 09:46:45 +11:00
Alessandro Bertacco dc2f5064e2
DEV: support for relative symlinks for plugins in docker dev (#10955)
These changes gives the possibility to use relative symlinks for plugins. Previously only absolute symlinks was supported.
2020-10-21 09:39:53 +11:00
Kris a6befcd86c
FIX: include font import for embedded comments (#10967) 2020-10-21 09:35:52 +11:00
Kris 3d9f127228
FIX: Remove need for overflow hidden, follow-up to da5841d (#10971) 2020-10-21 09:35:07 +11:00
Sam 7b3b05f229
FEATURE: CTRL-SHIFT-ENTER and SHIFT-Click do not scroll on post (#10965)
This allows for an advanced feature where hitting control on click or
CTRL-SHIFT-ENTER will lead to a post being made but the browser not to
scroll to the end.
2020-10-21 08:55:58 +11:00
dependabot-preview[bot] fa4ca4cbd0
Build(deps): Bump rubocop-rspec from 1.44.0 to 1.44.1 (#10972)
Bumps [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec) from 1.44.0 to 1.44.1.
- [Release notes](https://github.com/rubocop-hq/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop-rspec/compare/v1.44.0...v1.44.1)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-21 08:54:56 +11:00
Bianca Nenciu be5efc9410
FIX: Ensure old uploads can have animated field updated (#10963)
If admins decreased the maximum filesize limit the ActiveRecord
validations would fail.
2020-10-20 19:11:43 +03:00
Bianca Nenciu 94cbfa92e1
FEATURE: Show a placeholder instead of videos in preview (#10962)
Adding a video in composer and then continuing to type into it will make the
video element flicker and restart playback on every keystroke, as the preview
is rendered. In certain configurations, this can lead to some performance
problems too.

Onebox already does the same for external videos.
2020-10-20 19:01:32 +03:00
Robin Ward a65b426b8a REFACTOR: Convert many more acceptance tests to the new format 2020-10-20 11:08:12 -04:00
Robin Ward b3b9cf7c5d REFACTOR: New format for acceptance tests
This gets us closer to how newer Ember versions want to do things, but
with a bit of Discourse flair.

`acceptance` now takes a function as a parameter, and tests need to be
declared in that new function context.

A new helper, `needs`, is passed as a parameter. You can use it to set
up the test the way you want.
2020-10-20 11:08:12 -04:00
Discourse Translator Bot b5933e2b49
Update translations (#10970) 2020-10-20 15:34:57 +02:00
dependabot-preview[bot] cffda509ce Build(deps): Bump rack-mini-profiler from 2.1.0 to 2.2.0
Bumps [rack-mini-profiler](https://github.com/MiniProfiler/rack-mini-profiler) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/MiniProfiler/rack-mini-profiler/releases)
- [Changelog](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/MiniProfiler/rack-mini-profiler/compare/v2.1.0...v2.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-20 09:16:34 -04:00
dependabot-preview[bot] e4d90c14dc
Build(deps): Bump rubocop-rspec from 1.43.2 to 1.44.0 (#10969)
Bumps [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec) from 1.43.2 to 1.44.0.
- [Release notes](https://github.com/rubocop-hq/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop-rspec/compare/v1.43.2...v1.44.0)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-20 13:35:04 +02:00