Commit Graph

22694 Commits

Author SHA1 Message Date
Dan Ungureanu 333d4f9a98
FIX: Redirect user to the URL with the correct category slug (#10167)
This commit implements a category redirect similar to the one for topic
URLs with wrong slug.
2020-07-07 15:25:36 +03:00
jjaffeux f92116d695 Revert "DEV: flexify post actions (#9926)"
This reverts commit 6ef0e98f4e.
2020-07-07 12:42:49 +02:00
Joffrey JAFFEUX 56475f57c5
UX: simplifies editing email templates by always having a default (#10179) 2020-07-07 11:44:13 +02:00
Joffrey JAFFEUX 9b7000dbf1
FIX: ensures category order keeps consistent (#10165)
Before this change:
- first full page load would get category defaults defined un cateory settings
- a navigation to a topic and then back to categories list would reset defaut to the ones defined in discovery/topics
2020-07-07 09:56:38 +02:00
Krzysztof Kotlarek 72861f4e1c
FIX: add table CSS rules to normalize (#10176)
* FIX: add table CSS rules to normalize

In the new version of normalize - 8.0.1 `  `table` and `td` CSS rules are missing
https://github.com/necolas/normalize.css/blob/master/normalize.css

They existed in version `3.0.1` https://github.com/necolas/normalize.css/blob/3.0.1/normalize.css#L417

Also, extracted custom rules to new file
2020-07-07 16:47:03 +10:00
Martin Brennan 280cd99c62
DEV: Add extra appEvents to composer workflow
* add composer:saved, composer:created-post, and composer:edited-post
  appEvents inside the composer controller, to make it easier to detect
  these events in plugins
2020-07-07 14:13:45 +10:00
Dan Ungureanu 556f7dc9c0
FIX: Fix race condition when resolving tag and category hashtags (#10153)
* FIX: Fix race condition when resolving tag and category hashtags

If the category hashtags were resolved first and then tag hashtags, then
the tags would overwrite the categories. Similarly, if the category
hashtags were resolved last it would overwrite even hashtags which ended
with '::tag'.

* DEV: Add test

* DEV: Fix test
2020-07-07 10:20:51 +10:00
Bianca Nenciu b9e3db6387
UX: Add link to user email preferences in admin view (#10169) 2020-07-07 10:20:14 +10:00
Dan Ungureanu e08b860e88
FIX: Improve category hashtag lookup (#10133)
* FIX: Improve category hashtag lookup

This commit improves support for sub-sub-categories and does not include
the ID of the category in the slug, which fixes the composer preview.

* FIX: Sub-sub-categories can be mentioned using only two levels

* FIX: Remove support for three-level hashtags

* DEV: Simplify code
2020-07-07 10:19:01 +10:00
Joffrey JAFFEUX 6ef0e98f4e
DEV: flexify post actions (#9926)
* DEV: flexify post actions

* more tweaks
2020-07-07 10:18:01 +10:00
Kris 1f5cecaf28 Minor follow up fix to 4f12768 for mobile 2020-07-06 19:17:30 -04:00
Kris 4f12768d10 UX: Remove extra space added by img resize controls in composer preview 2020-07-06 19:11:58 -04:00
Blake Erickson 2e13ed061d FIX: Generate Topic Thumbnails nil to Array error
If any value, including nil, is passed in as an argument the default
won't be set, so we need to handle when a non-Array value is passed in
to the `generate_thumbnails!` method.
2020-07-06 15:35:33 -06:00
Jarek Radosz 194c962124
FIX: Do not rerender widget-dropdown on all clicks (#10100)
Because of how the dropdown was structured, as long it was in the DOM, all clicks outside the widget would rerender it.

This commit introduces `widget-dropdown-body` that handles the `clickOutside` callback and is rendered conditionally, so it won't get called when the dropdown is closed.
2020-07-06 17:04:16 +02:00
Jarek Radosz 3b51e05de2
FIX: CookText may be gone before promise resolves (#10097)
* FIX: CookText may be gone before promise resolves

Bug introduced in 293467a37a.

* DEV: Drop the window.requireModule in cook-text

It was introduced in 2017 in 232311aa8c but doesn't seem to be necessary anymore.
2020-07-06 17:03:27 +02:00
Jarek Radosz 64ce12a758
FIX: `OptimizedImage#filesize` (#10095)
`OptimizedImage#filesize` calls `Discourse.store.download` with an OptimizedImage as an argument. It would in turn attempt to call `#original_filename` and `#secure?` on that object. Both would fail as these methods do not exist on OptimizedImage, only on Upload. We didn't know about these issues because:
1. `#calculate_filesize` is not called often, because the filesize is saved on OptimizedImage creation, so it's used mostly for manual filesize recalculation
2. we were using `rescue nil` which swallows all errors
2020-07-06 17:01:29 +02:00
Mark VanLandingham 3792ffa556
DEV: Update method documentation in lib/computed.js (#10172) 2020-07-06 09:26:21 -05:00
Joe 6e341f1839 UX: restore table borders
Newer versions of Normalize remove the `border-collapse: collapse;` property and fallback to browser defaults. This commit restores that property because we're using it in quite a few places.
2020-07-06 21:25:41 +08:00
David Taylor 98786cb037
DEV: Refactor basic-topic-list to use topic-list-item on mobile (#10105)
Previously, basic-topic-list had its own implementation of topic-list-item on mobile, which made it more difficult to maintain and extend. The visible difference was that the basic-topic-list implementation had no large avatar on the left. This commit adds a new hideMobileAvatar parameter to topic-list-item and topic-list, and sets it to `true` for the basic-topic-list component.
2020-07-06 13:58:57 +01:00
Régis Hanol 525a2174b3
Restore 'pointer' cursor on buttons
Normalize removed their opinionated cursor styling of buttons in [4.0.1](170455d6f6).

Follow-up-to: 1fd3a30a59
2020-07-06 13:15:31 +02:00
David Taylor cb1b472a0f
PERF: Do not include thumbnail information in default topic list payload (#10163)
Now it is only included when a theme/plugin has requested it.
2020-07-06 10:59:21 +01:00
David Taylor 5284d41a8e
FEATURE: Optionally skip the create account popup for external auth 2020-07-06 10:18:57 +01:00
David Taylor 041d28295f
UX: Hide login button during externally authenticated account creation
Also switch to use the new d-button loading property for the create account button
2020-07-06 10:18:49 +01:00
David Taylor 977766e7a8
FEATURE: sso_overrides_(email|username|name) for all auth methods
These settings previously applied only to discourse-sso. Now they work for all external authentication methods.
2020-07-06 10:18:45 +01:00
David Taylor ec448a1516
DEV: Refactor Auth::Result for readability, recreate during signup flow 2020-07-06 10:18:41 +01:00
Joffrey JAFFEUX 789a15a897
DEV: allows autocomplete to be debounced (#10166)
Usage:

```
$(".foo").autocomplete({debounced: true});
```
2020-07-06 09:28:57 +02:00
Krzysztof Kotlarek 1fd3a30a59
FIX: update normalize css from 3.0.1 to 8.0.1 (#10141)
It is a second attempt to this update. First one was reverted here https://github.com/discourse/discourse/pull/8618

We noticed a problem that `like` counter had incorrect colour on mobile.

I added a missing rule to the bottom of the file (that rule existed in normalize-3 and was removed in normalize-8)

```
button,
input,
optgroup,
select,
textarea {
  color: inherit;
}
```
2020-07-06 09:09:30 +10:00
Régis Hanol 48b4ed41f5 FIX: uploading an existing image as a site setting
The previous fix (f43c0a5d85) wasn't working for images that were already uploaded.
The "metadata" (eg. 'for_*' and 'secure' attributes) were not added to existing uploads.

Also used 'Upload.get_from_url' is the admin/site_setting controller to properly retrieve
an upload from its URL.

Fixed the Upload::URL_REGEX to use the \h (hexadecimal) for the SHA

Follow-up-to: f43c0a5d85
2020-07-03 19:16:54 +02:00
David Taylor 4c1e690e32
DEV: after_extract_linked_users hook for plugins to modify user list
This allows plugins to change the list of users which will be sent 'linked' notifications
2020-07-03 14:52:49 +01:00
Régis Hanol f43c0a5d85 FIX: uploading an image as a site setting
When uploading an image as a site setting, we need to return the "raw" URL, otherwise
when saving the site setting, the upload won't be looked up properly.

Follow-up-to: f11363d446
2020-07-03 13:23:10 +02:00
Sam Saffron a9c703c230
FIX: emoji autocomplete not triggering correctly
08044b4f regressed emoji auto complete logic since we (I) forgot to add the
space into the not capturing group at the beginning.

This meant that

`hello 👍t` would not trigger an autocomplete to pick skin tone.
2020-07-03 16:56:11 +10:00
Martin Brennan 8ef782bdbd
FIX: Increase time of DOWNLOAD_URL_EXPIRES_AFTER_SECONDS to 5 minutes (#10160)
* Change S3Helper::DOWNLOAD_URL_EXPIRES_AFTER_SECONDS to 5 minutes, which controls presigned URL expiry and secure-media route cache time.
* This is done because of the composer preview refreshing while typing causes a lot of requests sent to our server because of the short URL expiry. If this ends up being not enough we can always increase the time or explore other avenues (e.g. GitHub has a 7 day validity for secure URLs)
2020-07-03 13:42:36 +10:00
Vinoth Kannan 9426d12c1d FEATURE: trigger `user_updated` event if username is changed. 2020-07-03 00:14:19 +05:30
Osama Sayegh de243426c4
FIX: Negative limit values shouldn't cause error 500 (#10162) 2020-07-02 19:52:37 +03:00
Roman Rizzi 2df388ffd7
DEV: Plugins can extend ReviewableScore types. (#10156) 2020-07-02 11:47:43 -03:00
Ahmed Gagan 04d7693355
FIX: Filter read/unread notifications on the server side (#10152)
https://meta.discourse.org/t/notifications-unread-only-filter/37621/32
2020-07-02 11:06:00 +01:00
David Taylor 95153356ea
PERF: Refactor lightbox decorator to use querySelectorAll (#10158)
Previously we were using `$elem.find(...).not($elem.find(...))`. This took approximately 2ms on my machine with a test post.

This commit switches to using a native querySelectorAll method, which takes less than 0.5ms on the same test post.
2020-07-02 11:04:19 +01:00
Guo Xiang Tan ecc799ab56
FIX: Delete related search data when record has been deleted. 2020-07-02 12:24:59 +08:00
Kris 490939a1c9 UX: Truncate long badge names in the mobile usercard 2020-07-01 21:39:40 -04:00
Vinoth Kannan f11363d446 FIX: return cdn url for uploads if available.
Currently it is displaying non-cdn urls in the composer preview.
2020-07-02 06:36:14 +05:30
Robin Ward 8bc61e84a7 FIX: Support root paths that omit the trailing slash and have QPs 2020-07-01 14:55:20 -04:00
David Taylor 76d5e54aab
PERF: Check for modal visibility in a more efficient way
This code runs on every keyup event in the application, so it needs to be efficient. Previously we were iterating over the whole document using the JQuery :visible selector. Per the JQuery docs at https://api.jquery.com/visible-selector/

> Using this selector heavily can have performance implications, as it may force the browser to re-render the page before it can determine visibility. Tracking the visibility of elements via other methods, using a class for example, can provide better performance.

We already had a `hidden` class on the modal element which we can check, so we can check that instead.
2020-07-01 17:49:23 +01:00
Dan Ungureanu fc4d74870c
UX: Add Login button on 403 error page if user is not logged in (#10154) 2020-07-01 18:27:42 +03:00
Robin Ward e0d2174e75 FIX: Search was not multisite aware 2020-07-01 09:58:17 -04:00
Guo Xiang Tan 01a722885d
PERF: Exclude `image_url` and `thumbnails` from `SearchTopicListItemSerializer`.
The attributes are not used and was resulting in N+1 queries.
2020-07-01 14:28:31 +08:00
Sam Saffron ac968f5363
PERF: cache all metadata for 60 seconds
Clients tend to request webmanifests and such very often.

Keep the data cached for 60 seconds so it is not requested aggresively.
2020-07-01 12:58:02 +10:00
Mark VanLandingham 57a8b3b964
DEV: Add group name as class to group-box (#10150) 2020-06-30 10:49:31 -05:00
David Taylor 4db9f7bb73
FIX: Hide publish_read_state option from non-admin users (#10148) 2020-06-30 16:49:04 +01:00
Sam Saffron 67a310db02
FIX: emoji_autocomplete_min_chars failing when not 0
autocomplete resolving to [] was causing it to stop working.
Instead we have a special const (SKIP) which ensures it will
continue to be evaluated and only this instance is skipped.
2020-06-30 17:39:52 +10:00
Mark VanLandingham d00e83eab1
FIX: update theme fields when updating from ThemesInstallTask (#10143) 2020-06-29 13:49:02 -05:00