Commit Graph

15798 Commits

Author SHA1 Message Date
Bianca Nenciu f351200683
FIX: Show tag chooser if can_tag_pms (#18107)
The old logic did not make sense and hid the selector from regular users
even if they could tag PMs or showed selector for admins even if they
could not tag PMs.
2022-08-29 15:52:19 +03:00
Andrei Prigorshnev b6e0219a74
DEV: extract until date formatting in a library function (#18003) 2022-08-29 15:45:36 +04:00
Andrei Prigorshnev bbdffff41f
DEV: use the format-age helper on the DnD button on the new user menu (#18108) 2022-08-29 15:21:07 +04:00
David Taylor bad78bfdfb
FIX: Preload topic_list correctly for categories+latest (#18122)
The preload key was changed in e7a84948b9 but this location was missed. This caused an extra AJAX request and left the cached topic list in the PreloadStore, which would then be accidentally used when navigating to the next topic-list route.
2022-08-29 11:17:32 +01:00
Osama Sayegh e6dba65f18
DEV: Include reaction notifications in the likes tab (#18118) 2022-08-29 12:32:50 +08:00
Alan Guo Xiang Tan d80535d78f
UX: Remove focus on hamburger icon after toggle (#18101) 2022-08-29 10:27:24 +08:00
Kris a0f402a957
DEV: plugin outlet for wizard checkboxes (#18113) 2022-08-26 17:03:30 -04:00
Kris faceb989bf
remove focus from sidebar header toggle click (#18088) 2022-08-26 16:00:01 -04:00
Isaac Janzen 614bf76c0b
DEV: update breadcrumbs outlet values (#18111) 2022-08-26 14:26:03 -05:00
Gerhard Schlager ec93bca99e
UX: Remove confusing fallback locale warning (#18096) 2022-08-26 01:22:04 +02:00
Kris 9d9c48fcb8
DEV: allow custom composer heights in CSS (#18094) 2022-08-25 18:12:35 -04:00
Osama Sayegh 97f094e5ee
DEV: Apply model transformer API on more models (#18087)
This commit extends the plugin API introduced in 40fd82e2d1 to the `Bookmark` and `Notification` models. It also refactors the code that's responsible for loading items in the experimental menu to use `async`...`await` instead of `Promise`s.
2022-08-26 00:44:06 +03:00
Andrei Prigorshnev 7be6f341a7
FEATURE: add the set user status button to the new user menu (#18079) 2022-08-25 18:14:42 +04:00
Osama Sayegh 40fd82e2d1
DEV: Add model transformer plugin API (#18081)
This API allows plugins to transform a list of model objects before they're rendered in the UI. At the moment, this API is limited to items/lists of the experimental user menu, but it may be extended in the future to other parts of the app.

Additional context can be found in https://github.com/discourse/discourse/pull/18046.
2022-08-25 15:41:58 +03:00
David Taylor 9ebebfb4cc
FIX: Load admin-specific JS when compiling via ember-cli (#18086)
The previous sprockets implementation was including admin-specific JS in the plugin's main JS file, which would be served to all users regardless of admin status. This commit achieves the same result under the ember-cli plugin asset compiler with one difference: the admin js is compiled into a separate file. That means that in future, we'll be able to make it loaded only for admins. For now though, it's loaded for everyone, just like before.
2022-08-25 11:36:02 +01:00
David Taylor e141208605
DEV: Compile plugin tests using ember-cli (#18074)
For now, `EMBER_CLI_PLUGIN_ASSETS` can be set to 0 to restore the old behavior. This option will be removed very soon.
2022-08-25 09:43:13 +01:00
Alan Guo Xiang Tan e9dac86cc0
FIX: Sidebar hamburger panel dropdown not working for anonymous (#18085)
We were incorrectly trying to render the sidebar sections for a logged
in user.
2022-08-25 16:29:06 +08:00
Alan Guo Xiang Tan 7f198bd975 DEV: Add dedicated translations for links in sidebar
We do not want to depend on existing translations which are used
elsewhere and can break the sidebar experience when changed.
2022-08-25 09:34:36 +08:00
Alan Guo Xiang Tan eb12daa7f8 DEV: Add sidebar community section for anonymous user 2022-08-25 09:34:36 +08:00
Kris 03a599f457
UX: revert sidebar scrollbar repositioning (#18076) 2022-08-24 13:26:25 -04:00
David Taylor e7a84948b9
FIX: Avoid duplicate topic-list requests (#18073)
When preloading topic_list data we were giving it a 'preload key' which was loosely based on the parameters of the list. However, it did not include all parameters, and mismatches between client/server-side logic would cause the preloaded data to be ignored.

This commit simplifies things by using a single key for all topic_list preloading. This works on the assumption that "The first topic_list the JS app will load is the one which was preloaded". That assumption also existed to some extent in the old design, so we don't expect any regressions here.
2022-08-24 11:54:01 +01:00
David Taylor 52f9370bd6
DEV: Remove JQuery from `lib/keyboard-shortcuts.js` (#18056) 2022-08-24 10:22:51 +01:00
David Taylor b175513765
DEV: Enable ember-cli plugin assets by default (#18058)
For now, `EMBER_CLI_PLUGIN_ASSETS` can be set to 0 to restore the old behavior. This option will be removed very soon.
2022-08-24 10:20:38 +01:00
Krzysztof Kotlarek 7a58bd8827
FIX: hide sidebar toggle button when no sidebar (#18068)
When sidebar is not available (for example for anonymous user for sites which requires log in), toggle button should be hidden as well.
2022-08-24 12:09:40 +08:00
Kris 3068df4cea
UX: sidebar styling, spacing consistency, etc (#18059) 2022-08-24 09:33:15 +08:00
Krzysztof Kotlarek 6fb3610f4e
FIX: hide sidebar for anonymous when login required (#18065)
Recently anonymous sidebar was introduced, but it should be hidden when site requires users to authenticate.
2022-08-24 10:04:10 +10:00
Jarek Radosz 87f5715878
DEV: Keep global state reset in a single place (#18049) 2022-08-23 21:09:37 +02:00
David Taylor 851bd78347
DEV: Enable jquery-integration runtime deprecation (#18057)
Omitting the flag from optional-features enables the runtime deprecation notice.

Also introduces `ember-jquery-legacy` which can be used to migrate to the new behaviour early. Details at https://deprecations.emberjs.com/v3.x/#toc_jquery-event

Core does not appear to make use of `originalEvent` in Ember event handlers. When searching for `originalEvent` there are some matches which relate to our pan-events mixin, but this is our own implementation and not affected by this deprecation.
2022-08-23 19:28:22 +01:00
David Taylor 1b180a3bdb
DEV: Remove JQuery from `components/topic-list.js` (#18048) 2022-08-23 19:27:54 +01:00
Jarek Radosz e21d2ac217
DEV: De-jQ sidebar tests (#18050)
And fix a typo
2022-08-23 18:30:07 +02:00
Kris 0cb6b8b263
DEV: prevent class clash with user-field names (#18055) 2022-08-23 11:46:51 -04:00
David Taylor 3b1a46ff37
DEV: Skip loading plugin JS when running only core tests (#18047)
Plugins often change core behavior, and thereby cause core's tests to fail. In CI, we work around this problem by running core CI without any plugins loaded.

In development, the only option to safely run the core tests is to uninstall all plugins, which is clearly a bad developer experience. This commit aims to improve that experience.

The `qunit_skip_plugins=1` flag would previously prevent the plugin **tests** from running. This commit extends that flag to also affect the plugin's application JS.
2022-08-23 10:25:07 +01:00
Krzysztof Kotlarek 2d58996a3b
FEATURE: anonymous sidebar categories and tags (#18038)
Default sidebar tags for not authenticated users can be defined in admin panel. Otherwise, top 5 categories and tags are taken.

Optionally, if categories are set up in permanent order, then the first 5 categories are taken.
2022-08-23 16:20:46 +08:00
Alan Guo Xiang Tan e3501a207f
UX: Add badges section link to community section. (#18044)
We have a link to /badges in the old hamburger dropdown so maintaining
parity here.
2022-08-23 15:42:48 +08:00
Alan Guo Xiang Tan 2bcad12848
DEV: Reorganize user and anonymous sidebar files into respective folders (#18039)
This commit does not change any functionality
2022-08-23 13:17:59 +08:00
Arpit Jalan 5d44c31bfa
UX: do not show site header on wizard pages (#18037) 2022-08-23 10:17:37 +05:30
Jarek Radosz 4ca6717994 DEV: Use `.ember-application` instead of `#main`
`#main` in the test environment is replaced with `#ember-testing`, so this code would break. It never did only because we don't test these code paths 👀
2022-08-23 09:24:00 +08:00
Jarek Radosz 349f6e18f3 DEV: Correctly clear global exported variables 2022-08-23 09:21:28 +08:00
Bianca Nenciu b160331d41
FIX: Move show like logic to client side (#18025)
The logic was added in commit ec8306835d,
to show the like action even if the user could not like the post. It is
not necessary for this logic to be implemented on the server side.
2022-08-22 18:40:09 +03:00
Jarek Radosz 21abcfe5a7
FIX: Track native class deps in discourseComputed (#18023)
Co-authored-by: David Taylor <david@taylorhq.com>
2022-08-22 17:33:32 +02:00
Arpit Jalan b567cebffe
FIX: remove "--composer-height" style when composer is closed (#18022)
* FIX: remove "--composer-height" style when composer is closed

* fix typo

* fix linting
2022-08-22 17:41:56 +05:30
Bianca Nenciu ec8306835d
FIX: Improvements to like button for archived topics (#17951)
* FIX: Do not allow to remove like if topic is archived

* FIX: Always show like button

The like button used to be hidden if the topic was archived and it had
no likes. This commit changes that to always show the like button, but
with a not-allowed cursor if the topic is archived.
2022-08-22 14:58:02 +03:00
David Taylor 33a2624f09
DEV: Introduce flag for compiling Plugin JS with Ember CLI (#17965)
When `EMBER_CLI_PLUGIN_ASSETS=1`, plugin application JS will be compiled via Ember CLI. In this mode, the existing `register_asset` API will cause any registered JS files to be made available in `/plugins/{plugin-name}_extra.js`. These 'extra' files will be loaded immediately after the plugin app JS file, so this should not affect functionality.

Plugin compilation in Ember CLI is implemented as an addon, similar to the existing 'admin' addon. We bypass the normal Ember CLI compilation process (which would add the JS to the main app bundle), and reroute the addon Broccoli tree into a separate JS file per-plugin. Previously, Sprockets would add compiled templates directly to `Ember.TEMPLATES`. Under Ember CLI, they are compiled into es6 modules. Some new logic in `discourse-boot.js` takes care of remapping the new module names into the old-style `Ember.TEMPLATES`.

This change has been designed to be a like-for-like replacement of the old plugin compilation system, so we do not expect any breakage. Even so, the environment variable flag will allow us to test this in a range of environments before enabling it by default.

A manual silence implementation is added for the build-time `ember-glimmer.link-to.positional-arguments` deprecation while we work on a better story for plugins.
2022-08-22 09:56:39 +01:00
Alan Guo Xiang Tan 558e6a3ff4 Review feedback 2022-08-22 15:20:56 +08:00
Alan Guo Xiang Tan 3a5314c792 UX: Fix topic admin menu hidden on narrow screens
When there is not enough window width to display the admin menu on the
right, we display it on the left instead. Behavior is reversed on RTL
layout.

This commit also removes jQUery usage.
2022-08-22 15:20:56 +08:00
Alan Guo Xiang Tan a3565914a4 UX: Adjust scrollbar behaviour in sidebar
Vertical sidebar is only restricted to sidebar sections and not the
footer.
2022-08-22 14:09:39 +08:00
Joffrey JAFFEUX 4e3c688d65
DEV: implements `removeKeys(predicate)` in keyValueStore (#18019) 2022-08-21 19:19:25 +02:00
Jarek Radosz 9130565895
DEV: Async a bit more of Composer (#18013) 2022-08-21 12:11:10 +02:00
Jarek Radosz ff0f43014c
DEV: Remove widget-test helpers file (#18011) 2022-08-21 09:20:45 +02:00
Jarek Radosz 545bfcaca7
DEV: Simplify "Editing a post stages new content" test (#18007) 2022-08-21 09:20:26 +02:00
Jarek Radosz 870ff48470
DEV: Rework two composer actions tests (#18008) 2022-08-21 09:19:39 +02:00
Jarek Radosz d35ffe8361
DEV: `zoom` isn't used anymore (#18016) 2022-08-21 09:18:19 +02:00
Jarek Radosz cb49fcad63
DEV: Clean up keyTrapper prototype override (#18018) 2022-08-21 09:17:33 +02:00
Jarek Radosz dc5dc78309
DEV: Use async and sinon.resolves instead of rsvp (#18001)
…in tests
2022-08-20 11:20:55 +02:00
Isaac Janzen 42385d020d
DEV: Add values to bread-crumbs-right plugin outlet (#18005) 2022-08-19 12:34:46 -05:00
Isaac Janzen ce30422d6c
DEV: Add select-kit option to hide values from preview (#18002)
* DEV: Add select-kit option to hide values from preview
2022-08-19 11:39:58 -05:00
Isaac Janzen 36f766399d
DEV: Add after-title-and-category plugin outlet (#18004) 2022-08-19 11:39:46 -05:00
Osama Sayegh 67bb0d8a55
DEV: Add profile tab to the experimental user menu (#17982)
This commit adds the profile tab to the experimental user menu. We're adding it to the user menu because it contains links/buttons that are not available anywhere else. We may remove the tab again if we find better places for those links/buttons, but for now it'll stay.

For more context on the experimental user menu, see https://github.com/discourse/discourse/pull/17379.
2022-08-19 13:02:11 +03:00
David Taylor 66376a6569
PERF: Minify admin and wizard JS bundles to match app (#17992)
This regressed when we switched these bundles to be compiled by ember-cli. Before/after sizes:

```
          before                  after
admin.js: 1370 KB (190 KB gz) --> 782 KB (125 KB gzipped)
wizard.js: 127 KB ( 22 KB gz) -->  68 KB ( 18 KB gzipped)
```
2022-08-19 08:35:00 +01:00
Alan Guo Xiang Tan 2d1e50911b DEV: Use button for sidebar section header
Buttons can be focused and action triggered via the enter key compared
to a span.
2022-08-19 10:21:36 +08:00
Martin Brennan 49a70a37f1
FIX: Remove last_unread_post excerpt logic for bookmarks (#17979)
The logic to determine what post excerpt to show for
a topic-level bookmark based on the last unread post
was complex and slow, so we decided to remove it and
always just use the first post excerpt.

This commit also fixes an issue where a couple of
instances of for_topic were missed when doing the
Bookmarkable refactors, so:

1. Clicking the topic bookmark link was not taking
   the user to the last unread post
2. When replying to a topic where there was a topic
   level bookmark with the auto delete preference
   of "on owner reply", we were not removing the
   bookmark from the UI correctly.

A test has been added for the former, the latter would
be quite time-consuming to test and not really worth
it considering it's quite an edge case UI bug.
2022-08-19 09:35:25 +10:00
David Taylor df9e546f5d
DEV: Abort qunit tests when clicking in the toolbar (#17989)
Ever opened `/tests`, immediately tried to change the config, and got frustrated that focus keeps getting stolen by the running tests? Worry no more - this commit will make the tests auto-abort when you click any of the input/dropdowns in the QUnit header. It's not perfect - abort will wait until the end of the currently running test, so sometimes focus will be stolen one more time. But it's still a lot better than having to manually find and click the abort button.
2022-08-18 23:32:38 +01:00
David Taylor c63580b226
DEV: Add hint when qunit assertion fails and app is unsettled (#17984) 2022-08-18 16:19:46 +01:00
Andrei Prigorshnev e49167b311
UX: Improve empty state copy on the activity/replies page (#17784) 2022-08-18 18:00:15 +04:00
Andrei Prigorshnev d7c1ff3116
UX: show blank page placeholder instead of the blue panel that says "No Activity" (#16293) 2022-08-18 17:24:52 +04:00
Arpit Jalan 1e58bed4d2
DEV: add tests for --composer-height calculation (#17986)
Follow up for 2b43238973
2022-08-18 18:03:15 +05:30
Jarek Radosz 7b51ac418b
DEV: Asyncify most of Composer controller (#17974)
…and fix cases where we were breaking the promise/async chain (by not awaiting or not returning promises)
2022-08-18 13:58:08 +02:00
Arpit Jalan a252bbf3e8
FIX: show hide bootstrap mode notice in real time (#17981) 2022-08-18 17:09:33 +05:30
Andrei Prigorshnev be1b202fd6
FEATURE: show default custom date on time-shortcut-pickers (#17867) 2022-08-18 14:55:54 +04:00
Alan Guo Xiang Tan 5990842dd9 UX: Revamp styling of sidebar
The following changes are made in this commit:

1. Move caret icon in sidebar section header to the right.
1. Each row in sidebar takes the full width which enables us to do a
full width highlight on hover and when sidebar link is active.
1. Ensure each row in Sidebar is of the same height.

Internal refs: /t/70546, /t/72196, /t/71820
2022-08-18 16:14:49 +08:00
David Taylor 44c53cb3bf
DEV: Update internal `package.json` metadata (#17978)
These packages are not published anywhere - they only exist for organizational purposes within this repository. Even so, it makes sense for their metadata to match that of the top-level discourse/discourse repository.
2022-08-17 23:27:16 +01:00
David Taylor 72ea00d0cc
DEV: Add progress output in CI during ember-cli build (#17977)
By default, in CI environments, Ember CLI does not output anything between "building..." and "cleaning up". Depending on configuration and hardware, Discourse asset builds can take upwards of 60s, and so this lack of output can make the build feel 'stuck'.

This commit introduces an addon which checks for CI mode, and then outputs status information periodically. The logic is very similar to Ember CLI's non-CI progress output implementation (https://github.com/ember-cli/ember-cli/blob/04a38fda2c/lib/models/builder.js#L183-L185).
2022-08-17 22:39:52 +01:00
David Taylor e70bab16e0
DEV: Ensure custom ember-cli addons only output JS files (#17976)
Without this filter, a binary file (e.g. `.DS_Store`) in one of these addon directories will be concatenated into the output JS. Note that this filter is applied at the end of the build pipeline, so any hbs files have already been transpiled into `.js`.

This mirrors the filtering performed on the main application bundle by Ember CLI: https://github.com/ember-cli/ember-cli/blob/04a38fda2c/lib/broccoli/default-packager.js#L1255
2022-08-17 21:42:55 +01:00
Jarek Radosz 665327f7a4
DEV: Clean up `loadDraft()` (#17969) 2022-08-17 20:43:35 +02:00
Arpit Jalan 2b43238973
FIX: set --composer-height when the composer is in collapsed state (#17968) 2022-08-17 20:51:09 +05:30
Jarek Radosz 83a975a28b
DEV: Await for all async MessageBus callbacks (#17966)
Should take care of yet another category of flaky tests
2022-08-17 12:44:48 +02:00
Osama Sayegh 129885c260
DEV: Add test for arrow keys navigation in the experimental user menu (#17961)
This test is extracted from the changes proposed in: https://github.com/discourse/discourse/pull/17379.
2022-08-17 11:51:29 +03:00
Alan Guo Xiang Tan 95c7cdab94 DEV: Template colocation for sidebar files
We can finally rely on template colocation in our app and we'll be
standarizing on that in the near future. However, I want to have sidebar
adopt this convention earlier.
2022-08-17 16:44:04 +08:00
Alan Guo Xiang Tan 0f0ea75a21
DEV: Display Sidebar template for anonymous user (#17962)
Setup the stage for the sidebar which will be shown to anonymous users.
2022-08-17 16:17:36 +08:00
Arpit Jalan 42c64abe15
FEATURE: open create invite modal from the bootstrap notice banner (#17960) 2022-08-17 13:11:09 +05:30
Alan Guo Xiang Tan 97a20d6d82
UX: Sort tags alphabetically in sidebar (#17959) 2022-08-17 14:47:29 +08:00
Alan Guo Xiang Tan f7ed09a02c
UX: Sort categories alphabetically in Sidebar (#17958) 2022-08-17 12:39:02 +08:00
Alan Guo Xiang Tan 4657110c35
UX: Make category section link icons consistent with Sidebar's interface (#17922)
Instead of relying on another help to generate the icons, we want to
rely on the interface for adding prefix icons. This ensures that prefix
icons are consistent across the section links in Sidebar
2022-08-17 09:40:43 +08:00
Penar Musaraj 2e09a88a29
A11Y: Accessible full-screen and minimize composer buttons (#17936) 2022-08-17 09:39:41 +08:00
Penar Musaraj c790b0305c
A11Y: Use button in `d-modal-cancel` component (#17938)
Fixes issue under User profile > Preferences > Security > Recently Used
devices > Cog icon. And cleans up the "reply where" modal as well.
2022-08-17 09:39:28 +08:00
Arpit Jalan f788c1b3e4
FIX: welcome topic title was not editable (#17950)
The topic title was not editable when composer was opened from the
welcome topic banner.
2022-08-16 21:27:40 +05:30
David Taylor 3e010bc88c
DEV: Ensure RenderGlimmer handles in-place component changes (#17946)
If a widget toggles between displaying two different RenderGlimmer instances, the Widget framework treats them as the same, and so `update()` is called rather than destroy/init. This commit detects this scenario and manually destroys/inits to ensure the correct component is being rendered.
2022-08-16 16:44:21 +01:00
Penar Musaraj e862373899
A11Y: Don't include aria on reply count `span` element (#17948) 2022-08-16 10:28:31 -04:00
Jarek Radosz 5c6f8d64f9
DEV: Use afterEach instead of try/finally (#17944)
Also removes _clearSnapshots calls, as those are already being reset in testCleanup
2022-08-16 10:49:09 +02:00
Jarek Radosz 53af30ec3f
DEV: Do the full cleanup after **every** test (#17943)
Previously the global state wasn't cleared in some cases leading to widespread test failures.
2022-08-16 10:48:32 +02:00
Jarek Radosz 655941b79c
DEV: Await for async helpers (#17942)
Fixes flaky tests. Also, a typo.
2022-08-16 10:48:17 +02:00
Jarek Radosz 7673899a6b
DEV: Remove commented-out code (#17945) 2022-08-16 10:46:26 +02:00
Alan Guo Xiang Tan 083c0074d6
DEV: Remove code that is not being used (#17941) 2022-08-16 13:58:43 +08:00
Alan Guo Xiang Tan 7a05a9d411
UX: Make Sidebar more consistent with user menu on mobile (#17940)
Before this commit, we carried custom code and styles for the sidebar on
mobile. This meant the look and feel of bringing up the sidebar on
mobile was very different from the user menu resulting in a very
inconsistent experience on mobile. Also, we could not leverage on the
existing swipe to close support on mobile.

In this commit, we made it such that the sidebar dropdown is always
rendered on mobile and made the interaction with the dropdown more
consistent with the user menu. There is also more parity with the old
hamburger dropdown when the experimental sidebar is disabled.
2022-08-16 13:45:32 +08:00
David Taylor e4de738f59
DEV: Introduce on-resize modifier and service (#17935)
This commit introduces a new `{{on-resize}}` modifier along with its companion `resize-observer` Service. These automatically take care of setting up the observer and handling cleanup.
2022-08-16 10:39:42 +08:00
Osama Sayegh 75599fb88e
DEV: Refactor new user menu files (#17879)
This commit includes the changes proposed in #17823. I've made these changes so that plugins that need to add tabs/lists with mixed item types - like the bookmarks tab that displays notifications and bookmarks - to the menu, don't have to write 2 templates like we currently do for the bookmarks/messages tabs (see user-menu/bookmark-notification-item.js that has been deleted in this commit).
2022-08-16 10:37:56 +08:00
Penar Musaraj b930f4886a
UX: Add flat text button styles and use in date/time cancel modal (#17892)
Also fixes an A11Y issue with the date/time cancel button.
2022-08-15 15:06:03 -04:00
Jarek Radosz 5043669d05
DEV: Proxy `mobile_view` param to /bootstrap.json (#17934)
Without this it took an extra request for the setting to take in dev mode.

Also, append `preview_theme_id` only when present.
2022-08-15 18:56:38 +02:00
Jarek Radosz 2a1de963ac
DEV: Fix /logs in dev env (#17933)
The space character was missing in CSP between `_lr` and `logs` urls.
2022-08-15 18:56:23 +02:00
David Taylor 55f34c45c6
DEV: Modernise discovery controller query parameter construction (#17927)
Using `URLSearchParams` means that we don't have to manually encode/join strings
2022-08-15 17:20:44 +01:00
David Taylor 7067f13169
DEV: Silence resolver deprecations for now (#17931)
These are in widespread use, and upgrading themes/plugins right now would break their compatibility with the stable branch. These should be unsilenced for the release of 2.9.0 stable.
2022-08-15 16:11:46 +01:00
David Taylor 3ffc213fa9
FEATURE: Add safe-mode toggle to `/u/admin-login` (#17930)
Previously, this would require manually adding `?safe_mode=...` multiple times during the email-based login flow. `/u/admin-login` is often used when debugging a site, so it makes sense for this to be easier.

This commit introduces a new checkbox on the `/u/admin-login` screen. When checked, it'll set the safe_mode parameter on the `/email-login` link, and then pass it all the way through to the homepage redirect.
2022-08-15 15:30:07 +01:00
David Taylor 64a66cf82b
UX: Improve safe-mode usability (#17929)
- `no_custom` -> `no_themes` (history: before themes existed, we had a similar tool called 'customizations')
- `only_official` -> `no_unofficial_plugins` (matches format of `no_themes` and `no_plugins`, and makes it clear that this doesn't affect themes)
- `?safe_mode=no_themes%2C%no_plugins` -> `?safe_mode=no_themes,no_plugins` (the query portion of a URL does not require commas to be encoded. This is much nicer to read)
- If `no_plugins` is chosen from `/safe-mode` the URL generated will omit the superfluous `no_unofficial_plugins` flag
- Some tweaks to copy on `/safe-mode`
2022-08-15 15:15:15 +01:00
David Taylor a9e9adf253
DEV: Modernise rest adapter query parameter construction (#17925)
Using `URLSearchParams` means that we don't have to manually encode/join strings
2022-08-15 14:44:07 +01:00
David Taylor b6c6c803c2
DEV: Allow safe_mode and preview_theme_id to work via ember-cli proxy (#17928) 2022-08-15 14:43:43 +01:00
David Taylor 3d070b4a32
FIX: Ensure topic-list adapter never serializes `undefined` (#17924)
There was existing logic for this, but it was broken because the values were being run through `encodeURI` before checking its type. This commit takes the opportunity to modernise the function to use `URLSearchParams`, which means we no longer need to handle encoding/joining strings manually.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2022-08-15 12:16:01 +01:00
David Taylor 6e5f08543e
DEV: Modernise navigation-item query parameter construction (#17926)
Using `URLSearchParams` means that we don't have to manually encode/join strings
2022-08-15 12:12:32 +01:00
David Taylor a185713e5f
DEV: Ensure date-time-input-range-test works in all timezones (#17923)
The test was failing when run outside of the UTC timezone
2022-08-15 11:28:30 +02:00
David Taylor 6cac35ca29 DEV: Update JS class sorting to match new lint rule 2022-08-15 09:28:31 +01:00
Krzysztof Kotlarek 8cd1340170
Revert "DEV: Experimental scroll sidebar to specific element event handler (#17727)" (#17920)
This reverts commit af912b4b0e.
2022-08-15 11:10:58 +08:00
Alan Guo Xiang Tan 5a271fdc90
DEV: Skip flaky sidebar test (#17918)
The test is still useful and I intend to look at it in the future but
this is not the utmost priority at this point.

Follow-up to 68cefc9f9d
2022-08-15 10:33:59 +08:00
Penar Musaraj c66d544cf9
A11Y: Keep composer as focused element when dismissing Link modal via keyboard (#17893) 2022-08-15 09:37:19 +08:00
Jarek Radosz cac1608213
DEV: Fix `sidebar-hidden` localStorage value (#17915)
Previously ,`undefined` value for `sidebar-hidden` would mean "hide". Not it uses `true`.

Also, extract it into a const.
2022-08-15 09:35:01 +08:00
Jarek Radosz afaa2d5417
DEV: Fix localStorage test leakage (#17917)
We weren't clearing the store in all cases.
2022-08-15 09:33:25 +08:00
Arpit Jalan 3a21618e4e
FEATURE: allow wizard checkbox field to be disabled (#17916)
* FEATURE: allow wizard checkbox field to be disabled

* Changes per review feedback
2022-08-15 05:52:07 +05:30
Jarek Radosz 0be67cb513
DEV: Fix random test ordering (#17905)
And don't reorder failed tests when providing a seed - that was making failure debugging more difficult.
2022-08-15 02:04:44 +02:00
Jarek Radosz f25e779226
DEV: Prefer kvs over raw localStorage (#17907) 2022-08-14 17:31:49 +02:00
Jarek Radosz 92035cdc62
DEV: Change test localStorage prefix (#17906)
…to something more easily recognizable and less collision-prone
2022-08-14 17:31:37 +02:00
Joffrey JAFFEUX ccd76ec48d
FIX: markdown-it parse fn requires an env arg with {} as default (#17900)
See https://markdown-it.github.io/markdown-it/#MarkdownIt.parse for more details
2022-08-13 15:56:41 +02:00
Joffrey JAFFEUX 7476c22324
DEV: implements parseAsync in discourse/lib/text (#17899)
`parseAsync` allows to parse a block of markdown into tokens.

Usage:

```javascript
import { parseAsync } from "discourse/lib/text";

// ...

await parseAsync("**test**").then((tokens) => {
 console.log(tokens);
})
```
2022-08-13 14:25:32 +02:00
Joffrey JAFFEUX 3dac4fe075
A11Y: ensures featured topic btn is focused when modal closes (#17898) 2022-08-13 14:21:58 +02:00
Isaac Janzen 5e521b6c0d
DEV: Add before-composer-fields plugin outlet (#17891)
Add ability to insert content before composer-fields
2022-08-12 15:37:41 -05:00
Joffrey JAFFEUX bcb89beb99
A11Y: makes toolbar tabindex independent from its context (#17889)
Prior to this fix, if `<DEditor />` was used in a context where quote would not be the first button, then no  button would be focusable.
2022-08-12 15:24:20 -04:00
Joffrey JAFFEUX 494cc2c69d
A11Y: moves anchor rendering out of conditional to prevent losing focus (#17887) 2022-08-12 15:20:18 -04:00
Rafael dos Santos Silva 5afdf24292
FEATURE: PWA users are prompted for push before first post (#17888) 2022-08-12 15:30:28 -03:00
David Taylor 636be8cac5
DEV: Remove `discourse/components/glimmer` superclass (#17877)
This was a temporary solution while we updated the resolver and migrated all our singletons to true ember services. Now that's done, we can switch to use `@glimmer/component` directly, and explicitly inject services as required.
2022-08-12 17:05:51 +01:00
Penar Musaraj 2c5ab47204
FIX: Regression with Categories nav item (#17885) 2022-08-12 11:30:39 -04:00
Osama Sayegh 69664d2153
DEV: Make group message summary notification Link to the group inbox (#17884)
This fix is for the experimental user menu.
2022-08-12 15:15:43 +03:00
Osama Sayegh b5a6015155
DEV: Fallback to `bookmarkable_url` if bookmark reminder notification has no topic info (#17883)
This fix is for the experimental user menu. Some `bookmark_reminder` notifications may not be associated with a topic/post (e.g. bookmark reminder for a chat message) in which case the default notification renderer cannot figure out the `href` for those `bookmark_reminder` notifications. This commit teaches the `bookmark_reminder` notification type renderer to fallback to `bookmarkable_url` that's present in the notification data if the default notification renderer doesn't return a `href` for the notification.
2022-08-12 14:40:44 +03:00
Alan Guo Xiang Tan b653b86806
DEV: Remove undefined in Sidebar::SectionLink class attribute (#17881) 2022-08-12 12:12:39 +08:00
Alan Guo Xiang Tan 68cefc9f9d
DEV: Remove flaky sidebar acceptance test. (#17882)
At a certain point, the cost of debugging a flaky acceptance test is
just too high for what we're testing for here. I've decided to just
accept the risk of a minor UX feature.

Follow-up to 55fa94f759
2022-08-12 12:12:19 +08:00
Alan Guo Xiang Tan 3deabb00d4
DEV: Route PM only tags to PM tags show route (#17870)
Previously, PM only tags were being routed to the public topic list with
the tag added as a filter. However, the public topic list does not fetch
PMs and hence PM only tags did not provide any value when added to the
Sidebar. This commit changes that by allowing the client to
differentiate PM only tag and thus routes the link to the PM tags show
route.

Counts for PM only tags section links are not supported as of this
commit and will be added in a follow up commit.
2022-08-12 11:26:56 +08:00
David Taylor e4fbb3be21
DEV: Update composer-fullscreen-prompt to template-only component (#17871)
1. Replace `{{did-insert` with the builtin `{{on` modifier
2. Move the i18n call into the template

With both of those changes, there is no logic left in the backing class, so we can switch to `templateOnly()` which is significantly faster. (granted, not a big deal for a component like this, but it makes for a good demonstration)
2022-08-12 10:43:38 +08:00
David Taylor 06030743e8
DEV: Update sidebar components to use `@glimmer/component` (#17875)
Now that all of our singletons have been converted to true Ember Services, we can remove our custom `discourse/component/glimmer` superclass and use explicit injection

This also updates `section-message` to be a templateOnly glimmer component rather than a classic component.
2022-08-12 07:07:57 +08:00
David Taylor cef264ab1f
DEV: Update welcome-topic-banner to use `@glimmer/component` (#17876)
Now that all of our singletons have been converted to true Ember Services, we can remove our custom `discourse/component/glimmer` superclass and use explicit injection
2022-08-11 18:47:15 +01:00
Vinoth Kannan fe436523a5
FIX: don't preview color scheme if it's not current user's profile. (#17855) 2022-08-11 19:47:49 +05:30
Joe c85921a548
FEATURE: Adds full screen composer submit button and prompt (#17839)
Context: https://meta.discourse.org/t/still-display-the-reply-create-topic-button-when-using-full-screen-composition/123597/6?u=johani

Right now, we don't show the submit buttons when you enter the full-screen composer. The reasons for that are described in the context link above.

This PR adds the improvements highlighted here: https://meta.discourse.org/t/still-display-the-reply-create-topic-button-when-using-full-screen-composition/123597/12?u=johani

Here's a list of the changes this PR introduces:

1. When you enter full-screen mode, we will now add a prompt that matches the browser fullscreen <kbd>F11</kbd> function. It looks like so

    <img width="500" src="https://user-images.githubusercontent.com/33972521/183529813-71a20167-a661-466c-b9ef-c4d34e231000.png">
    
    The prompt fades away after a couple of seconds.
    
2. This PR adds the submit buttons to the full-screen composer mode. The submit buttons should work like normal if the post has no errors. If the post has errors (title too short, body too short, required categories/tags), then the button will make the composer exit the full-screen mode so that users will see the errors and fix them. The error logic is based on what we currently have; this PR doesn't add any new validation. Here's a video of what that looks like:

    https://meta.discourse.org/t/-/127948/14?u=johani
2022-08-11 14:38:56 +08:00
David Taylor 5ee2741a4c
DEV: Update user-menu components to use `@glimmer/component` (#17869)
Now that all of our singletons have been converted to true Ember Services, we can remove our custom `discourse/component/glimmer` superclass and use explicit injection
2022-08-11 07:56:52 +03:00
Andrei Prigorshnev e87ca397be
FEATURE: show status in search results when mentioning user in composers (#17811) 2022-08-10 19:49:26 +04:00
Alan Guo Xiang Tan 55fa94f759
DEV: Attempt to fix flaky sidebar test (#17852)
Makes displaying and hiding the list more deterministic.

```
Error: QUnit Test Failure: Exam Partition 1 - Acceptance: Sidebar - Community Section: clicking on more... link
not ok 491 Firefox 91.0 - [722 ms] - Exam Partition 1 - Acceptance: Sidebar - Community Section: clicking on more... link
    ---
        actual: >
            true
        expected: >
            false
        stack: >
            @http://localhost:7357/assets/core-tests.js:9826:14

        message: >
            additional section links are hidden
        negative: >
            false
        browser log: |
```
2022-08-10 21:22:55 +08:00
Alan Guo Xiang Tan 5283088269
DEV: `site-settings:main` -> `service:site-settings` (#17854) 2022-08-10 21:08:25 +08:00
Bianca Nenciu e029a9b36c
FEATURE: Allow private themes to be partially installed (#17644)
A public key must be added to GitHub when installing private themes.
When the process happens asynchronously (for example if the admin does
not have admin permissions to the GitHub repository), installing
private themes becomes very difficult.

In this case, the Discourse admin can partially install the theme by
letting Discourse save the private key, create a placeholder theme and
give the admin a public key to be used as a deploy key. After the key
is installed, the admin can finish theme installation by pressing a
button on the theme page.
2022-08-10 13:30:18 +03:00
Osama Sayegh 590a13377b
DEV: Fix the build (#17853)
473695ee4d and 23520b88c2 were merged very close to each other, but they had some subtle conflicting changes that broke some tests.
2022-08-10 10:10:34 +03:00
Osama Sayegh 473695ee4d
DEV: Add messages tab to the new user menu (#17850)
Some of the changes in this PR are extracted from https://github.com/discourse/discourse/pull/17379.

Similar to the bookmarks tab in the new user menu, the messages tab also displays a mix of notifications and messages. When there are unread message notifications, the tab displays all of these notifications at the top and fills the remaining space in the menu with a list of the user's messages. The bubble/badge count on the messages tab indicates how many unread message notifications there are.
2022-08-10 08:25:39 +03:00
Alan Guo Xiang Tan 23520b88c2
DEV: Add `registerUserMenuTab` plugin API (#17851)
Co-authored-by: OsamaSayegh <asooomaasoooma90@gmail.com>
2022-08-10 13:21:37 +08:00
Kris 424e968538
UX: add left sidebar toggle when sidebar enabled (#17831) 2022-08-10 10:12:35 +08:00
Arpit Jalan 10a1b6b0a9
FEATURE: update bootstrap mode notice to add invite and wizard links (#17822)
* FEATURE: update bootstrap mode notice to add invite and wizard links

* Updates per feedback on PR

* Fix the wizard link not showing

* Remove unneeded function

* Remove router service injection
2022-08-10 00:13:42 +05:30
Arpit Jalan d57bea4de3
FEATURE: add welcome topic cta banner (#17821) 2022-08-09 21:52:39 +05:30
David Taylor 7f9c2c0bfb
DEV: Remove vendored babel and update config for plugins/themes (#17832)
The new plugin list is based on the ones currently used in our ember-cli pipeline, and are based on our official browser support policy.

This commit includes an update to the raw-handlebars compiler to remove the 'very hacky but lets us use ES6' code. It's  served us well for the last 6 years, but the babel config changes broke it (`const` -> `let`). This commit takes the opportunity to refactor it to take a similar approach to PrettyText, by leaning on `mini-loader.js`.
2022-08-09 11:53:24 +01:00
Jarek Radosz 9645cbea26
DEV: Clear extra header buttons (#17829) 2022-08-08 19:57:56 +02:00