Commit Graph

25514 Commits

Author SHA1 Message Date
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