Commit Graph

23275 Commits

Author SHA1 Message Date
Joffrey JAFFEUX 265d8bc1d7
FIX: close picker on emoji selection when on mobile device (#10516) 2020-08-24 15:04:44 +02:00
Joffrey JAFFEUX c3364b3a6b
UX: improves picker on automatic dark themes (#10515) 2020-08-24 15:04:11 +02:00
Joffrey JAFFEUX 226be994da
REFACTOR: rewrite the emoji-picker (#10464)
The emoji-picker is a specific piece of code as it has very strong performance requirements which are almost not found anywhere else in the app, as a result it was using various hacks to make it work decently even on old browsers.

Following our drop of Internet Explorer, and various new features in Ember and recent browsers we can now take advantage of this to reduce the amount of code needed, this rewrite most importantly does the following:
- use loading="lazy" preventing the full list of emojis to be loaded on opening
- uses InterserctionObserver to find the active section
- limits the use of native event listentes only for hover/click emojis (for performance reason we track click on the whole emoji area and delegate events), everything else is using ember events
- uses popper to position the emoji picker
- no jquery code
2020-08-24 14:20:51 +02:00
David Taylor 9debfed060
FIX: Add cache-busting parameter to ace-editor javascript
Long-term we should consider adding the file hash to javascript URLs, so that the URL changes whenever the file changes
2020-08-24 12:29:46 +01:00
David Taylor ac80109705
DEV: Improve user card styling extensibility (#10508)
- Add a metadata-row class
- Remove wrapper tags from user-card-after-metadata and user-card-before-badges outlets
- Correct max-height for mobile card
2020-08-24 11:02:40 +01:00
Joffrey JAFFEUX 23b823dd3a
FIX: removes us_pacific-new from the list of available timezones (#10514) 2020-08-24 11:04:46 +02:00
Guo Xiang Tan 4b30799054
FIX: Correct `personal_messages:<username>` advanced search filter.
Renamed from `private_messages` to `personal_messages` without
deprecation because the `private_messages` advanced search filter never
worked in the first place when it was implemented.
2020-08-24 11:54:30 +08:00
Martin Brennan 9022e4516f
FIX: Remove unnecessary audio/video parent element load (#10511)
Meta report: https://meta.discourse.org/t/sending-many-requests-for-video-audio-upload-while-editing-post/161487

When typing in the composer we are sending a lot of unnecessary load() requests for the video/audio elements. This line was added months ago before we improved previewing/video thumbnails, which have improved things, so it is no longer required. After removing this line everything still works and no more additional requests are sent.
2020-08-24 13:18:38 +10:00
Vinoth Kannan 62f4fc728d UX: lowercase tag name before checking it with topic title.
Tag names can contain uppercase letters if `force_lowercase_tags` site setting disabled.
2020-08-23 21:09:51 +05:30
Vinoth Kannan 66976baefa DEV: skip using `br` tag in header widget rendering.
562180dd9a
2020-08-22 13:38:37 +05:30
Penar Musaraj 8b2c4b07a4
UX: Tweaks to admin color palette dropdown (#10502) 2020-08-21 09:30:11 -04:00
Krzysztof Kotlarek 7833853cf1
FIX: display warning only if all users already added to the group (#10500)
If at least one user can be added to the group, proceed with that action
2020-08-21 13:38:09 +10:00
Guo Xiang Tan daddad7fd6
DEV: Update annotations. 2020-08-21 11:36:53 +08:00
Guo Xiang Tan d12d8fb7fd
DEV: Include more information when reporting search indexing failures. 2020-08-21 11:02:00 +08:00
Guo Xiang Tan aae9e6e5fd
FIX: `Topic.similar_to` results in error if cooked raw is blank. 2020-08-21 10:54:08 +08:00
Martin Brennan 2aa1482421
FIX: Bookmark list showing wrong no content message (#10501)
Meta report: https://meta.discourse.org/t/spurious-permissions-error-after-deleting-last-bookmark/161289

When deleting all bookmarks in their list, users were seeing an "access denied" message instead of the regular no content message. This is because when we were calling loadMore and no further results were returned, we were presuming the null response from the resolved promise meant that there was a permissions error. Fixed this and moved the message into a computed property to show the correct message.
2020-08-21 11:01:12 +10:00
Kane York ab0b034404
FIX: Wizard could not send custom color schemes to the client correctly (#10484)
This was likely introduced with the refactor to make ColorSchemeColor a database object. Add a test so this doesn't happen again.

Also test other basics of the WizardSerializer.

For some reason, the .as_json left Ruby objects in; I solved this with a round trip through JSON during the test.
2020-08-20 17:10:33 -07:00
Guo Xiang Tan 337f062f0f
PERF: Defer indexing post for search when saving a post.
Indexing a post for search is slow and there is no reason for us to have
to block saving a post due to search indexing.
2020-08-21 07:52:43 +08:00
Penar Musaraj 3c06dd9b99
FIX: Detect dark scheme server-side for better dark logo support (#10490)
* FIX: Use dark logo when dark scheme is default

* Small refactor
2020-08-20 14:23:18 -04:00
Gerhard Schlager 0bd27cd10b Make prettier happy 2020-08-20 16:27:32 +02:00
Gerhard Schlager cff68ef0dd FIX: User titles from translated badge names were automatically revoked
It also cleans up the denormalized data about badge titles in the user_profiles table.
2020-08-20 11:15:53 +02:00
Vinoth Kannan 8348a41124
FEATURE: add `regular_categories` field in site setting & user option. (#10477)
Like "default watching" and "default tracking" categories option now the "regular" categories support is added. It will be useful for sites that are muted by default. The user option will be displayed only if `mute_all_categories_by_default` site setting is enabled.
2020-08-20 00:35:04 +05:30
Neil Lalonde 298ed5d021
FIX: delete unused tags shouldn't delete tags belonging to tag groups 2020-08-19 12:17:49 -04:00
Neil Lalonde 96511e4548
UX: better wording when there are no unused tags to delete 2020-08-19 12:17:48 -04:00
Blake Erickson 367de2594d
FIX: Unlike own posts on ownership transfer (#10446)
* FIX: Unlike own posts on ownership transfer

If a user has liked a post that has passed the
`post_undo_action_window_mins` system setting window and you transfer ownership
of that post to that user you will be the owner of a post that you have
liked, but cannot unlike resulting in a weird UI behavior. This commit
fixes this issue.

The existing tests didn't check for the timeout window for unliking
posts so I added that in.

I couldn't find a good way to do this logic inside of the guardian class
so rather than duplicating behavior of the `PostActionDestroyer` class
inside of the `PostOwnerChanger` I decided to pass in a "bypass"
variable that could be used to check if the calling class is the
'post_owner_changer' and bypass the guardian instead. I went this route
because the guardian `can_delete_post_action` method has no way of
distinguishing how to allow a user to be able to unlike their own posts
after the timeout window but only on a post owner change.

* use an options hash instead
2020-08-19 09:21:02 -06:00
jbrw aa1fc01307
FEATURE - Moderators can create and manage groups (#10432)
Enabling the moderators_manage_categories_and_groups site setting will allow moderator users to create/manage groups.

* show New Group form to moderators

* Allow moderators to update groups and read logs, where appropriate

* Rename site setting from create -> manage

* improved tests

* Migration should rename old log entries

* Log group changes, even if those changes mean you can no longer see the group

* Slight reshuffle

* RouteTo /g if they no longer have permissions to view group
2020-08-19 10:41:40 -04:00
Robin Ward 3640c00b03
Remove `Discourse` constant usage (#10470)
* REFACTOR: Get us closer to no `Discourse` constants in tests

* REFACTOR: Remove `Discourse.currentUser`

* REFACTOR: `prioritizeNameInUx` is really a helper and can use context

* REFACTOR: Rename test

* REFACTOR: Remove `Discourse.MarkdownItURL` and use session

* REFACTOR: Remove unused `LetterAvatarVersion`

* REFACTOR: Remove unused `Discourse.ThemeSettings`

* REFACTOR: Remove unused CDN constants

* REFACTOR: The `globalNotice` property doesn't exist anymore

* REFACTOR: Remove `Discourse.__container__` from plugin api

* REFACTOR: Consider `logout()` a helper and remove container.
2020-08-19 08:51:48 -04:00
Joffrey JAFFEUX dde3d63b33
DEV: adds event_reminder (27) and event_invitation (28) (#10473)
Note that these events are also added to the list of events sent to push notifications.
2020-08-19 12:07:51 +02:00
Joffrey JAFFEUX 3e49c5b4d8
FIX: do not cancel search early in tests (#10445)
This is done to avoid cases where search would be cancelled before debounce.
2020-08-19 09:57:40 +02:00
Penar Musaraj 328ad921fb
FIX: display label when theme uses default color scheme 2020-08-18 21:11:15 -04:00
Penar Musaraj 1a7391a251
FIX: do not override logo markup when loading page in dark mode
Ensures that when loading the page in dark mode, logo can switch back to light logo if user toggles their OS appearance.
2020-08-18 20:33:42 -04:00
Jordan Vidrine ed0e1e28b4
FIX: Fix css var issues + button :active gradient (#10469)
* FIX: Fix css var issues

Adds ability for published page to use css `var()` + import the `var()` definitions
2020-08-18 14:25:38 -05:00
Roman Rizzi 390615fbcd
UX: Help users understand the meaning of each scope. (#10468) 2020-08-18 15:12:04 -03:00
Penar Musaraj 882b0aac19
DEV: Let themes extend color definitions (#10429)
Themes can now declare custom colors that get compiled in core's color definitions stylesheet, thus allowing themes to better support dark/light color schemes. 

For example, if you need your theme to use tertiary for an element in a light color scheme and quaternary in a dark scheme, you can add the following SCSS to your theme's `color_definitions.scss` file: 

```
:root {
  --mytheme-tertiary-or-quaternary: #{dark-light-choose($tertiary, $quaternary)};
}
```

And then use the `--mytheme-tertiary-or-quaternary` variable as the color property of that element. You can also use this file to add color variables that use SCSS color transformation functions (lighten, darken, saturate, etc.) without compromising your theme's compatibility with different color schemes.
2020-08-18 13:02:13 -04:00
Joffrey JAFFEUX b98cf565d1
FIX: makes group_show_serializer#is_group_owner follow standards (#10466)
It should only return if is_group_owner, otherwise the field won't be present in json.
2020-08-18 18:30:08 +02:00
Robin Ward bad7c287dd
FIX: Always wait for promise when loading a topic (#10465)
It turns out that `setupController` doesn't always wait when returning a
promise, but the `model` hook does. This fixes issues with the
`page:changed` event firing before the transition has complete.
2020-08-18 11:11:02 -04:00
Joffrey JAFFEUX 93a370863f
FIX: more efficient and resilient widget-dropdown body (#10458) 2020-08-18 13:39:08 +02:00
Vinoth Kannan 562180dd9a
FEATURE: add option to skip new user tips in first notification. (#10462) 2020-08-18 13:43:40 +05:30
Guo Xiang Tan 92b7fe4c62
PERF: Add partial index for non-pm search. 2020-08-18 15:55:08 +08:00
Martin Brennan bb74ccf288
FIX: Add bookmark-list component (#10451)
Moving the bookmark list into its own component to solve click binding issues for external links, because controllers are not the place for DOM manipulation!
2020-08-18 12:15:00 +10:00
Blake Erickson ba9fbb3443 FIX: Composer upload icon regression because of HEIC
Now that HEIC conversion is enabled by default we need to update a few
file extension checks to include `heic` and heif` formats.

https://meta.discourse.org/t/-/144326/23?u=blake

bug reported here:

https://meta.discourse.org/t/-/161197?u=blake
2020-08-17 19:39:26 -06:00
Sam Saffron 38e7b1a049
FIX: when destroying uploads clear card and profile background
There is an fk to user_profile that can make destroying uploads fail
if they happen to be set as user profile.

This ensures we clear this information when destroying uploads.

There are more relationships, but this makes some more progress.
2020-08-18 10:55:16 +10:00
David Taylor 5f7839f0a4
FIX: Allow safari to load and autoplay videos in posts
This improves the reloading workaround in a few ways:
  - Multiple videos in posts are now reloaded. Previously only the first was reloaded.
  - An empty `poster` string is treated the same as a missing attribute
  - If the video is set to autoplay, it will be reloaded (and therefore autoplayed correctly)
2020-08-17 23:48:36 +01:00
Robin Ward e2e51ee348 FIX: Refactor broke wizard 2020-08-17 16:34:12 -04:00
Penar Musaraj 2567bb4a67
DEV: Facilitate replacing category lock icon in components 2020-08-17 16:09:17 -04:00
Robin Ward 1a2156a0c2 REFACTOR: Remove `Discourse.BaseUrl` global 2020-08-17 16:08:40 -04:00
Robin Ward 441ac21053 FIX: Broken when iconList missing 2020-08-17 15:49:32 -04:00
Robin Ward 5b2c306bb8 REFACTOR: Remove `Discourse.HighlightJSPath` from globals
Instead we use the session, and pass that along where necessary.
2020-08-17 15:45:44 -04:00
Penar Musaraj 3745f2bb86
FEATURE: Dark mode alternative logos (#10441) 2020-08-17 15:43:20 -04:00
Robin Ward 386a9d26ec REFACTOR: Remove `Discourse.SvgIconList` and `Discourse.SvgSpritePath`
We use the session instead. This patch also removes some jQuery usage in
favor of regular HTML apis
2020-08-17 15:28:22 -04:00
jahan-ggn 65649eaef0
User card settings (#10302)
* settings implemented

* prettier

* settings updated

* rubocop

* prettier

* Revert "rubocop"

This reverts commit 7805145a7d.

* Revert "prettier"

This reverts commit 2c53f4fa12.

* settings updated and changed

* rubocop

* changes applied

* final changes done

* Server side feature added

* spec changed

* changed user_updater and profile file

* Fix user card specs

* web hook serializer solved

* site-setting changed

Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
2020-08-17 12:37:45 -04:00
Mark VanLandingham f2588e1c85
FIX: Clicking on category autocomplete row (#10457) 2020-08-17 11:02:00 -05:00
Joffrey JAFFEUX 6d0eb7178d
FIX: prevents errors on /tags when a tag `constructor` exists (#10449)
This is due to js objects having a constructor property:

```
const obj = {};
obj['constructor'] // return [native code] and not undefined
```
2020-08-17 17:40:34 +02:00
Robert c164e9bbe0
DEV: Add computed property to Create Account modal (#10455)
Carry over the regime used in the Login modal to Create Account to
facilitate overriding of the classes set for the d-modal Component
using a new Computed Property having the same naming convention.
2020-08-17 12:31:41 +01:00
Guo Xiang Tan 872ef82f4d
Revert "PERF: Prefer joins over subquery for `User#private_posts_for_user`."
This reverts commit 05b43e5ae4.
2020-08-17 14:58:47 +08:00
Guo Xiang Tan 05b43e5ae4
PERF: Prefer joins over subquery for `User#private_posts_for_user`.
The subquery here prevents the planner from optimizing the query. As
such, we prefer joining against the requried tables instead.
2020-08-17 14:47:48 +08:00
Kris 630ec7b49c Enable hamburger menu scrolling on mobile, follow-up to 1972364 2020-08-15 20:31:22 -04:00
Robin Ward 58ee947b35 FIX: Mobile group add dropdown was broken
It looks like we removed the bulk add modal but didn't update the mobile
template.
2020-08-14 21:03:41 -04:00
Robin Ward 51a6e96b7f FIX: defer topic was broken 2020-08-14 17:25:37 -04:00
Robin Ward afa9a61080 REFACTOR: These `Discourse` constants do not seem required in vendor 2020-08-14 13:42:15 -04:00
Robin Ward 41fd7a8b72 REFACTOR: Add `themeSettings` to the `helperContext` to avoid a global 2020-08-14 13:34:21 -04:00
David Taylor 8ac85f54fb
DEV: Remove blob: workers from CSP (#10440)
Ace editor is reconfigured to load workers directly from their JS URL. Workers must be on the same origin as the site, so they will not use the CDN.
2020-08-14 18:15:30 +01:00
Robin Ward f52927cd33 REFACTOR: Migrate `screenTrack` to a service 2020-08-14 13:14:17 -04:00
Robin Ward 86aa5d5e48 FIX: `application` controller is not used by the card 2020-08-14 12:49:53 -04:00
Robin Ward 99764d8108 REFACTOR: Don't use container in Scrolling mixin 2020-08-14 12:49:53 -04:00
Robin Ward 37c6fef535 REFACTOR: Remove dead code (property was typo'd, no longer used) 2020-08-14 12:49:53 -04:00
Robin Ward 01e213c930 REFACTOR: Clean up router usage and private APIs 2020-08-14 12:49:53 -04:00
Robin Ward 6a9bde3bf4 REFACTOR: Remove `router:main` and `getOwner` 2020-08-14 12:49:53 -04:00
Robin Ward cf466f7b84 REFACTOR: Simplify `willTransition` 2020-08-14 12:49:53 -04:00
Jarek Radosz 7cc5c5bb31
FIX: DEV: Introduce `@bind` decorator (#10439)
Fixes a bug in `controllers/insert-hyperlink` where `addEventListener` was called with different (anonymous) functions than the matching `removeEventListener` calls.
2020-08-14 17:13:20 +02:00
Guo Xiang Tan 8b811533b1
DEV: Improve readability of setting weights in `SearchIndexer`. 2020-08-14 23:11:41 +08:00
Jarek Radosz a3e2152265
DEV: Add ember-buffered-proxy import shim (#10438)
Just a bit of 🧹
2020-08-14 17:07:17 +02:00
Vinoth Kannan 476d26159a
FEATURE: add new user option `skip_new_user_tips`. (#10437)
And add new site setting `default_other_skip_new_user_tips` in user preferences category.
2020-08-14 19:10:56 +05:30
Jarek Radosz 6287c8e171 FIX: A paste event listener was re-added instead of being removed
cc: @eviltrout 😉
2020-08-14 15:21:27 +02:00
David Taylor 3cf93e9a8f
Revert "DEV: Disable ACE editor worker blobs"
This reverts commit d5463d2a4d.

With S3 assets, CORS prevents loading worker assets directly.
2020-08-14 14:12:11 +01:00
David Taylor d5463d2a4d
DEV: Disable ACE editor worker blobs
This will allow us to remove `blob:` URLs from the worker-src CSP directive
2020-08-14 12:01:46 +01:00
Jarek Radosz be6a73f654 DEV: Fix package.json issues and reroll yarn.lock 2020-08-14 12:00:35 +02:00
Guo Xiang Tan 5819c4cb3b
PERF: Switch to ActiveRecord's upsert in `SearchIndexer`.
On insertion, it uses a single query instead of 2.
2020-08-14 16:15:14 +08:00
Martin Brennan 4670b62969
DEV: IMAP log to database (#10435)
Convert all IMAP logging to write to a database table for easier inspection. These logs are cleaned up daily if they are > 5 days old.

Logs can easily be watched in dev by setting DISCOURSE_DEV_LOG_LEVEL=\"debug\" and running tail -f development.log | grep IMAP
2020-08-14 12:01:31 +10:00
Blake Erickson c2f3c0dc44 FIX: generate_topic_thumbnails job infinitely running for corrupted images
It's possible that the original topic image is broken in some form, so
we shouldn't try and generate a topic thumbnail for it. The fix will
prevent the generate_topic_thumbnails job being enqueued every time the
topic is viewed.
2020-08-13 17:08:32 -06:00
Neil Lalonde d65a839577
FEATURE: allow group membership to unmute categories and tags
For sites that are configured to mute some or all categories and tags
for users by default, groups can now be configured to set members'
notification level to normal from the group manage UI.
2020-08-13 17:20:53 -04:00
Kris 18fb34bf2e formatting follow-up to 32102dd 2020-08-13 17:01:22 -04:00
Kris 32102ddff3 UX: Use the same formatting for both user and group card bios 2020-08-13 16:55:30 -04:00
Mark VanLandingham b9891e3def
FIX: Update preview when autocomplete is clicked (#10430) 2020-08-13 15:42:38 -05:00
Jarek Radosz d0d651d8bc
FIX: Prevent `LockOn` conflicts (#10422)
If there's already a `LockOn` instance, clear its lock before creating creating a new one. Fixes a shaky viewport effect after certain transitions.

Includes:
* Slight refactor (elementId wasn't an id, but a selector - it included the "#" prefix)
* Add support for a[name=X] anchors in `jumpToPost`
* Scope down anchors to the #main element (Embeded fontawesome sprites are causing conflicts, e.g. when given `bed` anchor, `<a name="bed">` was at odds with `<symbol id="bed" viewBox="0 0 640 512">(…)</symbol>`)
2020-08-13 19:39:40 +02:00
Robin Ward ba3ee3444e
FIX: Move queryParams to each discovery controller rather than shared (#10424)
* REFACTOR: `refreshSort` doesn't cause it to sort again, it's misleading

* FIX: Move queryParams to each discovery controller rather than shared

This fixes issues where params previously would not reset between
routes. For example if you added `max_posts=1` to /latest and then went
to a category.

* Add backward compatibility for (action "changeSort") for themes

* FIX: refreshing was not working

* Update app/assets/javascripts/discourse/app/controllers/discovery/topics.js

Co-authored-by: Jarek Radosz <jradosz@gmail.com>

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2020-08-13 11:33:46 -04:00
Jarek Radosz ab5df7b2bd
FIX: Preserve anchors in permalink transitions (#10421)
When visiting a permalink with an anchor (e.g. /important-link#notes) the anchor part was being dropped during redirection.

The change doesn't have a test. Functions like scrollToPost or scrollToElement don't have any effect in the test environment.
2020-08-13 16:44:34 +02:00
Jarek Radosz 7a8442435c
REFACTOR: `LockOn` class (#10428)
Mostly de-jQuery-ification. This refactor tries to closely preserve the original behavior.

Changes:
* Store the interval inside the class (allows using `clearLock()` on `LockOn` objects)
* Extract the interval function to a separate method
* Math.max result is never undefined (per MDN: "[Return value] The largest of the given numbers. If at least one of the arguments cannot be converted to a number, NaN is returned.")
* Replace jQuery's `offset()`
* Private methods be private
* Native `scrollTop` (jQuery's just a wrapper for this)
* `addEventListener`/`removeEventListener`
2020-08-13 16:43:05 +02:00
Mark VanLandingham 2008ecd68e
DEV: Remove incorrect comment in tag/show controller (#10423) 2020-08-13 09:19:09 -05:00
Krzysztof Kotlarek 7194b31443
FEATURE: don't notify about changed tags for a private message (#10408)
* FEATURE: don't notify about changed tags for a private message

Only staff members observing specific tag should receive a notification

* FIX: remove other category which is not used

* FIX: improved specs to ensure that revise was succesful
2020-08-13 17:22:34 +10:00
Vinoth Kannan 310952fd6a FIX: generate topic excerpt when moving posts to new topic.
Currently, it's not generating the excerpt by default. We have to trigger the "Rebuild HTML" action to do it.
2020-08-13 11:30:14 +05:30
Martin Brennan ef461ffd60
FIX: Make sure user preference to open external links in new tab works for bookmark list excerpts (#10409)
Meta post: https://meta.discourse.org/t/bookmark-page-does-not-respect-open-all-external-links-in-new-tab-user-preference/160118
2020-08-13 14:56:13 +10:00
Kris 9bc992dce4 follow-ups to 1972364: increase notification limit, make show-all a link 2020-08-12 17:14:48 -04:00
Kris 95a454abb6 specificity fix to d1c570c 2020-08-12 16:03:08 -04:00
Vinoth Kannan 6a8562894a FIX: change the controller method name to match its new name.
The controller method `_changeFilters` is now changed to `changeFilters` in the commit 1fc58b5a4e. But it was not modified in the `admin-tools` service script.
2020-08-13 00:58:35 +05:30
Blake Erickson c68563a281 DEV: Improve API usage when creating * updating categories
The category model already has a default value for `color` and
`text_color` so they don't need to be required via the API. The ember UI
already requires that colors be selected.

The name of the category also doesn't need to be required when updating
the category either because we are already passing in the id for the
category we want to change.

These changes improve the api experience because you no longer have to
lookup the category name, color, or text color before updating a single
category attribute. When creating a category the name is still required.

https://meta.discourse.org/t/-/132424/2
2020-08-12 12:28:29 -06:00
Jeff Wong 70d4420c8e DEV: Add profile-hidden selector to user page for styling 2020-08-12 09:48:42 -07:00
Robin Ward 9525d3506b FIX: Heisentest with topic timings
We trigger `/topics/timings` requests without ever caring about the
promise afterwards, so they can bleed from one test to another.

If you're very unlucky, this might happen and then the next test
is testing a subfolder, which means you end up with a path like
`/forum/topics/timings` which is not caught by pretender and causes the
suite to fail.

It's easier (and faster) to never send these requests in test mode
than to track the ajax requests and abort them between runs.
2020-08-12 12:27:17 -04:00
Vinoth Kannan fc5111508f FIX: allow mods to choose restricted categories as parent category.
Currently moderators can't choose a category with only “See” permission as a parent in `edit-category` modal.
2020-08-12 20:58:52 +05:30
Rafael dos Santos Silva 28669dfeb2
PERF: Faster TL3 promotion replies needed calculation (#10416)
Removing the LIMIT makes PostgreSQL use index_posts_on_user_id_and_created_at
which is much faster overall.

Before: 22 seconds
After: 100 ms
2020-08-12 11:28:34 -03:00
Mark VanLandingham 00a0767c35
DEV: Remove directory-toggle component (#10413) 2020-08-12 08:11:32 -05:00
Penar Musaraj 6dd9f2eca2
FIX: color scheme selection with non-default theme
This fixes an issue where a non-default theme set to use the base color
scheme (i.e. the theme had an empty `color_scheme_id`) was loading the
default theme's color scheme instead.
2020-08-12 08:49:13 -04:00
Guo Xiang Tan 808e84a856
FIX: Expose PG headline highlighting for all search results. 2020-08-12 16:43:47 +08:00
Penar Musaraj 8633e3cae8
FIX: iOS/iPadOS freezing when changing notification level in topic footer 2020-08-11 22:39:17 -04:00
Kris d1c570cf2c Hamburger menu needs to be able to scroll, follow-up to 1972364 2020-08-11 22:33:51 -04:00
Martin Brennan 95b71b35d6
FEATURE: IMAP delete email sync for group inboxes (#10392)
Adds functionality to reflect topic delete in Discourse to IMAP inbox (Gmail only for now) and reflecting Gmail deletes in Discourse.

Adding lots of tests, various refactors and code improvements.

When Discourse topic is destroyed in PostDestroyer mark the topic incoming email as imap_sync: true, and do the opposite when post is recovered.
2020-08-12 10:16:26 +10:00
jbrw 6391db5921
FIX: use correct site setting when uploading images 2020-08-11 18:13:55 -04:00
Penar Musaraj c05aced094
FIX: Invalidate cache when updating color scheme colors (#10417) 2020-08-11 16:28:59 -04:00
Joe 1c941a19d7 DEV: removes the Vincent theme from the "popular theme" list
This theme is currently not maintained so it shouldn't be on that list
2020-08-12 03:11:05 +08:00
Vinoth Kannan f3154e783f UX: preload muted categories list to prevent rendering delay. 2020-08-12 00:34:40 +05:30
Blake Erickson ee366f7ac7 FIX: Ensure load more directory items has a .json url
The `/directory_items` route needs to have a .json url, but the rails
url helper `_path` doesn't return the format of the route.

I tried passing in a format options to `directory_items_path`. Which
works in the rails console

```
[8] pry(main)> directory_items_path(params.merge(:format => :json))
=> "/directory_items.json?page=1"
```

but when I added that some logic to the controller it comes out as

```
/directory_items?format=json&page=1
```

(which is actually how I expect it to work based on how you pass in the
format param). Anyways, because I couldn't figure out how to pass a
format to the `_path` helper I just used URI.parse to append `.json`
manually.
2020-08-11 12:43:55 -06:00
Kris cfa37d1670 prevent search panel more link from causing horizontal overflow 2020-08-10 22:15:42 -04:00
Kris 1972364d0f
REFACTOR: Update the notification menu to remove scrolling (#10371) 2020-08-10 16:17:15 -04:00
Joe e3bc8f34ed UX: ensures search results wrap on mobile 2020-08-11 02:17:41 +08:00
David Taylor fe7a7ecf6c
FIX: Include secure media URLs when linking post uploads (#10404)
Normally, secure media urls are linked like `/secure-media-uploads/...`. In this case, uploads were already being linked correctly.

But sometimes (e.g. when pulling hotlinked onebox images) secure media is referenced with a full domain name (`//example.com/secure-media-uploads`). This commit ensures that those uploads are also linked correctly.
2020-08-10 17:59:29 +01:00
Mark VanLandingham b7a092bd28
FEATURE: Group category permissions tab (#10388) 2020-08-10 09:49:05 -05:00
Robin Ward 232d277833 REVERT: Resetting the filters is causing double transitions 2020-08-07 16:41:41 -04:00
Penar Musaraj 31e9e0c41b
UX: Update header background color in mobile app webview
Sends the updated value when switching color schemes.
2020-08-07 16:13:22 -04:00
Jordan Vidrine 77a9c6aa80
FIX: Smaller header font size for published page (#10398) 2020-08-07 13:46:08 -05:00
Rafael dos Santos Silva a97e36cfda
FEATURE: Block vibration in Firefox Android (#10389)
Legacy Firefox Android has some quirks around vibration where it:

- asks for permission
- doesn't persist the permission

This makes the default like vibration popup a permission on Firefox
Android <= 68.

This isn't the case (yet?) on their new Firefox which is rolling out
worldwide right now.

I'd say we merge this now and revert in 3 months or so when
https://arewefenixyet.com/ shows a full rollout.
2020-08-07 15:38:53 -03:00
Régis Hanol bc63232d2e
FIX: sync reviewable count when opening the hamburger menu (#10368)
When a tab is open but left unattended for a while, the red, green, and blue
pills tend to go out of sync.

So whevener we open the notifications menu, we sync up the notification count
(eg. blue and green pills) with the server.

However, the reviewable count (eg. the red pill) is not a notification and
is located in the hamburger menu. This commit adds a new route on the server
side to retrieve the reviewable count for the current user and a ping
(refreshReviewableCount) from the client side to sync the reviewable count
whenever they open the hamburger menu.

REFACTOR: I also refactored the hamburger-menu widget code to prevent repetitive uses
of "this.".

PERF: I improved the performance of the 'notify_reviewable' job by doing only 1 query
to the database to retrieve all the pending reviewables and then tallying based on the
various rights.
2020-08-07 18:13:02 +02:00
jbrw 3593e582a3
FIX - limit number of embedded media items in a post (#10391)
* FIX - limit number of embedded media items in a post

* Add renamed settings to DeprecatedSettings
2020-08-07 12:08:59 -04:00
Penar Musaraj 9c9aa21726
Add site setting to pick dark mode color scheme (#10390)
Co-authored-by: Robin Ward <robin.ward@gmail.com>
2020-08-07 08:52:47 -04:00
Joffrey JAFFEUX b86198198f
FIX: removes persistedQueryParams as it should work out of the box (#10394)
This hack is only attempting to hide something which should have been working in core and for which we should provide a fix soon. Also it's not working as it should.
2020-08-07 09:51:37 +02:00
Guo Xiang Tan cf2797bf58
DEV: Fix lint take 2. 2020-08-07 13:17:51 +08:00
Guo Xiang Tan e2fc05705f
DEV: Fix lint. 2020-08-07 13:16:17 +08:00
Guo Xiang Tan e60c74d3c1
FEATURE: Use PG `ts_headline` for highlighting topic title in search. 2020-08-07 12:43:09 +08:00
Guo Xiang Tan 1d2ba8fd52
DEV: No need to highlight search if PG headline generation is used. 2020-08-07 10:50:30 +08:00
Krzysztof Kotlarek fb9c2e5f89
FEATURE: notification for vote plugin (#10384)
This must exist in core as we want to see a correct notification after disable of the voting plugin.
2020-08-07 09:51:16 +10:00
Blake Erickson 149801f99a FIX: PM participants list refreshing after inviting
When inviting users to a PM a small post is created showing that you
invited the user, but the actual list of participants never updated
until you refreshed the page or interacted with the private-message-map
widget triggering it to refresh. This change will trigger a refresh on
the private-message-map widget ensuring that the UI is updated with the
current list of participants.
2020-08-06 14:57:55 -06:00
Kris 7a1816ce23
DEV: Set application template plugin outlets to tagName="" (#10382) 2020-08-06 16:01:24 -04:00
Robin Ward f03f58e52c REFACTOR: Remove `Discourse` constants from `cleanDOM` 2020-08-06 15:34:20 -04:00
Robin Ward db443d2289 REFACTOR: Use the session for the `ServiceWorkerURL` 2020-08-06 15:24:43 -04:00
Robin Ward 036a79d273 REFACTOR: Use `isTesting()` instead of `Discourse.testing` 2020-08-06 15:18:25 -04:00
Robin Ward a80d749b9d REFACTOR: Remove an unnecessary `Discourse.__container__` 2020-08-06 15:14:20 -04:00
Robin Ward 7cd11bad0c REFACTOR: Use the session to track assetVersion/requiresRefresh
This saves us having to put the data on `Discourse`
2020-08-06 15:09:13 -04:00
Penar Musaraj af63871d4d
FIX: Missing bottom border in select-kit color list settings 2020-08-06 14:52:17 -04:00
Robin Ward 7df57b35da REFACTOR: Remove `Discourse.__widget_helpers`
It's now a variable in the context where the templates are created.
2020-08-06 14:35:46 -04:00
Robin Ward 792bd3faff Remove `getURL` and `getURLWithCDN` deprecations, they have been removed 2020-08-06 14:01:31 -04:00
Neil Lalonde 1ca81fbb95
FEATURE: set notification levels when added to a group (#10378)
* FEATURE: set notification levels when added to a group

This feature allows admins and group owners to define default
category and tag tracking levels that will be applied to user
preferences automatically at the time when users are added to the
group. Users are free to change those preferences afterwards.
When removed from a group, the user's notification preferences aren't
changed.
2020-08-06 12:27:27 -04:00
Jarek Radosz cd4f251891
FEATURE: Poll breakdown 2.0 (#10345)
The poll breakdown modal replaces the grouped pie charts feature.

Includes:

* MODAL: Untangle `onSelectPanel`
Previously modal-tab component would call on click the onSelectPanel callback with itself (modal-tab) as `this` which severely limited its usefulness. Now showModal binds the callback to its controller.

"The PR includes a fix/change to d-modal (b7f6ec6) that hasn't been extracted to a separate PR because it's not currently possible to test a change like this in abstract, i.e. with dynamically created controllers/components in tests. The percentage/count toggle test for the poll breakdown feature is essentially a test for that d-modal modification."
2020-08-06 17:57:06 +02:00
Penar Musaraj 6fdc711b4a
FEATURE: Allow users to opt out of automatic dark mode (#10377) 2020-08-06 09:45:37 -04:00
Joe c047e16285 UX: ensure CSS vars are loaded in the Wizard stylesheet
The in-app select-kit stylesheet references some of the CSS vars we recently added. This commit ensures that those vars are available when that sheet is complied since the wizard lives outside of the app.
2020-08-06 19:19:15 +08:00
Sam Saffron ba482c251c
FIX: stop sync of tracking state when list is filtered
This stops sync of tracking state when list is filtered, in the past this
would cause the tracking state to go off wack.

Additionally this introduces an alias for "filter=tracking", called "f=tracking"

This was done cause the term "filter" is used internally in 2 different ways
the main way is for /unread /new filtering.

Trying to also call a query param "filter" causes enormous amounts of
internal pain, this circumvents the issue.
2020-08-06 16:34:02 +10:00
Guo Xiang Tan 255b0e9f14
PERF: Replace video and audio links in search blurb while indexing.
In the near future, we will be swtiching to PG headlines to generate the
search blurb. As such, we need to replace audio and video links in the
raw data used for headline generation. This also means that we avoid
replacing links each time we need to generate the blurb.
2020-08-06 12:25:03 +08:00
David Taylor ceb858c70a
PERF: Release post_upload records when downloaded image is removed (#10379)
Previously we would unconditionally keep all images downloaded via pull_hotlinked_images, even if they are later removed from the post. This commit removes that logic, and relies on the existing link_post_uploads process to pick up the downloaded images in `cooked`. Specs are added to ensure this is working correctly for regular hotlinked images, and for oneboxes.
2020-08-06 10:06:34 +10:00
Robin Ward 09254410ea FIX: Only raise proper `"error"` messages
Also support "1" for `QUNIT_FAIL_FAST` to make it consistent with other
arguments.
2020-08-05 16:27:06 -04:00
Robin Ward f1b6b1bd0e FIX: Pretender errors were being swallowed
Lots of test were broken and needed fixes.
2020-08-05 15:48:57 -04:00
Robin Ward b0564205d9 FIX: Raise errors for broken pretender responses in test mode 2020-08-05 15:48:56 -04:00
Vinoth Kannan aa017f276f FIX: replace `fullPath` while rewriting the `/my/` URLs.
And added the tests. Follow-up to cdca5a2ee4
2020-08-05 23:22:15 +05:30
jbrw 67e8bc5342
FEATURE - allow category group moderators to split/merge topics (#10351) 2020-08-05 10:33:25 -04:00
Joffrey JAFFEUX b6e475a8f3
FIX: ensures shadow has last_posted_at before comparing to site setting (#10374) 2020-08-05 13:20:51 +02:00
David Taylor cb12a721c4
REFACTOR: Refactor pull_hotlinked_images job
This commit should cause no functional change
- Split into functions to avoid deep nesting
- Register custom field type, and remove manual json parse/serialize
- Recover from deleted upload records

Also adds a test to ensure pull_hotlinked_images redownloads secure images only once
2020-08-05 12:14:59 +01:00
Bianca Nenciu 42f62a9e63
FIX: Shows all_results if current settings category has no results (#10358)
Searching for a specific setting only showed results from the current selected category. Before fixing fd02856, it automatically redirected the user to all_results. This was a problem because the redirect always happened and there was no way to share a link to a specific category.

The fix to this bug is to simply redirect the user to all_results if there are no results to be displayed.
2020-08-05 09:39:54 +02:00
Simon Cossar f78792c779
FEATURE: Add category_id to TopicViewWordpressSerializer (#10372) 2020-08-05 11:50:15 +10:00
Kane York 8850f51fd0
FIX: Show "group members forbidden" message on mobile (#10370)
This commit fixes an oversight in commit 88359b0f16.
2020-08-04 16:16:52 -07:00
Kris eb619c8e98 prevent long email addresses from breaking admin table layout 2020-08-04 16:47:50 -04:00
tshenry 0cda5b9d55
FEATURE: New plugin outlet for category-heading (#10363) 2020-08-04 12:52:43 -07:00
Vinoth Kannan cdca5a2ee4 FIX: rewrite of `/my/`URL should work on sub directory site too. 2020-08-05 00:59:10 +05:30
Joffrey JAFFEUX 4593bb60c5
FIX: allows to change a user group notification level (#10369)
The current code has an ambiguous name of "user" which is actually not a user model, the real user model is accessible on the model key of user.
2020-08-04 21:23:55 +02:00
Penar Musaraj fb91320cba
UX: Refactor pikaday month prev/next button styling
And topic-list last poster halo effect
2020-08-04 14:39:25 -04:00
Robin Ward a1ec711373 FIX: Previous fix comitted the wrong thing and was broken :( 2020-08-04 13:46:26 -04:00
Robin Ward 6da7a97eee FIX: Exclude shared drafts from digests 2020-08-04 13:35:48 -04:00
Neil Lalonde 1bef008a1e
FIX: current value of flair icon missing in group manage UI 2020-08-04 12:41:14 -04:00
Robin Ward 92b26ecbfb REFACTOR: Move Page title / focus / counts logic to service
We had a handful of methods attached to the root `Discourse` object
related to focus and notification counts.

This patch pulls them out into a service called `document-title` for
updating the title, and a component called `d-document` to attach
and listen for browser events related to focus.

It also removes some computed properties and observers in favor of plain
old Javascript objects.
2020-08-04 12:02:25 -04:00
Mark VanLandingham b76731d722
FEATURE: Invite emails to groups from add member modal (#10308) 2020-08-04 10:02:01 -05:00
Penar Musaraj 413fa49032
UX: Refactor lightbox hover drop shadow
For parity with auto dark mode switching, this includes a subtle effect in dark themes too.
2020-08-04 10:43:18 -04:00
Bianca Nenciu 25505978d0
FIX: Check if selectable avatar with SHA1 2020-08-04 16:20:16 +03:00
Joffrey JAFFEUX 8a0478b97d
DEV: adds plugin api to add custom recipients of a post revision (#10367)
* DEV: adds plugin api to add custom recipients of a post revision

Usage:

```
add_post_revision_notifier_recipients do |post_revision|
  [78]
end
```
2020-08-04 11:57:33 +02:00
Guo Xiang Tan 3b08b15855
PERF: Remove one extra call to Redis when searching. 2020-08-04 14:02:02 +08:00
Martin Brennan 5a3494b1e1
FIX: IMAP archive fix and group list mailbox code unification (#10355)
* Fixed an issue I introduced in the last PR where I am just archiving everything regardless of whether it is actually archived in Discourse man_facepalming
* Refactor group list_mailboxes IMAP code to use providers, add specs, and add provider code to get the correct prodivder
2020-08-04 14:19:57 +10:00
Penar Musaraj c937afc75e
FEATURE: automatic dark mode (#10341)
A first step to adding automatic dark mode color scheme switching. Adds a new SCSS file at `color_definitions.scss` that serves to output all SCSS color variables as CSS custom properties. And replaces all SCSS color variables with the new CSS custom properties throughout the stylesheets. 

This is an alpha feature at this point, can only be enabled via console using the `default_dark_mode_color_scheme_id` site setting.
2020-08-03 22:57:10 -04:00
Sam Saffron eb18f91cf7
DEV: new api to iterate through tracked topics
`topicTrackingState.forEachTracked(topic,isNew,isUnread)` can be used to
iterate through tracking state efficiently.

This is handy for extension looking at subsets of tags and categories.
2020-08-04 10:40:03 +10:00
Kris 5e46ec8b76 width fix for category chooser in move posts modal 2020-08-03 17:44:11 -04:00
Penar Musaraj 52b864facf
FIX: bug with sharing when used outside a topic
Followup to ac76bfb, fixes share buttons in topic lists (only used in themes or plugins)
2020-08-03 16:27:11 -04:00
Bianca Nenciu 2682da81ad
FIX: Get correct selectable avatar from URL (#10339)
The URL for selectable avatars was 'cooked' which means that the find_by
method was not enough.
2020-08-03 17:15:41 +03:00
Penar Musaraj e6349685d3
UX: Uniform focus styles for composer inputs/textarea (#10296)
Uses a thin border as indicator that element is in focus for all editable items in the composer (inputs, select kit, textarea).

 Disables a default iOS style that has a blinking background color on inputs/textareas
2020-08-03 10:01:04 -04:00
Gerhard Schlager 957e851ffe Revert "FIX: Regularly reset unknown extension of uploads"
This reverts commit cc7b24b88b as it shouldn't be needed anymore for new uploads.
2020-08-03 13:37:32 +02:00
Joffrey JAFFEUX eb61916e23
UX: allows to navigate widget dropdown with tab and enter (#10356) 2020-08-03 10:37:30 +02:00
Bianca Nenciu 12913a46e4
FIX: Reset max_posts query parameter (#10334) 2020-08-03 11:19:36 +03:00
Penar Musaraj ac76bfb400
Disable social media sharing on private categories, unlisted topics (#10349)
* Do not show social media sharing on private categories, unlisted topics

* Disable quote sharing entirely in private categories and unlisted topics
2020-08-03 17:06:09 +10:00
Blake Erickson 4dae9d458b
FIX: Respect query params for latest.rss (#10350)
Apparently latest.json and latest.rss are not routed to the same
controller methods. This change allows for any passed in query
parameters to actually be applied to the rss route.

This came in as a request on meta:

https://meta.discourse.org/t/-/155812/6
2020-08-03 17:03:58 +10:00
Krzysztof Kotlarek 515699776b
FIX: set mailing_list_mode to false when unsubscribing from all (#10354)
Currently, we only reset `email_digests`, `email_level` and `email_messages_level` when the user wants to unsubscribe from all email.

`mailing_list_mode` should be reset as well
2020-08-03 16:59:54 +10:00
Martin Brennan 2920988b3a
FIX: IMAP sync email update uniqueness across groups and minor improvements (#10332)
Adds a imap_group_id column to IncomingEmail to deal with an issue where we were trying to update emails in the mailbox, calling IncomingEmail.where(imap_sync: true). However UID and UIDVALIDITY could be the same across accounts. So if group A used IMAP details for Gmail account A, and group B used IMAP details for Gmail account B, and both tried to sync changes to an email with UID of 3 (e.g. changing Labels), one account could affect the other. This even applied to Archiving!

Also in this PR:

* Fix error occurring if we do a uid_fetch and no emails are returned
* Allow for creating labels within the target mailbox (previously we would not do this, only use existing labels)
* Improve consistency for log messages
* Add specs for generic IMAP provider (Gmail specs still to come)
* Add custom archiving support for Gmail
* Only use Message-ID for uniqueness of IncomingEmail if it was generated by us
* Various refactors and improvements
2020-08-03 13:10:17 +10:00
Joffrey JAFFEUX 8a9e4504fe
DEV: allows to decouple csv-uploader texts from bulk invite (#10344) 2020-08-01 10:29:09 +02:00
Robin Ward 0b3f963804 FIX: Removes an error in the console in test mode 2020-07-31 14:06:52 -04:00
Régis Hanol da7e6b1f7e DEV: make rubocop 🤖 happy 2020-07-31 18:16:54 +02:00
Régis Hanol 3f59d0cffe
DEV: prevent initialized constant warning
Was tired of seeing the following warnings in the logs

```
/discourse/app/jobs/scheduled/old_keys_reminder.rb:7: warning: already initialized constant Jobs::OldKeysReminder::OLD_CREDENTIALS_PERIOD
/discourse/app/jobs/scheduled/old_keys_reminder.rb:7: warning: previous definition of OLD_CREDENTIALS_PERIOD was here
```
2020-07-31 18:05:12 +02:00
Blake Erickson 8de635fe92
DEV: Show message when cannot invite user to PM (#10336)
* DEV: Show message when cannot invite user to PM

When inviting a user to a PM return a message that says, "Sorry, this
user can't be invited." if they have been muted or are not in a users
allowed pm users list.

* Minor refactor & improved some text
2020-07-31 09:52:19 -06:00
Jordan Vidrine 831802aedc
Change pp to published-page (#10343)
* UI: Markdown Code Wrapping

* pp -> published-page

change to match previous syntax

* pp -> published-page

change to match previous syntax
2020-07-31 09:24:08 -05:00
Penar Musaraj e6dbb4fcf5
DEV: Live refresh all themes when watching stylesheets (#10337) 2020-07-30 19:03:24 -04:00
Simon Cossar 3d9eb3e085
Rename options passed to Readability::Document back to whitelist and blacklist (#10340) 2020-07-30 12:56:48 -07:00
Vinoth Kannan 6a1746a0c5
FEATURE: add expandable muted categories ui to `/categories` page. (#10303)
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2020-07-30 23:32:51 +05:30
Jordan Vidrine f90e02162b
UI: Styling for Published Page (#10335)
* UI: Styling for Published Page

Styling to look more visually connected to Discourse
2020-07-30 10:25:28 -05:00
Dan Ungureanu 5e2e374c72
DEV: Fix build
Follow-up to bd3c0dd59f.
2020-07-30 13:10:16 +03:00
Dan Ungureanu bd3c0dd59f
FEATURE: Show login button on error page if user is not logged in 2020-07-30 12:34:34 +03:00
Sam Saffron dc14d156b6
FEATURE: g,j and g,k to navigate to next and prev topic
After visiting a topic list (by tag / category / top level) we track the list

Once a list is tracked the combo `g` `j` can be used to go to the next topic
in the list and `g` `k` to go to previous topic.

This allows you to quickly work through subsets of topics without having
to navigate back to the top level lists

The shortcut does not work in PM lists yet, or search results, both are
under consideration.
2020-07-30 17:54:47 +10:00
Kris 6da90af6c6 fix triple-click text selection in firefox 2020-07-29 22:38:38 -04:00
Penar Musaraj 25dcc577ae
DEV: More color transformation refactoring 2020-07-29 12:01:12 -04:00
Vinoth Kannan 691edc16c9 FIX: should allow non-ASCII slugs for category pages. 2020-07-29 19:47:57 +05:30