Commit Graph

25666 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan
d82e5cd37c
FIX: Stop incoming message tracking after navigating away. (#14498) 2021-10-05 11:17:20 +08:00
Penar Musaraj
724c836ffa
UX: Use consistent category badge font size in dropdowns (#14502) 2021-10-04 17:05:31 -04:00
Penar Musaraj
23df78acb3
UX: Fix label in search when tagging is disabled (#14503) 2021-10-04 17:04:34 -04:00
Roman Rizzi
a9d20610d4
FIX: Make score's reason link building more explicit (#14475)
We relied on backticks to identify and replace site setting names with links. Unfortunately, some translations don't follow this convention, breaking this feature.

Additionally, this lets us linkify `category settings` and `watched words` without using HTML in the translations.

You may notice that I split the texts we want to linkify into two groups. I did this on purpose to emphasize those that should be translated (regular_links) from those who don't (site_settings_link). If you can think of a better solution, I'm open to suggestions.
2021-10-04 16:55:09 -03:00
Roman Rizzi
90a3fbc07b
DEV: Remove HTML setting type and sanitization logic. (#14440)
* DEV: Remove HTML setting type and sanitization logic.

We concluded that we don't want settings to contain HTML, so I'm removing the setting type and sanitization logic. Additionally, we no longer allow the global-notice text to contain HTML.

I searched for usages of this setting type in the `all-the-plugins` repo and found none, so I haven't added a migration for existing settings.

* Mark Global notices containing links as HTML Safe.
2021-10-04 15:40:35 -03:00
Andrei Prigorshnev
9f626f2735
FIX: empty state message on the user bookmarks page (#14257)
After adding an empty state banner to the user bookmarks page, we have found the bug. Steps to reproduce:

- Go to the user bookmarks page
- Search for something that doesn’t exist in bookmarks
- Click again Bookmarked on the sidebar or View All Bookmarks on the user menu again
2021-10-04 16:48:45 +04:00
Alan Guo Xiang Tan
4cade9d7f6
FIX: Topic.similar_to results in invalid query for certain locales. (#14497)
For `zh_CN`, we use the `cppjieba_rb` gem to remove stop words so
calling `Search.prepare_data` may result in an empty string.
2021-10-04 11:40:22 +08:00
Kris
aba08d1929
DEV: add plugin outlet to categories page (#14491) 2021-10-01 15:50:50 -04:00
David Taylor
b6937e936b
FIX: Do not show 'new or updated topics' for mobile categories page (#14490)
This banner should only show on the 'categories + latest topics' view, which is desktop-only

https://meta.discourse.org/t/204979
2021-10-01 16:52:35 +01:00
Roman Rizzi
4c2d5158c5
FIX: Follow the canonical URL when importing a remote topic. (#14489)
FinalDestination now supports the `follow_canonical` option, which will perform an initial GET request, parse the canonical link if present, and perform a HEAD request to it.

We use this mode during embeds to avoid treating URLs with different query parameters as different topics.
2021-10-01 12:48:21 -03:00
Alan Guo Xiang Tan
f38fd1a5a7
FIX: Error loading suggested topics for anon users. (#14485)
Follow-up to fc1fd1b416
2021-10-01 10:53:05 +08:00
Alan Guo Xiang Tan
dad4781806
UX: PM inboxes being expanded incorrectly when viewing tags. (#14478)
Follow-up to 9d5da2b383
2021-10-01 10:48:30 +08:00
Mark VanLandingham
0cc151c296
DEV: Export resetIdle function in desktop-notifications.js (#14474) 2021-09-29 12:41:31 -05:00
Jean
7737d56dd0
FIX: Notify incoming to categories and latest topics view specifically. (#14473) 2021-09-29 10:05:38 -04:00
David Taylor
928f102516
DEV: Clear pretender request log between test runs (#14456)
Previously we would store every FakeRequest object for all tests, resulting in many hundreds/thousands of objects in the `handledRequests` array.

This commit ensures all pretender state is reset between tests.
2021-09-29 14:43:55 +01:00
Andrei Prigorshnev
b609f6c11c
FIX: restrict other user's notification routes (#14442)
It was possible to see notifications of other users using routes:
- notifications/responses
- notifications/likes-received
- notifications/mentions
- notifications/edits

We weren't showing anything private (like notifications about private messages), only things that're publicly available in other places. But anyway, it feels strange that it's possible to look at notifications of someone else. Additionally, there is a risk that we can unintentionally leak something on these pages in the future.

This commit restricts these routes.
2021-09-29 16:24:28 +04:00
Joffrey JAFFEUX
2d4b9595e8
DEV: uses standard browser_start_timeout (#14472) 2021-09-29 13:25:34 +02:00
Andrei Prigorshnev
31970bd6fc
DEV: little cleanup in the notifications-index component (#14464)
- There's no need to pass `filter` to `user-notifications-large`. The component doesn't use it.
- Rename css class to avoid confusion (this div has nothing to-do with the Select Kit)
- Remove duplicated declarations in test fixtures
2021-09-29 15:24:55 +04:00
Joffrey JAFFEUX
fc432a9cab
FIX: incorrect interpolation was limiting to 1 dispatch / component (#14470) 2021-09-29 11:14:53 +02:00
Alan Guo Xiang Tan
a1745e05ae
FIX: Do not publish post for PM topic tracking if not new for user. (#14469) 2021-09-29 13:54:24 +08:00
Alan Guo Xiang Tan
9998090e5b
UX: Don't display group messages link for group with no messages. (#14453) 2021-09-29 10:18:56 +08:00
David Taylor
b7fc576a8c
DEV: Increase chrome JS memory limit in CI (#14446) 2021-09-28 16:36:01 +01:00
David Taylor
4fa296c3ec
DEV: Print usedJSHeapSize to the console after QUnit run (#14462)
This is `console.log`'d to the browser console. run-qunit will print this to stdout. testem will not, so a custom reporter is implemented to print this message.

The `--enable-precise-memory-info` is added so that chrome provides high-resolution memory information. This API is not supported by firefox. The logic will degrade gracefully.
2021-09-28 16:32:56 +01:00
Joffrey JAFFEUX
4dc14e3a3f
DEV: prevents route nodes to leak on each test run (#14457)
Note this commit is also adding support for teardown in pre-initializers just like we have for initializers.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: David Taylor <david@taylorhq.com>
2021-09-28 17:08:05 +02:00
Penar Musaraj
b0b87efb83
UX: Show scrollbar only when needed in dropdowns (#14461)
Avoids showing a disabled scrollbar when not necessary.
2021-09-28 10:36:16 -04:00
David Taylor
89cc910303
DEV: Use isLegacyEmber helper in setup-tests (#14458)
We were using multiple methods to check which environment we're running in. This commit switches us to use the isLegacyEmber helper consistently. This should be a no-op, but makes the code much easier to read
2021-09-28 14:30:55 +01:00
David Taylor
7fa2eb52f7
DEV: Destroy application instance after each test (#14455)
Under Ember CLI, we create a new application instance for each test. We were not correctly destroying it after the test, causing many references to be maintaned (e.g. at the end of a test run, `Ember.Namespace.NAMESPACES` would have an entry for each application instance).

Calling `destroy` on the application instance tidies up these references, and is one step towards fixing our test memory leak problem. Unfortunately there still seem to be other references being held to the application, so this commit is not a total fix.
2021-09-28 11:37:40 +01:00
Alan Guo Xiang Tan
9d5da2b383
PERF: Revert all inboxes from messages route. (#14445)
The all inboxes was introduced in
016efeadf6 but we decided to roll it back
for performance reasons. The main performance challenge here is that PG
has to basically loop through all the PMs that a user is allowed to view
before being able to order by `Topic#bumped_at`. The all inboxes was not
planned as part of the new/unread filter so we've decided not to tackle
the performance issue for the upcoming release.

Follow-up to 016efeadf6
2021-09-28 11:58:04 +08:00
Alan Guo Xiang Tan
cd64e88711
PERF: Improve database query perf when loading topics for a category. (#14416)
* PERF: Improve database query perf when loading topics for a category.

Instead of left joining the `topics` table against `categories` by filtering with `categories.id`,
we can improve the query plan by filtering against `topics.category_id`
first before joining which helps to reduce the number of rows in the
topics table that has to be joined against the other tables and also
make better use of our existing index.

The following is a before and after of the query plan for a category
with many subcategories.

Before:

```
                                                                                                       QUERY PLAN

-------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
 Limit  (cost=1.28..747.09 rows=30 width=12) (actual time=85.502..2453.727 rows=30 loops=1)
   ->  Nested Loop Left Join  (cost=1.28..566518.36 rows=22788 width=12) (actual time=85.501..2453.722 rows=30 loops=1)
         Join Filter: (category_users.category_id = topics.category_id)
         Filter: ((topics.category_id = 11) OR (COALESCE(category_users.notification_level, 1) <> 0) OR (tu.notification_level > 1))
         ->  Nested Loop Left Join  (cost=1.00..566001.58 rows=22866 width=20) (actual time=85.494..2453.702 rows=30 loops=1)
               Filter: ((COALESCE(tu.notification_level, 1) > 0) AND ((topics.category_id <> 11) OR (topics.pinned_at IS NULL) OR ((t
opics.pinned_at <= tu.cleared_pinned_at) AND (tu.cleared_pinned_at IS NOT NULL))))
               Rows Removed by Filter: 1
               ->  Nested Loop  (cost=0.57..528561.75 rows=68606 width=24) (actual time=85.472..2453.562 rows=31 loops=1)
                     Join Filter: ((topics.category_id = categories.id) AND ((categories.topic_id <> topics.id) OR (categories.id = 1
1)))
                     Rows Removed by Join Filter: 13938306
                     ->  Index Scan using index_topics_on_bumped_at on topics  (cost=0.42..100480.05 rows=715549 width=24) (actual ti
me=0.010..633.015 rows=464623 loops=1)
                           Filter: ((deleted_at IS NULL) AND ((archetype)::text <> 'private_message'::text))
                           Rows Removed by Filter: 105321
                     ->  Materialize  (cost=0.14..36.04 rows=30 width=8) (actual time=0.000..0.002 rows=30 loops=464623)
                           ->  Index Scan using categories_pkey on categories  (cost=0.14..35.89 rows=30 width=8) (actual time=0.006.
.0.040 rows=30 loops=1)
                                 Index Cond: (id = ANY ('{11,53,57,55,54,56,112,94,107,115,116,117,97,95,102,103,101,105,99,114,106,1
13,104,98,100,96,108,109,110,111}'::integer[]))
               ->  Index Scan using index_topic_users_on_topic_id_and_user_id on topic_users tu  (cost=0.43..0.53 rows=1 width=16) (a
ctual time=0.004..0.004 rows=0 loops=31)
                     Index Cond: ((topic_id = topics.id) AND (user_id = 1103877))
         ->  Materialize  (cost=0.28..2.30 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=30)
               ->  Index Scan using index_category_users_on_user_id_and_last_seen_at on category_users  (cost=0.28..2.29 rows=1 width
=8) (actual time=0.004..0.004 rows=0 loops=1)
                     Index Cond: (user_id = 1103877)
 Planning Time: 1.359 ms
 Execution Time: 2453.765 ms
(23 rows)
```

After:

```
                                                                                                                            QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=1.28..438.55 rows=30 width=12) (actual time=38.297..657.215 rows=30 loops=1)
   ->  Nested Loop Left Join  (cost=1.28..195944.68 rows=13443 width=12) (actual time=38.296..657.211 rows=30 loops=1)
         Filter: ((categories.topic_id <> topics.id) OR (topics.category_id = 11))
         Rows Removed by Filter: 29
         ->  Nested Loop Left Join  (cost=1.13..193462.59 rows=13443 width=16) (actual time=38.289..657.092 rows=59 loops=1)
               Join Filter: (category_users.category_id = topics.category_id)
               Filter: ((topics.category_id = 11) OR (COALESCE(category_users.notification_level, 1) <> 0) OR (tu.notification_level > 1))
               ->  Nested Loop Left Join  (cost=0.85..193156.79 rows=13489 width=20) (actual time=38.282..657.059 rows=59 loops=1)
                     Filter: ((COALESCE(tu.notification_level, 1) > 0) AND ((topics.category_id <> 11) OR (topics.pinned_at IS NULL) OR ((topics.pinned_at <= tu.cleared_pinned_at) AND (tu.cleared_pinned_at IS NOT NULL))))
                     Rows Removed by Filter: 1
                     ->  Index Scan using index_topics_on_bumped_at on topics  (cost=0.42..134521.06 rows=40470 width=24) (actual time=38.267..656.850 rows=60 loops=1)
                           Filter: ((deleted_at IS NULL) AND ((archetype)::text <> 'private_message'::text) AND (category_id = ANY ('{11,53,57,55,54,56,112,94,107,115,116,117,97,95,102,103,101,105,99,114,106,113,104,98,100,96,108,109,110,111}'::integer[])))
                           Rows Removed by Filter: 569895
                     ->  Index Scan using index_topic_users_on_topic_id_and_user_id on topic_users tu  (cost=0.43..1.43 rows=1 width=16) (actual time=0.003..0.003 rows=0 loops=60)
                           Index Cond: ((topic_id = topics.id) AND (user_id = 1103877))
               ->  Materialize  (cost=0.28..2.30 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=59)
                     ->  Index Scan using index_category_users_on_user_id_and_last_seen_at on category_users  (cost=0.28..2.29 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=1)
                           Index Cond: (user_id = 1103877)
         ->  Index Scan using categories_pkey on categories  (cost=0.14..0.17 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=59)
               Index Cond: (id = topics.category_id)
 Planning Time: 1.633 ms
 Execution Time: 657.255 ms
(22 rows)
```

* PERF: Optimize index on topics bumped_at.

Replace `index_topics_on_bumped_at` index with a partial index on `Topic#bumped_at` filtered by archetype since there is already another index that covers private topics.
2021-09-28 10:05:00 +08:00
Penar Musaraj
0b69675060
UX: Adjust mobile spacing for full page search (#14450) 2021-09-27 18:03:56 -04:00
Mark VanLandingham
ba49eaccfe
DEV: Plugin API to add to document title count (#14449) 2021-09-27 13:18:49 -05:00
Rafael dos Santos Silva
1c73b97d50
FIX: Workaround Safari 15 createImageBitmap bug (#14448) 2021-09-27 15:02:17 -03:00
Joffrey JAFFEUX
6273dfad4b
REFACTOR: minor changes to api-keys-new (#14435)
- moves loading scopes to controller
- avoids declaring array
- simplify code
2021-09-27 10:43:47 +02:00
Joffrey JAFFEUX
1abe807528
REFACTOR: setting component mixin (#14437)
* REFACTOR: setting component mixing

- drops jquery usage
- extract spit function
- uses @action
- removes get usage where possible
- uses helpers
- minor changes

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2021-09-27 10:43:26 +02:00
Jarek Radosz
37413f180a
FIX: Do not display userColorSchemeId in the UI (#14441)
A followup to #14066. The previous fix worked correctly only if the user had the default theme active.
2021-09-24 22:50:10 +02:00
Kris
d19a64fffe
DEV: Tag topic list needs discovery outlets (#14438) 2021-09-24 13:39:07 -04:00
Penar Musaraj
9235e2ad5d
A11Y: Fix several minor issues (#14436) 2021-09-24 11:52:07 -04:00
Kris
e5754dedf4
DEV: Adding plugin outlets to avoid overrides (#14433) 2021-09-23 21:52:33 -04:00
Penar Musaraj
8cef6dabb5
A11Y: Add labels to some search fields, category notification selector (#14430) 2021-09-23 14:52:34 -04:00
Penar Musaraj
8a250a1eac
UX: Ensure sticky elements don't overflow header (#14432) 2021-09-23 14:51:06 -04:00
Jean
fd0e287da6
FIX: make update banner always available on the categories view (#14431) 2021-09-23 13:10:05 -04:00
Penar Musaraj
8115e5ef76
UX: Better placement for bulk select actions button (#14419) 2021-09-23 10:50:10 -04:00
Joffrey JAFFEUX
456189795a
FIX: more robust tabindex restriction on preview (#14425) 2021-09-23 16:27:51 +02:00
Joffrey JAFFEUX
372479bada
UX: move fast edit before sharing (#14429)
As sharing has some hover behavior, it was looking slightly clunky with fast edit changing position. Putting sharing at the last position will reduce this effect.
2021-09-23 09:56:00 -04:00
David Taylor
688e03fc42
FIX: Ensure subcategory list is hidden when not required (#14424)
When the loading spinner is removed (e.g. via the loading-slider component), the subcategory list view will persist, even when no longer required. This is because we were conditionally rendering the list into the `header-list-container` outlet. When the condition was false, we were doing nothing. Instead, we should use `disconectOutlet` to make sure the content is removed from the DOM.
2021-09-23 12:18:24 +01:00
Martin Brennan
ec087027b3
DEV: Disable upload instrumentation if performance.measure returns undefined (#14427)
Firefox does not return a PerformanceMeasure object when using
performance.mark and performance.measure, even though MDN says it
should https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure#return_value

So for now, we disable the upload instrumentation with a test
to see if a PerformanceMeasure (or anything really) is returned.
2021-09-23 11:34:51 +10:00
Martin Brennan
57f17854fb
FIX: Do not error _removeDeleteOnOwnerReplyBookmarks on navigate (#14426)
When creating a reply after already navigating out of the
topic (e.g. open the reply composer, go to a different topic,
then create the post), the _removeDeleteOnOwnerReplyBookmarks
function was erroring because it relied on the topic model
being present.

We can skip this function altogether if the topic model is _not_
present, because the PostCreator already takes care of deleting
bookmarks with the on_owner_reply auto_delete_preference. The
_removeDeleteOnOwnerReplyBookmarks function just cleans up the
in-memory post stream and topic model.
2021-09-23 11:18:49 +10:00
Rafael dos Santos Silva
38b8eb5971
FIX: Don't try to boot the ember app on old browsers (#14423) 2021-09-22 16:54:57 -03:00
Penar Musaraj
e8182a133a
DEV: Fix flaky search-full-page test (#14421) 2021-09-22 15:05:00 -04:00
Jarek Radosz
db69b87187
DEV: Fix theme qunit error messages (#14420) 2021-09-22 20:00:19 +02:00
Rafael dos Santos Silva
a4cef67e14
FIX: Feature detect globalThis (#14410)
* FIX: Feature detect globalThis

So browsers without support will receive a warning and browse our JS-less view.
2021-09-22 11:39:41 -03:00
Dan Ungureanu
2e085915cc
FIX: include_ serializer methods must end with ? (#14407)
Otherwise, they are simply dead code and the attribute is visible by
default. These bugs did not expose any sensitive information.
2021-09-22 16:01:25 +03:00
Penar Musaraj
c599469e9d
UX: Adjust quote button position on mobile (#14411) 2021-09-22 09:34:29 +02:00
Martin Brennan
a27d2b124c
FIX: Use unread post excerpt for topic-level bookmark excerpt (#14414)
In the user bookmark list, when we show the excerpt of the bookmark
(which is usually just the bookmarked post excerpt), we want to show
the first unread post's excerpt instead for for_topic bookmarks. This
is because when the user clicks on that bookmark link, they are taken
to the first unread post in the topic, not the OP, as per:

27699648ef
2021-09-22 12:47:36 +10:00
Martin Brennan
effc3ef7b4
DEV: Use i18n.toHumanSize instead of formatBytes (#14415)
Follow up to dba6a5eabf. I
introduced a new formatBytes function there unnecessarily
instead of using the existing toHumanSize.
2021-09-22 10:27:18 +10:00
Martin Brennan
d0e1c222f7
DEV: Add instrumentation for uploads (#14397)
This commit allows for measuring the time taken for
individual uploads via the new uppy interfaces, only
if the enable_upload_debug_mode site setting is enabled.

Also in this PR, for upload errors with a specific message
locally, we return the real message to show in the modal
instead of the upload.failed message so the developer
does not have to dig around in logs.
2021-09-22 08:43:02 +10:00
Martin Brennan
dba6a5eabf
FEATURE: Humanize file size error messages (#14398)
The file size error messages for max_image_size_kb and
max_attachment_size_kb are shown to the user in the KB
format, regardless of how large the limit is. Since we
are going to support uploading much larger files soon,
this KB-based limit soon becomes unfriendly to the end
user.

For example, if the max attachment size is set to 512000
KB, this is what the user sees:

> Sorry, the file you are trying to upload is too big (maximum
size is 512000KB)

This makes the user do math. In almost all file explorers that
a regular user would be familiar width, the file size is shown
in a format based on the maximum increment (e.g. KB, MB, GB).

This commit changes the behaviour to output a humanized file size
instead of the raw KB. For the above example, it would now say:

> Sorry, the file you are trying to upload is too big (maximum
size is 512 MB)

This humanization also handles decimals, e.g. 1536KB = 1.5 MB
2021-09-22 07:59:45 +10:00
Penar Musaraj
3e3043dbaa
UX: Add second Search button on mobile (#14404) 2021-09-21 13:02:00 -04:00
Jean
ed0b6a3660
FEATURE: add update banner to the categories and latest topics view (#14403) 2021-09-21 12:35:38 -04:00
David Taylor
4bdeb45727 DEV: Add plugin-related parameters to the QUnit web UI
This commit also hides a number of options which are not used during Discourse development.

Change have been tested on both the legacy `/qunit` route, and the Ember CLI `/tests` route.
2021-09-21 16:50:30 +01:00
David Taylor
402162e18a DEV: Add qunit filter parameter support to Ember CLI tests route
This adds support for `qunit_skip_core`, `qunit_skip_plugins` and `qunit_single_plugin` parameters on the Ember CLI `/tests` route using the `addModuleExcludeMatcher` API. Legacy support is maintained for the `/qunit` route.
2021-09-21 16:50:30 +01:00
Penar Musaraj
c52513c445
A11Y: Add more descriptive labels for some dropdowns (#14402) 2021-09-21 11:19:49 -04:00
Penar Musaraj
c13127b024
A11Y: Use listbox role for dropdowns (#14391) 2021-09-21 09:31:40 -04:00
Bianca Nenciu
bba973f0d5
DEV: Trigger an app event when a card is shown (#14399)
This replaces the unused lastEvent field with an app event trigger.
2021-09-21 15:51:45 +03:00
Bianca Nenciu
d940a8e41a
DEV: Use a better selector for search menu (#14390)
".search-menu" matches the parent element of the element that was
previously selected. This is a better choice because it offers some
flexibility over the DOM structure without breaking the keyboard
shortcuts.
2021-09-21 15:51:29 +03:00
Martin Brennan
27699648ef
FEATURE: Go to last unread for topic-level bookmark links (#14396)
Instead of going to the OP of the topic for topic-level bookmarks
(which are bookmarks where for_topic is true) when clicking on the
bookmark in the quick access menu or on the user bookmark list,
this commit takes the user to the last unread post in
the topic instead. This should be generally more useful than landing
on the unchanging OP.

To make this work nicely, I needed to add the last_read_post_number to
the BookmarkQuery based on the TopicUser association. It should not add
too much extra weight to the query, because it is limited to the user
that we are fetching bookmarks for.

Also fixed an issue where the bookmark serializer highest_post_number was
not taking into account whether the user was staff, which is when we
should use highest_staff_post_number instead.
2021-09-21 13:49:56 +10:00
Vinoth Kannan
28be284b27
FIX: use active record update_attribute instead of mini sql. (#14367)
* DEV: use active record `save!` instead of mini sql.

The "save" method will trigger the before_save callback "match_primary_group_changes" for User model. Else `flair_group_id` won't be removed from the user.

* check whether the method `match_primary_group_changes` called or not.
2021-09-21 09:29:12 +08:00
Martin Brennan
0c42a1e5f3
FEATURE: Topic-level bookmarks (#14353)
Allows creating a bookmark with the `for_topic` flag introduced in d1d2298a4c set to true. This happens when clicking on the Bookmark button in the topic footer when no other posts are bookmarked. In a later PR, when clicking on these topic-level bookmarks the user will be taken to the last unread post in the topic, not the OP. Only the OP can have a topic level bookmark, and users can also make a post-level bookmark on the OP of the topic.

I had to do some pretty heavy refactors because most of the bookmark code in the JS topics controller was centred around instances of Post JS models, but the topic level bookmark is not centred around a post. Some refactors were just for readability as well.

Also removes some missed reminderType code from the purge in 41e19adb0d
2021-09-21 08:45:47 +10:00
Martin Brennan
02f7035cbe
DEV: Improve uppy plugin base and large file handling (#14395)
We want to be able to skip plugins from doing any work under
certain conditions, and to be able raise their own errors if
a file being uploaded is completely incompatible with the concept
of the plugin if it is enabled. For example, the UppyChecksum plugin
is happy to skip hashing large files, but the UppyUploadEncrypt
plugin from discourse-encrypt relies on the file being encrypted
to do anything with the upload, so it is considered a blocking
error if the user uploads a file that is too large.

This improves the base functions available in uppy-plugin-base and
extendable-uploader to handle this, as well as introducing a
HUGE_FILE_THRESHOLD_BYTES variable which represents 100MB in bytes,
matching the ExternalUploadManager::DOWNLOAD_LIMIT on the
server side.

discourse-encrypt to take advantage of this new functionality will
follow in discourse/discourse-encrypt#141
2021-09-21 08:41:07 +10:00
Osama Sayegh
37a3bf9c11
DEV: Add post_alerter_after_save_post event (#14388)
Also promote the `create_notification_alert` and `push_notification`
methods from instance methods to class methods so that plugins can call
them. This is temporary until we add a more comprehensive API for
extending `PostAlerter`.
2021-09-20 21:18:38 +03:00
Kris
a7c342ccb9
REFACTOR: move composer min-height to CSS (#14378) 2021-09-20 12:21:24 -04:00
Kris
a5f8996b99
UX: Share button margin consistency (#14376)
* UX: make share modal space consistent

* remove duplicate margin
2021-09-20 12:21:13 -04:00
Kris
78481832a4
UX: fix profile button spacing (#14375) 2021-09-20 12:21:04 -04:00
Bianca Nenciu
5e8a42e55b
FIX: Do not reload card if already loaded (#14129)
This changes include some used for making it easier to extend user card
functionality.
2021-09-20 19:00:04 +03:00
Penar Musaraj
dfeca42bf8
FEATURE: user/category/tag results in full page search (#14346)
See PR for details, this commit also changes the layout of the full page search.
2021-09-20 10:01:11 -04:00
Penar Musaraj
a736ff5f69
DEV: Clean up some styles (#14374) 2021-09-20 09:52:03 -04:00
Joffrey JAFFEUX
0dd28cdd95
DEV: observes used properties in reason text (#14389) 2021-09-20 14:56:33 +02:00
Martin Brennan
5fb45e712f
Revert "DEV: Improve uppy plugin base and large file handling (#14383)" (#14387)
This reverts commit 36bd6e8c3b.
2021-09-20 16:59:23 +10:00
Martin Brennan
36bd6e8c3b
DEV: Improve uppy plugin base and large file handling (#14383)
We want to be able to skip plugins from doing any work under
certain conditions, and to be able raise their own errors if
a file being uploaded is completely incompatible with the concept
of the plugin if it is enabled. For example, the UppyChecksum plugin
is happy to skip hashing large files, but the UppyUploadEncrypt
plugin from discourse-encrypt relies on the file being encrypted
to do anything with the upload, so it is considered a blocking
error if the user uploads a file that is too large.

This improves the base functions available in uppy-plugin-base and
extendable-uploader to handle this, as well as introducing a
HUGE_FILE_THRESHOLD_BYTES variable which represents 100MB in bytes,
matching the ExternalUploadManager::DOWNLOAD_LIMIT on the
server side.

discourse-encrypt to take advantage of this new functionality will
follow in https://github.com/discourse/discourse-encrypt/pull/141
2021-09-20 16:12:26 +10:00
Vinoth Kannan
a8b2e7e343
DEV: trash category definition topic instead of destroying. (#14356)
After deleting a category, we should soft-delete the category definition topic instead of hard deleting it. Else it causes issues while doing the user merge action if the source user has an orphan post that belongs to the deleted topic.
2021-09-20 11:20:49 +05:30
Andrei Prigorshnev
b6ccc9c37a
FIX: empty state message on the group messages pages (#14371) 2021-09-20 11:38:57 +08:00
Penar Musaraj
e316467169
UX: Improve composer button bar on mobile (#14373) 2021-09-17 17:26:48 -04:00
Mark VanLandingham
cb1210da35
DEV: Set composer upload btn selectors in component (#14324) 2021-09-17 13:06:31 -05:00
Mark VanLandingham
cb0b39d16e
DEV: Add chat to notifications to test notification-types (#14372) 2021-09-17 11:56:21 -05:00
Penar Musaraj
fe17bcbcc3
UX: Prevent invite form fields from resizing (#14370) 2021-09-17 12:42:48 -04:00
Penar Musaraj
cbf6895981
UX: Fix date input icon display issues (#14369) 2021-09-17 12:07:10 -04:00
Joffrey JAFFEUX
5a5b166b6d
UX: minor fast edit tweaks (#14368)
- do not reduce opacity of disabled buttons if they are loading
- replace ‘|’ by single quotes not double quotes
- always start from index 0
- reduces amount of work by checking row's length
- apply quotefix to fallback
- do not add 1 to caretposition if index is 0
2021-09-17 15:36:57 +02:00
Bianca Nenciu
c9ad9bff8a
FIX: Update only passed custom fields (#14357)
It used to replace custom fields instead of updating only the custom
fields that were passed. The changes to custom fields will also be
logged.
2021-09-17 13:37:56 +03:00
Joffrey JAFFEUX
8002b95682
UX: improves fast edit fallback handling (#14366)
The algorithm will now do the following:
- split selection to retain only first line
- removes possible "* "
- check for first inclusion
- fallback to first row if nothing found
2021-09-17 11:21:50 +02:00
Alan Guo Xiang Tan
903439a14e
PERF: Fix N+1 queries in SiteSerialier. (#14365)
`SiteSerializer#groups` loads `Group#flair_upload` for each group so
we need to eagerload this.

Follow-up to e8a9917db1
2021-09-17 10:34:04 +08:00
jbrw
da88cad648
FIX: Offer site_logo_dark_url as an option for dark mode themes (#14361) 2021-09-16 17:47:51 -04:00
Penar Musaraj
ab9c63e4ee
UX: Optionally show a "Summarize" button in topic timeline (#13533) 2021-09-16 15:15:00 -04:00
Andrei Prigorshnev
804274af47
FEATURE: improve blank page syndrome on the activity/topics, activity/read and group messages pages (#14313) 2021-09-16 22:24:27 +04:00
Andrei Prigorshnev
477bbc372e
FEATURE: improve blank page syndrome on the user activity pages (#14311)
This improves blank page syndrome on the next pages:
* activity
* activity/replies
* activity/drafts
* activity/likes-given
2021-09-16 21:35:34 +04:00
andrea
119bdc12ea Added S3 region eu-south-1 Milanù
Added S3 region eu-south-1 Milan
2021-09-16 12:33:43 -04:00
Alan Guo Xiang Tan
98dcbd214c
FIX: Remove incoming messages for read events. (#14352)
This prevents the incoming message banner from showing unnecessarily
when reading a post and then navigating back to the unread list.
2021-09-16 11:53:23 +08:00
Vinoth Kannan
a6de4a5ce9
DEV: use upload id to save in theme setting instead of URL. (#14341)
When we use URL instead it creates the problem while changing the CDN hostname.
2021-09-16 07:58:53 +05:30
Martin Brennan
41e19adb0d
DEV: Ignore reminder_type for bookmarks (#14349)
We don't actually use the reminder_type for bookmarks anywhere;
we are just storing it. It has no bearing on the UI. It used
to be relevant with the at_desktop bookmark reminders (see
fa572d3a7a)

This commit marks the column as readonly, ignores it, and removes
the index, and it will be dropped in a later PR. Some plugins
are relying on reminder_type partially so some stubs have been
left in place to avoid errors.
2021-09-16 09:56:54 +10:00
Joffrey JAFFEUX
b83868bfb0
FEATURE: experimental fast edit (#14340)
Fast edit allows you to quickly edit a typo in a post, this is experimental ATM and behind a site setting: `enable_fast_edit` (default false)
2021-09-15 17:10:30 +02:00
Alan Guo Xiang Tan
27bad28c53
Partially revert "PERF: Improve query performance all inbox private messages. (#14304)" (#14344)
This partially reverts commit ddb458343d.

Seeing performance degrade on larger sites so back to drawing board on
this one. Instead of the DISTINCT LEFT JOIN, we switch back to
IN(subquery).
2021-09-15 11:32:10 +08:00
Alan Guo Xiang Tan
ddb458343d
PERF: Improve query performance all inbox private messages. (#14304)
First reported in https://meta.discourse.org/t/-/202482/19

There are two optimizations being applied here:

1. Fetch a user's group ids in a seperate query instead of including it
   as a sub-query. When I tried a subquery, the query plan becomes very
inefficient.

1. Join against the `topic_allowed_users` and `topic_allowed_groups`
   table instead of doing an IN against a subquery where we UNION the
`topic_id`s from the two tables. From my profiling, this enables PG to
do a backwards index scan on the `index_topics_on_timestamps_private`
index.

This commit fixes a bug where listing all messages was incorrectly
excluding topics if a topic has been archived by a group even if the
user did not belong to the group.

This commit also fixes another bug where dismissing private messages
selectively was subjected to the default limit of 30.
2021-09-15 10:29:42 +08:00
Martin Brennan
d1d2298a4c
DEV: Add for_topic column to bookmarks (#14343)
This new column will be used to indicate that a bookmark
is at the topic level. The first post of a topic can be
bookmarked twice after this change -- with for_topic set
to true and with for_topic set to false.

A later PR will use this column for logic to bookmark the
topic, and then topic-level bookmark links will take you
to the last unread post in the topic.

See also 22208836c5
2021-09-15 11:29:22 +10:00
Martin Brennan
22208836c5
DEV: Ignore bookmarks.topic_id column and remove references to it in code (#14289)
We don't need no stinkin' denormalization! This commit ignores
the topic_id column on bookmarks, to be deleted at a later date.
We don't really need this column and it's better to rely on the
post.topic_id as the canonical topic_id for bookmarks, then we
don't need to remember to update both columns if the bookmarked
post moves to another topic.
2021-09-15 10:16:54 +10:00
Krzysztof Kotlarek
d99735e24d
FEATURE: remove duplicated messages about new advices (#14319)
Discourse is sending regularly message to admins when potential problems are persisted. Most of the time they have exactly the same content. In that case, when there are no replies, the old one should be trashed before a new one is created.
2021-09-15 08:59:25 +10:00
Martin Brennan
f6afcdf8a8
DEV: Change to show failed tests only Ember tests (#14335)
This commit sets `tap_failed_tests_only` to `true` in our testem config, so now only the failing tests will show in our GitHub CI Ember test runs, which saves developers from having to hunt through all of the passing tests using GitHub's janky console output scrollback.
2021-09-15 08:31:37 +10:00
Mark VanLandingham
68bb7c5a66
DEV: Support translated title in desktop/notifications (#14325) 2021-09-14 09:57:38 -05:00
Joffrey JAFFEUX
e263b84196
FIX: prevents extreme cases to overflow in selected content (#14339)
It would for example cause an issue for a lot of selected items with long names.
2021-09-14 10:49:43 -04:00
Dan Ungureanu
856732786f
FIX: Do not suggest Emoji when in open code blocks (#14337)
There was a check for closed code blocks (which had both opening and
closing markups), but it did not work for the case when the text ends
in an open code block.
2021-09-14 17:37:14 +03:00
Penar Musaraj
19b14d6ec2
UX: Fix tab groups editing layout issues on mobile (#14329) 2021-09-14 09:55:40 -04:00
Bianca Nenciu
6a7ea66670
FEATURE: Use second factor for admin confirmation (#14293)
Administrators can use second factor to confirm granting admin access
without using email. The old method of confirmation via email is still
used as a fallback when second factor is unavailable.
2021-09-14 15:19:28 +03:00
Dan Ungureanu
f517b6997c
FEATURE: Cook drafts excerpt in user activity (#14315)
The previous excerpt was a simple truncated raw message. Starting with
this commit, the raw content of the draft is cooked and an excerpt is
extracted from it. The logic for extracting the excerpt mimics the the
`ExcerptParser` class, but does not implement all functionality, being
a much simpler implementation.

The two draft controllers have been merged into one and the /draft.json
route has been changed to /drafts.json to be consistent with the other
route names.
2021-09-14 15:18:01 +03:00
Bianca Nenciu
dde66b9e16
FIX: Update only present fields in request (#14310)
Some category fields were always updated, even if they were not present
in the request. When this happened, these field were erased.
2021-09-14 15:04:54 +03:00
Martin Brennan
581482003a
DEV: Change uploads.filesize column to bigint (#14334)
This is necessary to allow for large file uploads via
the direct S3 upload mechanism, as we convert the external
file to an Upload record via ExternalUploadManager once
it is complete.

This will allow for files larger than 2,147,483,647 bytes (2.14GB)
to be referenced in the uploads table.

This is a table locking migration, but since it is not as highly
trafficked as posts, topics, or users, the disruption should be minimal.
2021-09-14 12:20:56 +10:00
Penar Musaraj
9360ccdc20
DEV: Match viewport metadata on mobile in Ember CLI (#14330) 2021-09-13 21:14:04 -04:00
Robin Ward
7f769e9e76 FIX: Optimistically fix topic timeline state issues
This is my second try at this. The first b246a63a59 raised an issue
with the event delegation not working because the topic id changed.

This adds support for delegating events to dynamic keys by passing a
function where a static key would normally be needed. This means that
each timeline will have its own unique state key and events will only
delegate to the proper topic.
2021-09-13 16:29:39 -04:00
Rafael dos Santos Silva
2e0992c757
DEV: Allow TopicEmbed.import to optionally receive a list of tags (#14301)
This will be used by the rss-polling plugin
2021-09-13 17:01:59 -03:00
Penar Musaraj
b90eb0da14
Revert "DEV: Define --footer-nav-height css var (#14008)" (#14327)
This reverts commit 3119b881aa.
2021-09-13 15:09:06 -04:00
Penar Musaraj
97c0659fcc
UX: Use standard font size for buttons at the end of /top page (#14326) 2021-09-13 14:18:41 -04:00
David Taylor
928f000b4b
FIX: Use <textarea> for theme translations (#14322)
Translations are often multi-line. Using a regular `<input>` doesn't allow newlines, so if you try to edit a multiline theme translation, all the line breaks will be removed.

This commit updates the theme translations UI to use `<textarea>`, just like the core translation editing UI.
2021-09-13 18:57:19 +01:00
Penar Musaraj
a03d8a147f
UX: Fix mobile styling for admin color schemes (#14314) 2021-09-13 13:43:57 -04:00
Penar Musaraj
954f8f8e7e
UX: Fix alignment for admin controls on mobile (#14312) 2021-09-13 13:43:43 -04:00
Martin Brennan
f3273bd43e
FIX: Do not error mobile upload button if !allowUpload (#14317)
allowUpload can be false for the composer if there are no
allowed file extensions. This causes the _bindMobileUploadButton
code to fail because the button does not get rendered in the
template if !allowUpload. This commit changes composer-editor
to only bind upload functionality if allowUpload.
2021-09-13 09:16:03 +10:00
Robin Ward
4e0a43f211 Revert "FIX: Give the topic timeline unique keys for state"
This reverts commit b246a63a59.
2021-09-10 19:56:19 -04:00
Penar Musaraj
33fb3b7ec8
UX: Fix date input display in iOS (#14307) 2021-09-10 15:13:45 -04:00
Penar Musaraj
6c7f4e15b6
FIX: Mobile nav styling (#14309) 2021-09-10 15:13:26 -04:00
Robin Ward
b246a63a59 FIX: Give the topic timeline unique keys for state
We've observed an error where the back button is displayed improperly in
the topic timeline. It's unfortunately been hard to reproduce but we
suspect it's related to leftover state when re-rendering.

This fix optimistically tries to fix the error by introducing the
topic's id to the unique key the widgets use for state. We can deploy
this and keep an eye out for the bug in the future.
2021-09-10 13:03:45 -04:00
Penar Musaraj
299d0ca445
UX: Minor layout tweaks to dropdowns (#14299)
- fixes mini-tag-chooser validation message
- fixes ellipsis overflow in mini-tag-chooser
- removes redundant `border-radius: 0` styles
- simplifies `user-notifications-dropdown` styling and adds example to styleguide
2021-09-10 09:00:41 -04:00
Martin Brennan
77b8347158
DEV: Bump uppy-s3 to 2.0.2 to fix XHR bug (#14303)
This fixes an error when trying to upload a profile
background image for the user card when the
enable_direct_s3_uploads setting was true:

> Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.

This was fixed in the upstream commit by the uppy devs:

5937bf2127
2021-09-10 15:47:44 +10:00
Alan Guo Xiang Tan
bc23dcd30b
FIX: Don't publish PM archive events to acting user. (#14291)
When a user archives a personal message, they are redirected back to the
inbox and will refresh the list of the topics for the given filter.
Publishing an event to the user results in an incorrect incoming message
because the list of topics has already been refreshed.

This does mean that if a user has two tabs opened, the non-active tab
will not receive the incoming message but at this point we do not think
the technical trade-offs are worth it to support this feature. We
basically have to somehow exclude a client from an incoming message
which is not easy to do.

Follow-up to fc1fd1b416
2021-09-10 09:20:50 +08:00
Martin Brennan
2215cc2547
DEV: Refactor uppy plugin interfaces (#14275)
This abstracts interaction with uppy for uppy plugin classes
into base classes for Preprocessor  plugins, so anyone
making these uppy plugins doesn't have to think as much about uppy
underneath the hood. This also makes the logging and validation
nicer, and provides a more consistent way to emit progress and
completion events.

In a future commit, we will introduce another base class for
`UploadUploaderPlugin` which will be used to be able to hijack
the upload process to go to a different provider (e.g. for discourse-video)
2021-09-10 09:09:47 +10:00
Rafael dos Santos Silva
789613fe51
DEV: Run Ember CLI tests in Firefox evergreen too (#14283)
Increases timeout and removes parallelism to make it stable.
2021-09-09 16:32:56 -03:00
Rafael dos Santos Silva
3469f7b74f
DEV: Work around HTMLElement.innerText differences between browsers (#14297) 2021-09-09 14:01:22 -03:00
Penar Musaraj
24e71acf3f
UX: Normalize sizing for inputs, buttons, dropdowns (#14226)
See PR for details
2021-09-09 11:01:56 -04:00
Bianca Nenciu
76f0cf10e6
FIX: Resolve short URLs after diffHTML was loaded (#14296)
Short URLs were resolved before diffHTML was loaded and content was
swapped by it, which meant that no URLs were found and the URLs remained
unsolved. This caused image elements to be blank.

* DEV: Updated diffHTML to 1.0.0-beta.20
2021-09-09 16:25:58 +03:00
Jarek Radosz
02a6b991fe
FIX: Correct the play icon position (#14295) 2021-09-09 15:10:32 +02:00
Robin Ward
1205db8f84 DEV: Don't check the defaultState every time a widget is rendered
This only happens in development mode but still ends up calling the
method unnecessarily.
2021-09-09 08:42:03 -04:00
Bianca Nenciu
0532a5a43e
FIX: Do not replace in mentions and hashtags (#14260)
Watched words of type 'replace' or 'link' replaced the text inside
mentions or hashtags too, which broke these. These types of watched
words must skip any match that has an @ or # before it.
2021-09-09 12:03:59 +03:00
Alan Guo Xiang Tan
7b77dd5c05
FIX: Display unread/new PM links only when viewing own user. (#14290)
At this point in time, we do not think supporting unread and new when an
admin is looking at another user's messages is worth supporting.

Follow-up to fc1fd1b416
2021-09-09 14:02:17 +08:00
Alan Guo Xiang Tan
ee8c943326
FIX: Remove dismissed new topics from PM topic tracking state. (#14288)
Follow-up to fc1fd1b416
2021-09-09 12:39:27 +08:00
Alan Guo Xiang Tan
c92818ae5f
FIX: Remove dismiss read topics from PM topic tracking state. (#14287)
Follow-up to fc1fd1b416
2021-09-09 10:59:39 +08:00
Penar Musaraj
85e95c9ec5
FIX: Better positioning for "Skip to main content" button (#14286) 2021-09-08 21:28:55 -04:00
Alan Guo Xiang Tan
412587f70a
FEATURE: Publish read topic tracking events for private messages. (#14274)
Follow-up to fc1fd1b416
2021-09-09 09:16:53 +08:00
Alan Guo Xiang Tan
1e05175364
PERF: Avoid running query unnecessarily when updating bookmark. (#14276)
* Avoid loading an entire ActiveRecord object when saving and updating.
* Avoid running a DB query when `post_id` or `user_id` is not changed.
2021-09-09 10:50:26 +10:00
Robin Ward
13b31def80 FIX: Ember CLI was being hijacked before potential errors
This was problematic if something like SCSS file throws an error as the
app would tell Ember CLI to bootstrap as if everything is fine and not
display the error.

The fix is to only hijack the rendering at the end of the template
instead of the beginning.
2021-09-08 16:07:54 -04:00
Penar Musaraj
0dab1634b0
FIX: Composer height issue in Safari on iOS 15 (#14282) 2021-09-08 13:35:09 -04:00
Arpit Jalan
01341f33e3
FIX: do not show spoiler content in RSS (#14277)
This commit updates the RSS post content to use email formatting. Many
plugins are using the `reduce_cooked` method to format content that is
not displayed outside of Discourse application. Using email formatting
also strips the secure media and various other things that is only meant
for Discourse client side application.
2021-09-08 20:19:43 +05:30
Joffrey JAFFEUX
95b15acb1e
DEV: uses forked Mousetrap to avoid leaking listeners (#14198) 2021-09-08 14:48:13 +02:00
Robin Ward
943f0dcfa0
DEV: Add support to Ember CLI for running message format in tests (#14271) 2021-09-08 14:00:29 +02:00
Gerhard Schlager
8e60bce903
FIX: Always show the creation date of posts in crawler view (#14269)
The modification date should always be a meta tag to make this less confusing. Especially for imported posts.
That's more in line with how the rest of Discourse presents post dates.
2021-09-08 11:03:55 +02:00
Alan Guo Xiang Tan
5de64b3630
FIX: Correct highest post number for read topic tracking state. (#14273) 2021-09-08 11:55:12 +08:00