Commit Graph

21384 Commits

Author SHA1 Message Date
Dan Ungureanu 2a884e25be
DEV: Make image resize controls more resilient (#8867)
Commit aa24be1 made it possible to build data attributes from image's
Markdown and this changes ensure that the resize controls still work
when data attributes are present.
2020-02-06 17:19:24 +02:00
David Taylor db4ae50928
PERF: Load users in batches when generating notifications (#8870)
Previously, `notify_first_post_users` was loading all users into memory simultaneously, which can cause Sidekiq to run out of memory for large sites. `notify_post_users` was loading every user one-by-one in a loop.

This commit makes both these functions load users in batches of 100. This should make the memory usage of `notify_first_post_users` lower, and reduce the number of queries required in `notify_post_users`.
2020-02-06 12:14:19 +00:00
Joffrey JAFFEUX f25e787ae2
FIX: ensures we have a proper component name (#8876) 2020-02-06 11:30:38 +01:00
Joffrey JAFFEUX 8ca9ad887d
FIX: replaces fake null value by clearable option (#8875) 2020-02-06 08:30:26 +01:00
Dan Ungureanu 2240b1681b
FIX: Show detailed error messages for category pages. (#8832) 2020-02-06 15:32:12 +11:00
Martin Brennan 697d4720df
DEV: Add DEBUG_PRELOADED_APP_DATA to log pre-loaded JSON in development (#8873)
Extracted from #8772

This will allow developers (in rails development mode only) to log pre-loaded JSON app data to the browser console for inspection.
2020-02-06 13:14:33 +10:00
Neil Lalonde 542e62ccf0 FIX: tag info misleading message saying it's not restricted
When a tag is restricted to a secured category that the user can't see,
the message was saying that it wasn't restricted to any categories.
Now it will say it's restricted to categories you can't access.
2020-02-05 15:23:39 -05:00
Osama Sayegh 6f52bbefb8
DEV: Use scheduleOnce correctly (#8865)
* DEV: Use scheduleOnce correctly

* remove jquery usage here
2020-02-05 21:21:00 +03:00
Blake Erickson 926d5f1c0a REFACTOR: Edit title respects min trust to edit post
Follow up to: 241d8f6452
2020-02-05 10:36:24 -07:00
Mark VanLandingham 49c750ca78
FIX: Opening new topic draft never creates post (#8828) 2020-02-05 11:17:58 -06:00
Joffrey JAFFEUX 6bee972a5c
FIX: corrects min/max logic for mini-tag-chooser (#8871) 2020-02-05 17:47:20 +01:00
Penar Musaraj 6253ddc74e DEV: Do not trigger missing icon warning in icon picker 2020-02-05 11:39:46 -05:00
Mark VanLandingham 499b57a9ed
DEV: Ember linting - disallow Ember.* variable usage (#8782) 2020-02-05 10:14:42 -06:00
Joffrey JAFFEUX 98303ee645
FIX: simplify maximum/minimum logic in sk2 to avoid chicken/egg (#8868) 2020-02-05 16:01:58 +01:00
Jarek Radosz be42b87338
FIX: Allow submitting various forms via keyboard (#8866) 2020-02-05 15:23:35 +01:00
Jarek Radosz 53529a3427
DEV: Upgrade Ember to version 3.12.2 (#8753)
* DEV: Use Ember 3.12.2
* Add Ember version to ThemeField's DEPENDENT_CONSTANTS
* DEV: Use `id` instead of `elementId` (See: https://github.com/emberjs/ember.js/issues/18147)
* FIX: Don't leak event listeners (bug introduced in 999e2ff)
2020-02-05 14:51:00 +01:00
Joffrey JAFFEUX d7dffbb13c
UX: caches icon picker full icon's list (#8862) 2020-02-05 09:22:11 +01:00
Joffrey JAFFEUX a9f1652131
REFACTOR: querySelector instead of querySelectorAll to get first node (#8861) 2020-02-05 08:49:02 +01:00
Osama Sayegh a6da0bb1ef
UX: Remove subtle render delay with timeline notification button (#8860) 2020-02-05 18:35:47 +11:00
Sam Saffron 0d6839e8a8 UX: adjust algorithm for picking notification count
Our current algorithm for picking the number of notifications to display
when expanding the notifications relies on magic numbers.

Previously we only allowed for header and an estimate of maximum height of
notification container, this is not ideal as there is padding at the bottom
and top of the notification container

This adds a special number for padding.

The longer term fix though is to render the notification panel off screen
then grab the correct count, finally adding it back into view with.

This would allow for large fonts, small fonts, custom themes and much more.
2020-02-05 16:03:44 +11:00
Sam Saffron 15b27f28aa UX: Topic progress bar should not flash on desktop
Followup on 78725f50

This makes the change a bit safer in case .d-header is not to be found due
to a customization.
2020-02-05 15:36:39 +11:00
Sam Saffron 78725f5081 Revert "FIX: Topic progress bar shouldn't show up on desktop (#8854)"
This reverts commit 7133fd8c89.

Unfortunately performCheckSize may have certain situations in topic
navigation where it is unsafe to call.

We need to add som more safety here prior to merging.
2020-02-05 15:22:44 +11:00
Osama Sayegh 7133fd8c89
FIX: Topic progress bar shouldn't show up on desktop (#8854) 2020-02-05 15:19:20 +11:00
Joffrey JAFFEUX f0fe2ba9ac
UX: introduces icon-picker component for badges (#8844) 2020-02-05 00:41:10 +01:00
Blake Erickson 241d8f6452 FIX: Edit title respects min trust to edit post
This fix ensures that the site setting `post_edit_time_limit` does not
bypass the limit of the site setting `min_trust_to_edit_post`. This
prevents a bug where users that did not meet the minimum trust level to
edit could edit the title of topics.
2020-02-04 16:31:16 -07:00
Joffrey JAFFEUX 666a4be888
UX: prevents mini tag chooser header to wrap (#8858) 2020-02-04 23:55:50 +01:00
Joffrey JAFFEUX 7fd5a8db72
UX: adds arrow navigation support to mini-tag-chooser (#8857) 2020-02-04 23:54:59 +01:00
Joffrey JAFFEUX 9252bbbd7d
FIX: prevents firefox to generate a click event on space (#8856) 2020-02-04 23:41:40 +01:00
Kris 7ac81a6019 UX: Center titles in docked header when there aren't two rows 2020-02-04 13:40:28 -05:00
Joffrey JAFFEUX 2c2ab474a4
FIX: ensures tags-admin-dropdown is working correctly with sk2 (#8852) 2020-02-04 19:23:44 +01:00
Kris 35a1912e2d FIX: Links in category box descriptions should be clickable 2020-02-04 13:02:55 -05:00
Rafael dos Santos Silva 5ead60677a
FEATURE: Ensure we always fill the short_name in the web manifest 2020-02-04 14:16:00 -03:00
David Taylor fec1c0f097
DEV: Handle null notification level when generating data attribute (#8851)
This happens in tests, but handling it properly will make the production code more robust. Followup to ebdebf152d
2020-02-04 17:05:49 +00:00
Penar Musaraj 095e3d8946 DEV: Autofilter combo boxes on 10+ dropdown items by default 2020-02-04 11:23:15 -05:00
David Taylor ebdebf152d DEV: Use a string for category data-notification-level, not an integer
This makes writing CSS to target specific notification levels more intuitive. Follow-up to 7640914552
2020-02-04 16:05:45 +00:00
Vinoth Kannan dabba87954 DEV: introduce `diffLocalChangesUrl` attribute to `theme` model. 2020-02-04 21:33:19 +05:30
Mark VanLandingham c8a02161dd
FIX: Warn users of overwriting new topic draft (#8841) 2020-02-04 09:59:56 -06:00
Mark VanLandingham 91b70f8ffc
FIX: Featured topic title on profile HTML parsed (#8850) 2020-02-04 09:33:46 -06:00
Joffrey JAFFEUX 14126e9a38
UX: do not display pinned option description on mobile (#8846) 2020-02-04 15:34:56 +01:00
Joffrey JAFFEUX ca63502ce6
UX: ensures pinned options icon is not on a new line (#8845) 2020-02-04 15:34:37 +01:00
Joffrey JAFFEUX 1d54e78311
FIX: prevents exception on /admin/badges page when model is not set (#8849)
Exception:

TypeError: Cannot read property 'badge_type_id' of null
2020-02-04 15:34:19 +01:00
Joffrey JAFFEUX 5d31f353f4
remove duplicated }} (#8848) 2020-02-04 15:02:40 +01:00
Gerhard Schlager 71849242fa PERF: Speed up moving posts on large databases
Old exection plan:
```
Delete on post_replies pr  (cost=6.59..20462.62 rows=2254 width=24) (actual time=2.580..2.580 rows=0 loops=1)
  ->  Nested Loop  (cost=6.59..20462.62 rows=2254 width=24) (actual time=0.086..2.557 rows=4 loops=1)
        Join Filter: (p.topic_id <> r.topic_id)
        Rows Removed by Join Filter: 328
        ->  Nested Loop  (cost=6.16..16845.77 rows=2254 width=26) (actual time=0.020..1.886 rows=332 loops=1)
              ->  Nested Loop  (cost=5.74..13257.09 rows=2254 width=20) (actual time=0.016..1.361 rows=332 loops=1)
                    ->  Seq Scan on moved_posts mp  (cost=0.00..19.70 rows=970 width=10) (actual time=0.002..0.028 rows=263 loops=1)
                    ->  Bitmap Heap Scan on post_replies pr  (cost=5.74..13.63 rows=2 width=14) (actual time=0.004..0.005 rows=1 loops=263)
                          Recheck Cond: ((reply_post_id = mp.old_post_id) OR (post_id = mp.old_post_id))
                          Heap Blocks: exact=278
                          ->  BitmapOr  (cost=5.74..5.74 rows=2 width=0) (actual time=0.004..0.004 rows=0 loops=263)
                                ->  Bitmap Index Scan on index_post_replies_on_reply_post_id  (cost=0.00..2.87 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=263)
                                      Index Cond: (reply_post_id = mp.old_post_id)
                                ->  Bitmap Index Scan on index_post_replies_on_post_id_and_reply_post_id  (cost=0.00..2.87 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=263)
                                      Index Cond: (post_id = mp.old_post_id)
              ->  Index Scan using posts_pkey on posts p  (cost=0.42..1.59 rows=1 width=14) (actual time=0.001..0.001 rows=1 loops=332)
                    Index Cond: (id = pr.post_id)
        ->  Index Scan using posts_pkey on posts r  (cost=0.42..1.59 rows=1 width=14) (actual time=0.001..0.002 rows=1 loops=332)
              Index Cond: (id = pr.reply_post_id)
Planning Time: 0.305 ms
Execution Time: 2.600 ms
```

New execution plan:
```
Delete on post_replies pr  (cost=15.34..6538275.37 rows=364157 width=12) (actual time=1.961..1.961 rows=0 loops=1)
  ->  Nested Loop  (cost=15.34..6538275.37 rows=364157 width=12) (actual time=0.048..1.827 rows=187 loops=1)
        ->  Seq Scan on moved_posts mp  (cost=0.00..19.70 rows=970 width=10) (actual time=0.004..0.029 rows=188 loops=1)
        ->  Bitmap Heap Scan on post_replies pr  (cost=15.34..6736.72 rows=375 width=14) (actual time=0.009..0.009 rows=1 loops=188)
              Recheck Cond: ((reply_post_id = mp.old_post_id) OR (post_id = mp.old_post_id))
              Filter: ((SubPlan 1) <> (SubPlan 2))
              Heap Blocks: exact=187
              ->  BitmapOr  (cost=15.34..15.34 rows=377 width=0) (actual time=0.003..0.003 rows=0 loops=188)
                    ->  Bitmap Index Scan on index_post_replies_on_reply_post_id  (cost=0.00..4.33 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=188)
                          Index Cond: (reply_post_id = mp.old_post_id)
                    ->  Bitmap Index Scan on index_post_replies_on_post_id_and_reply_post_id  (cost=0.00..10.82 rows=376 width=0) (actual time=0.001..0.001 rows=0 loops=188)
                          Index Cond: (post_id = mp.old_post_id)
              SubPlan 1
                ->  Index Scan using posts_pkey on posts p  (cost=0.43..8.45 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=187)
                      Index Cond: (id = pr.post_id)
              SubPlan 2
                ->  Index Scan using posts_pkey on posts r  (cost=0.43..8.45 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=187)
                      Index Cond: (id = pr.reply_post_id)
Planning Time: 0.136 ms
Execution Time: 1.990 ms
```
2020-02-04 12:30:43 +01:00
Jarek Radosz 67d5ce8ed1
FIX: Sort out the route navigation in admin/email-style (#8837)
Previously it would go to the "html" page when refreshing on the "css" page, and would open an invalid empty-state page when trying to go to the "email style" tab when already on it.
2020-02-04 11:42:43 +01:00
Jarek Radosz 4ab696dd2f
DEV: Add the `@action` decorator (#8836)
This also enables`@action` use in plugin connectors.

Setting `actions` earlier allows `setupComponents` to use them, for example, when setting up event listeners.
2020-02-04 11:42:25 +01:00
Jarek Radosz 9a52a44d09
DEV: Add outlet args to `editor-preview` outlet (#8835)
Those are the same arguments that are passed into `after-d-editor` outlet. This will enable plugins that attach to editor preview to be conditionally enabled, usually only for the composer.
Plugins that will use this: discourse-canned-responses, discourse-zoom.
2020-02-04 11:41:45 +01:00
Vinoth Kannan e4f3244141 DEV: introduce `updateUrl` attribute to `theme-setting-editor` component. 2020-02-04 15:19:17 +05:30
Robin Ward ee17138c0f FIX: Better error messages when name is too long
Previously you'd get a server side generic error due to a password check
failing. Now the input element has a maxlength attribute and the server
side will respond with a nicer error message if the value is too long.
2020-02-03 14:14:32 -05:00
Penar Musaraj 375f4c09ce FIX: Restore up/down icons in period-chooser 2020-02-03 13:56:58 -05:00
Robin Ward 37888d9818 FIX: Never return the same reply more than once via reply_ids
If our reply tree somehow ends up with cycles or other odd
structures, we only want to consider a reply once, at the first
level in the tree that it appears.
2020-02-03 13:41:18 -05:00