Commit Graph

27919 Commits

Author SHA1 Message Date
Joffrey JAFFEUX 6294659022
FIX: LocalJumpError : unexpected return (#18114) 2022-08-27 18:06:56 +02: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
Kris 000c4e1084
UX: fix styles for the wizard congrats step (#18105) 2022-08-26 12:29:40 -04:00
Joffrey JAFFEUX a780b42b03
FIX: prevents iOS software keyboard to hide sk body (#18102) 2022-08-26 14:52:04 +02: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 14ab819c1d
FIX: remove unexpected scrollbar from the new user menu (#18089) 2022-08-25 15:18:26 -04: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 e9e6ab688c
improve sidebar header sub-hovers (#18083) 2022-08-25 09:14:55 +08:00
Kris c5df47d5eb
minor sidebar scrollbar adjustments (#18080) 2022-08-24 15:46:01 -04:00
Kris 14770ed208
remove margin from sidebar sections (#18082) 2022-08-24 15:45:46 -04:00
Kris ba4a4d3297
UX: more apparent focus styles for sidebar headers (#18078) 2022-08-24 14:13:26 -04: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
Martin Brennan 4b84236bc1
PERF: Rely on preload for first_post for TopicBookmarkable (#18066)
In 49a70a37f1 I removed the
topic: :posts preload for TopicBookmarkable, but did not
update the UserTopicBookmarkSerializer to reflect this,
which was causing up to multi-hundred millisecond queries to
be made for each topic bookmark based on the size of the
topic.
2022-08-24 16:01:29 +10: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
Kris c89dc682c9
UX: hide background image in crawler view (#18054) 2022-08-23 18:10:21 -04: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
Jarek Radosz fd2d9a4ba3
Revert "UX: Hide chat image overflow (#18000)" (#18052)
This reverts commit e3108ded11.

Wrong selector, wrong repo 😆 Resubmitted as https://github.com/discourse/discourse-chat/pull/1196
2022-08-23 18:29:52 +02:00
Kris 0cb6b8b263
DEV: prevent class clash with user-field names (#18055) 2022-08-23 11:46:51 -04:00
jbrw ea5d303a07
DEV: Increase timeout when pulling hotlinked image (#18036)
We observed that some sites seemingly put us in a tarpit when we attempt to pull hotlinked images. Increasing the timeout will help in these situations.
2022-08-23 09:38:10 -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 1d1a7db182
DEV: Fix flaky spec due to ordering of Array intersection (#18045)
```
  1) CurrentUserSerializer#sidebar_category_ids includes visible default sidebar categories
     Failure/Error: expect(json[:sidebar_category_ids]).to eq([category.id, category_2.id])

       expected: [378, 379]
            got: [379, 378]
```

Note that in the Ruby doc it says "The order is preserved from the original array". In this case, we want to preserve the order of the site setting.
2022-08-23 16:20:10 +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 d390805e40
UX: Remove sidebar section header background highlight on focus (#18043) 2022-08-23 15:42:25 +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
Krzysztof Kotlarek caab916569
FEATURE: default sidebar categories and tags (#17939)
Ability to set up default sidebar categories and tags for authenticated users
2022-08-22 08:46:20 +10: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 1284d746b0
DEV: Remove `progid:DXImageTransform` (#18017) 2022-08-21 09:17:58 +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
Jarek Radosz e3108ded11
UX: Hide chat image overflow (#18000)
When there was a problem with an image the built-in frame would expand way outside the message.
2022-08-20 11:19:55 +02:00
Jarek Radosz 9b55c42eee
UX: Correctly center the reply-where modal (#17999)
And make the buttons actually full width, and use css vars.
2022-08-20 11:19:38 +02:00
jbrw 73b2522261
FIX: Allow `match_all_tags` to be passed as a URL param (#17972)
`TopicQueryParams` allows for `match_all_tags` to be passed as a query parameter. `TagsController` forces the value to be true.

This change allows a value to be passed, and only sets it to true if no value has been set. It then uses `ActiveModel::Type::Boolean.new.cast` to compare the value.
2022-08-19 15:41:56 -04: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
Frank 6e682cc7c4
FEATURE: Count views on published pages (#17878)
* FEATURE: Count views on published pages

* Removed trailing whitespaces

* Fixed the test
2022-08-19 00:11:19 +08: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
Jarek Radosz 6c46f4af71
UX: Don't shrink avatar/number box (#17985)
Fixes an issue where longer sidebar item text would squeeze the prefix element
2022-08-18 14:36:30 +02: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
Keegan George 602efedd81
UX: Make popup menu options scroll on limited screen height (#17973) 2022-08-17 13:42:25 -07:00
Jarek Radosz 665327f7a4
DEV: Clean up `loadDraft()` (#17969) 2022-08-17 20:43:35 +02:00
Isaac Janzen 48e2b984fb
DEV: Filter topics by tag for categories (#17953)
* DEV: Filter topics by tag for categories and children
2022-08-17 11:51:02 -05: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
David Taylor 913db5d546
PERF: Only load the current user's topic_user for bookmarks list (#17873)
Previously, for every bookmarked topic, all topic_user records were being preloaded. Only the current user's record is actually required.

This commit introduces a new `perform_custom_preload!` API which bookmarkables can use to add custom preloading logic. We use this in topic_bookmarkable to load just the topic_user data we need (in the same way as `topic_list.rb`).

Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
2022-08-17 09:40:24 +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
Roman Rizzi 1434fe3021
FIX: Recover from guardian check when deleting reviewable users. (#17949)
Handles edge-case when a user is an admin and has an associated reviewable. Hitting this exception should be rare since we clear the reviewable when
granting staff to the user.
2022-08-16 11:50:06 -03: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
Penar Musaraj 0d6fd1a606
A11Y: Add clearer focus states for date picker elements (#17890)
Affects date dropdowns, prev/next month arrows and day grid.
2022-08-15 14:50:07 -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 6c13d82630
UX: Reduce font-size of sidebar section link suffix icon (#17919) 2022-08-15 10:34:30 +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
Penar Musaraj a32019d1e7
A11Y: add focus state for advanced search toggles (#17894)
Using `focus-visible` to ensure this only shows when navigating using
a keyboard.
2022-08-15 09:36:55 +08:00
Penar Musaraj 3fd929534c
A11Y: Improve group box hover highlight on dark schemes (#17895) 2022-08-15 09:36:28 +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
Andrei Prigorshnev fdfac8c720
UX: improve styles of the user status message component (#17904) 2022-08-14 18:55:54 +04:00
Jarek Radosz 2361833844
FIX: Don't raise on deleted topic in UpdateHotlinkedRaw (#17901)
Fixes:

```
Job exception: undefined method `acting_user=' for nil:NilClass
```

in
```
/var/www/discourse/lib/post_revisor.rb:181:in `revise!'
/var/www/discourse/app/models/post.rb:646:in `revise'
/var/www/discourse/app/jobs/regular/update_hotlinked_raw.rb:24:in `execute'
```
2022-08-13 22:40:26 +02:00
Jarek Radosz 4f7c29845d
UX: Remove extraneous margins in profile pic modal (#17896)
(notice horizontal margins around "Gravatar")
2022-08-13 17:52:16 +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
Bianca Nenciu 4b70594173
FIX: Reset flair group if user is removed from group (#17862)
The flair used to stay set even if the user was removed from the group.
2022-08-12 15:45:09 +03: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
Roman Rizzi 58b135d6d3
DEV:Using symbols is deprecated, use strings instead (#17874) 2022-08-11 11:33:41 -03: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
David Taylor d6bba1ea9d
DEV: Invalidate theme cache when S3 configuration changes (#17872)
Compiled themes often include upload URLs which will need to be re-calculated
2022-08-11 11:03:57 +01:00
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
Kris 3764ebf963
minor padding update for revamped user-menu (#17864) 2022-08-10 12:17:31 -04:00
Bianca Nenciu 2db076f9c8
FIX: Don't notify editor when category or tag change (#17833)
When a user was editing a topic they were also receiving a notification
if they were watching any of the new category or tags.
2022-08-10 18:55:29 +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
Krzysztof Kotlarek cc84ea2444 SECURITY: Limit email invitations to topic 2022-08-10 11:33:16 +02:00
Bianca Nenciu a0537816fb
FIX: Destroy all posts when hard deleting topic (#17359)
Hard deleting topics that contained soft deleted posts or small actions
used to create orphan posts because only the first post was hard
deleted. This commit adds an error message if there are still posts left
in the topic that must be hard deleted first or hard deletes all small
actions too immediately (there is no other way of hard deleting a small
action because there is no wrench menu).
2022-08-10 12:11:50 +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 47824bc69f
DEV: Bump asset compiler versions (#17843)
This will trigger recompilation of theme/plugin assets following 7f9c2c0b
2022-08-09 12:06:15 +01:00
David Taylor 3c81683955 DEV: Rename `UriHelper.escape_uri` to `.normalized_encode`
This is a much better description of its function. It performs idempotent normalization of a URL. If consumers truly need to `encode` a URL (including double-encoding of existing encoded entities), they can use the existing `.encode` method.
2022-08-09 11:55:25 +01:00
Andrei Prigorshnev 3755bad03c
DEV: return user status on the user search route (#17716) 2022-08-09 14:54:33 +04:00
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
Bianca Nenciu d5dc4ca0e9
FIX: Make word watcher work with nil strings (#17830)
Censoring or replacing nil strings raised an error.
2022-08-08 16:34:51 -03:00
Jarek Radosz 9645cbea26
DEV: Clear extra header buttons (#17829) 2022-08-08 19:57:56 +02:00
Sérgio Saquetim e0f469eab8
FEATURE: Add above-modal-header plugin outlet (#17812) 2022-08-08 14:40:35 -03:00
Jarek Radosz f7e7f9a6a7
DEV: Fix a function name typo (#17828)
Co-authored-by: Osama Sayegh <asooomaasoooma90@gmail.com>
2022-08-08 18:50:39 +02:00
Jarek Radosz 8b8cbe7905
DEV: Set owner of sidebar section objects (#17827)
Allows e.g. `@service` usage in their implementation
2022-08-08 16:35:14 +02:00
Osama Sayegh 4fdb275683
DEV: Add bookmarks tab to the new user menu (#17814)
Some of the changes in this commit are extracted from https://github.com/discourse/discourse/pull/17379.

The bookmarks tab in the new user menu is different from the other tabs in that it can display a mixture of notifications and bookmarks. When there are unread bookmark reminder notifications, the tab displays all of these notifications at the top and fills the remaining space in the menu with the rest of the bookmarks. The bubble/badge count on the bookmarks tab indicates how many unread bookmark reminder notifications there are.

On the technical aspect, since this commit introduces a new `bookmark-item` component, we've done some refactoring so that all 3 "item" components (`notification-item`, `reviewable-item` and the new `bookmark-item`) inherit from a base component and get identical HTML structure so they all look consistent.

Internal tickets: t70584 and t65045.
2022-08-08 17:24:04 +03:00
Andrei Prigorshnev 94ac8611f4
FEATURE: show status on post streams (#17813) 2022-08-08 17:35:26 +04:00
Jarek Radosz e6fa05f8c3
DEV: Asyncify `findTopicList()` (#17816) 2022-08-08 11:46:09 +02:00
Joffrey JAFFEUX 2003c2d4cd
FIX: prevents android keyboard to be hidden instantly on sk focus (#17810) 2022-08-05 13:09:38 -04:00
Andrei Prigorshnev 8f66d57b86
UX: Improve empty state copy on the activity/topics page (#17746) 2022-08-05 18:37:06 +04:00
Andrei Prigorshnev 4283cef2ed
DEV: add status to the user info component (#17809)
We use the user-info component in several places, and we want to show status on some of them. If you want status to appear, do this:

{{user-info showStatus=true}}
2022-08-05 16:54:54 +04:00
Andrei Prigorshnev 9f5ba2db90
DEV: Make it possible to hide tooltip on the user status (#17808)
Sometimes status appears on popovers, and we may not want to show a tooltip in that case. But by default, tooltip is enabled.
2022-08-05 16:53:28 +04:00
Loïc Guitaut 5c37a5d0f2
FIX: Allow to add the same watched word with a different case (#17799)
Currently we can’t add a case-sensitive watched word if another one
exists with a different case. For example, the existing watched word
`Meta` has been created and is case-sensitive. Now an admin tries to add
`metA` while marking it as case-sensitive too, this won’t work and the
word won’t be added.

This patch changes this behavior by allowing to add same words that have
different cases, so the example above will now work as expected.

We still check for uniqueness but case-sensitivy is now taken
into account. It means that if the watched word `meta` already exists
and is not case-sensitive then it will not be possible to add `Meta`
(case-sensitive or not) as `meta` already matches every possible
variations of this word.
2022-08-05 12:18:17 +02:00
Osama Sayegh 0df1c4eab2
DEV: Refactor notification/reviewable items rendering in the new user menu (#17792)
Prior to this commit, we had a default Glimmer component that was responsible for handling generic rendering of notifications in the user menu, and many notification types had a custom Glimmer component that inherited from the default component to customize how they were rendered. That implementation was less than ideal because it meant plugins would have to create Glimmer components to customize notification types added by them and that would make the surface area of the API too big.

This commit changes the implementation so there's only one Glimmer component for rendering notifications, and then notification types that need to be customized can create a regular JavaScript class - `renderDirector` in the code - that provides the Glimmer component with the content it should display. We also introduce an API for plugins to register a renderer for a notification type or override an existing one.

Some of the changes are partially extracted from https://github.com/discourse/discourse/pull/17379.
2022-08-05 07:55:00 +03:00
Arpit Jalan d600c36036
FIX: do not redeem expired invites on new user signup (#17798) 2022-08-05 07:50:48 +05:30
David Taylor c1cdb6bc51
DEV: Replace `topic-tracking-state:main` with `service:topic-tracking-state` (#17802)
This will allow consumers to inject it using `topicTrackingState: service()` in preparation for the removal of implicit injections in Ember 4.0. `topic-tracking-state:main` is still available and will print a deprecation notice.

Ideally we would convert topic-tracking-state into a true service, rather than registering a model instance into the registry. However, inter-dependencies between service injections make this very difficult to achieve. We don't want to block Glimmer Component work, so this commit does the minimum for now.
2022-08-05 08:48:55 +08:00
Peter Wagenet d0cbc61619
DEV: Add jsconfig (#17800)
This enables intelligent IDE features like "Go To Reference" to function correctly within the Discourse core codebase
2022-08-04 22:50:47 +01:00
Ghassan Maslamani 2d6bd30dd8
FEATURE: add image delete button in preview. (#17624)
This commit adds a delete button to the composer preview next to the image scale buttons.

Reference: https://meta.discourse.org/t/image-remover-button-to-composer-preview/233005
2022-08-04 16:33:23 -04:00
jbrw 46f43d4f7c
UX: Display gap between tag sort options on PMs (#17342)
Adjust whitespace on tag sorting options so that the two links are rendered with a gap between them.
2022-08-04 11:45:54 -04:00
Alan Guo Xiang Tan ad18f7488c
FIX: Secondary more section links not marked as active (#17797)
When the route of the link is equal to the active route, we promote it
out of the "more..." links drawer and display it directly under the
community section. This commit fixes a bug where the secondary links in
the "more..." links drawer was not being marked as active.

Follow-up to e09fd7cde2
2022-08-04 18:51:32 +08:00
Alan Guo Xiang Tan 02987e05d5
DEV: Support old hamburger menu custom footer links in Sidebar (#17796)
This commit extends the existing API bridge for supporting custom
general links in the old hamburger menu in Sidebar to support custom
footer links. Custom footer links can be added to the old hamburger
menu via the `api.decorateWidget("hamburger-menu:footerLinks")` API.
Footer links are added into the secondary section of the "More..." links
drawer in the Community section of the sidebar.
2022-08-04 15:05:14 +08:00
Alan Guo Xiang Tan a36584b8c8
Add support for toggling between mobile and desktop view on sidebar (#17794)
In the current hamburger menu dropdown, we have a link which allows users to toggle between mobile and desktop view on mobile and touch devices. This commit brings the same behaviour to sidebar.
2022-08-04 14:26:35 +08:00
Alan Guo Xiang Tan e09fd7cde2
UX: Move About and FAQ links into secondary section in More... dropdown (#17793)
This commit does not change any behaviour of the links and is simply
changing the positions of the links being displayed.
2022-08-04 13:41:08 +08:00
Kris fc421ca41e
UX: update register admin wizard page styles (#17785) 2022-08-03 21:49:21 -04:00
Kris 8177f45369
UX: fix chat lock icon position and background (#17791) 2022-08-03 21:49:08 -04:00
Jean 8ab6b17c36
FIX: show update banner only once on categories with subcategory lists (#17782)
* FIX: show update banner only once on categories with subcategory lists
2022-08-03 15:27:03 -04:00
Kris afa7c1ed9b
UX: account for iPad hub nav when calculating top (#17780) 2022-08-03 12:00:36 -04:00
Osama Sayegh 5c2e909543
DEV: Don't publish to the `/reviewable_counts` channel (#17779)
Follow-up to ce9eec8606.

I did a last-minute refactoring before merging the commit above where I extracted the Message Bus publish call into a new method, but forgot to delete the publish call after adding a call to the new method.
2022-08-03 18:23:43 +03:00
Osama Sayegh 3d7829c01f
FIX: Unsubscribe from the `/reviewable_counts` channel when leaving the review-index route (#17778)
Follow-up to ce9eec8606.

When the review-index route is entered, we listen to the `/reviewable_counts` (or `/reviewable_counts/<user_id>` when the new user menu is enabled) channel so we can listen for changes to reviewables and update the UI accordingly. However, we currently don't unsubscribe when leaving the route which means each time the route is entered, we setup a new listener causing the browser to do unnecessary work and potentially state leakage.
2022-08-03 17:16:02 +03:00
David Taylor 0e6f9ef406
DEV: Replace `site:main` with `service:site` (#17766)
This will allow consumers to inject it using `site: service()` in preparation for the removal of implicit injections in Ember 4.0. `site:main` is still available and will print a deprecation notice.
2022-08-03 14:38:35 +01:00
Osama Sayegh 062a5f316d
DEV: Wire up the dimiss button in the new notifications menu (#17745)
This commit is a subset of the changes proposed in https://github.com/discourse/discourse/pull/17379.
2022-08-03 15:32:35 +03:00
Peter Wagenet 40cb46631f
DEV: Update `/admin/badges` to modern Ember patterns (#17672)
* Nest admin badges controller and route files

* Use standard file names for admin-badges

* Update resolver to allow standardized file structure for admin

* Add adminBadges.index controller for property tracking

* Modernize admin badges controller

* Modernize admin-badges route

* Add admin-badges index route

* Modernize admin-badges.show controller and route

* Modernize admin-badges.award controller and route

* Convert BadgeButton to a Glimmer component
2022-08-03 10:12:17 +01:00
David Taylor 36446649ff
DEV: Clear custom sidebar sections after each test (#17775)
Initializers are re-run before each test, so we need to clear out the list to avoid duplicates building up over multiple tests.
2022-08-03 09:42:29 +01:00
Alan Guo Xiang Tan d1d760ae7b
UX: Move links in Sidebar footer under community section (#17774)
Now that we have a "more..." links drawer, we can move some of the links
in footer into the links drawer. The footer itself does not have much
horizontal or vertical space for us to work with and hence limits the
amount of links which we can add to it.
2022-08-03 14:47:03 +08:00
Osama Sayegh 53dd9b0c66
DEV: Add `aria-label` option to the `d-icon` helper (#17741)
Extracted from https://github.com/discourse/discourse/pull/17379.
2022-08-03 09:33:50 +03:00
Osama Sayegh ce9eec8606
DEV: Combine all header notification bubbles into one in the new user menu (#17718)
Extracted from https://github.com/discourse/discourse/pull/17379.
2022-08-03 08:57:59 +03:00
Alan Guo Xiang Tan bd92df6bbe
FIX: Links incorrectly marked as active in Sidebar::MoreSectionLinks (#17771)
Before this commit, links with routes that require multiple models were
incorrectly displayed as the active link in the
Sidebar::MoreSectionLinks component because we were only checking if the
routeName was active.
2022-08-03 12:39:21 +08:00
Jeff Wong d4dda2c93a REFACTOR: Update fastly URLs in tests to generic example URLs 2022-08-02 14:32:08 -10:00
Jeff Wong 8d525b4188 REFACTOR: update search fixture urls 2022-08-02 14:32:08 -10:00
David Taylor be55367d6f
DEV: Replace `session:main` with `service:session` (#17765)
This will allow consumers to inject it using `session: service()` in preparation for the removal of implicit injections in Ember 4.0. `session:main` is still available and will print a deprecation notice.
2022-08-02 23:55:20 +01:00
David Taylor 89518f3155
DEV: Modernize store and messageBus injections in Glimmer base class (#17763)
These were overlooked when `store` and `messageBus` were converted to true services
2022-08-02 23:22:52 +01:00
Martin Brennan d2ddb140dd
FEATURE: Show SMTP response on admin email sent list and rearrange columns (#17143)
Follow up to 4d3c1ceb44, this commit
shows the SMTP response in the admin email sent list and also moves the
topic/post link into a new column. Reply key is now in its own column.
2022-08-03 08:11:54 +10:00
Sérgio Saquetim b16028bc79
FIX: Inject appEvents in ScreenTrack (#17751)
This commit reverts partially https://github.com/discourse/discourse/pull/17543.

Service appEvents was not being injected in ScreenTrack. This causes
`this.appEvents.trigger("topic:timings-sent", data);` to fail and the error is
swallowed by the `catch` on the promise.

This caused a regression on plugins that rely on this event to implement other
behaviors.
2022-08-02 16:22:17 -03:00
David Taylor 4c2f08b6e2 DEV: Replace `current-user:main` with `service:current-user`
This will allow consumers to inject it using `currentUser: service()` in preparation for the removal of implicit injections in Ember 4.0. `current-user:main` is still available and will print a deprecation notice.
2022-08-02 20:16:11 +01:00
David Taylor 2463a8d568 DEV: Improve `injectServiceIntoService` function
Previously we were preventing circular dependencies by looking up the service before adding it as an injection for future-initialized services. This works, but it means that the order of service injection is important, and we cannot have two services auto-injected into each other.

This commit takes a different approach. It removes the `lookup`, and instead adds a dummy injection which prevents the service being injected into itself during initialization. This allows us to have circular auto-imports, without breaking the injection resolver by injecting a service into itself.
2022-08-02 20:16:11 +01:00
Gerhard Schlager f3b2ee8e1b
FIX: Use default locale for footer of embedded topics (#17760)
The content from the remote site and the footer get cached for 10 minutes, so Discourse should use the default locale instead of the user locale for the footer. Otherwise Discourse might cache the message in a different language.
2022-08-02 20:49:28 +02:00
Meghna 5ac4e82540
UX: add ellipsis for long category names in category chooser dropdown (#17758) 2022-08-02 21:57:47 +05:30
David Taylor 58defe7169
DEV: Move all resolver deprecations into `resolver.js` (#17757)
Having them all in one place is much easier to reason with. It also means we can handle them without needing 'fake' registrations (which can sometimes cause odd behavior). This commit just moves the deprecation logic - it does not introduce any new deprecations.
2022-08-02 17:05:02 +01:00
David Taylor 381365facc
FIX: Update word_watcher cache key following schema change (#17755)
862007fb18 introduced a change to the format that watched words are cached in Redis. Newly-deployed versions of the app were attempting to load the old-format data from Redis, leading to a server error. This commit introduces a CACHE_VERSION constant which we can easily bump when making changes to the cache schema.
2022-08-02 12:11:08 +01:00
David Taylor 4bf9b73296
DEV: Ensure `censorFn` copes with null `regexpList` (#17754)
This fixes the test suite failures introduced by 862007fb18
2022-08-02 11:09:51 +01:00
Arpit Jalan d3e8442937
DEV: add test for wizard last step and some minor optimizations (#17752) 2022-08-02 14:13:25 +05:30
Selase Krakani 862007fb18
FEATURE: Add support for case-sensitive Watched Words (#17445)
* FEATURE: Add case-sensitivity flag to watched_words

Currently, all watched words are matched case-insensitively. This flag
allows a watched word to be flagged for case-sensitive matching.
To allow allow for backwards compatibility the flag is set to false by
default.

* FEATURE: Support case-sensitive creation of Watched Words via API

Extend admin creation and upload of Watched Words to support case
sensitive flag. This lays the ground work for supporting
case-insensitive matching of Watched Words.

Support for an extra column has also been introduced for the Watched
Words upload CSV file. The new column structure is as follows:

 word,replacement,case_sentive

* FEATURE: Enable case-sensitive matching of Watched Words

WordWatcher's word_matcher_regexp now returns a list of regular
expressions instead of one case-insensitive regular expression.

With the ability to flag a Watched Word as case-sensitive, an action
can have words of both sensitivities.This makes the use of the global
Regexp::IGNORECASE flag added to all words problematic.

To get around platform limitations around the use of subexpression level
switches/flags, a list of regular expressions is returned instead, one for each
case sensitivity.

Word matching has also been updated to use this list of regular expressions
instead of one.

* FEATURE: Use case-sensitive regular expressions for Watched Words

Update Watched Words regular expressions matching and processing to handle
the extra metadata which comes along with the introduction of
case-sensitive Watched Words.

This allows case-sensitive Watched Words to matched as such.

* DEV: Simplify type casting of case-sensitive flag from uploads

Use builtin semantics instead of a custom method for converting
string case flags in uploaded Watched Words to boolean.

* UX: Add case-sensitivity details to Admin Watched Words UI

Update Watched Word form to include a toggle for case-sensitivity.
This also adds support for, case-sensitive testing and matching of  Watched Word
in the admin UI.

* DEV: Code improvements from review feedback

 - Extract watched word regex creation out to a utility function
 - Make JS array presence check more explicit and readable

* DEV: Extract Watched Word regex creation to utility function

Clean-up work from review feedback. Reduce code duplication.

* DEV: Rename word_matcher_regexp to word_matcher_regexp_list

Since a list is returned now instead of a single regular expression,
change `word_matcher_regexp` to `word_matcher_regexp_list` to better communicate
this change.

* DEV:  Incorporate WordWatcher updates from upstream

Resolve conflicts and ensure apply_to_text does not remove non-word characters in matches
that aren't at the beginning of the line.
2022-08-02 10:06:03 +02:00
Alan Guo Xiang Tan df264e49a9
DEV: Supports href attribute for hamburger links API bridge to sidebar (#17750)
In the old `decorateWidget("hamburger-menu:generalLinks", callbackFn)`
API, the return value of the callback function can either return a
`route` or `href`. The API bridge added in
de54bdd73d supported `route` but not `href` and
hence the need for this commit.
2022-08-02 15:30:13 +08:00
Pixlz b9c1e63bd1
UX: Change unrelated icon in the CTA Signup prompt (#17732) 2022-08-02 13:27:18 +08:00
David Taylor 5d6694ac4f
DEV: Remove duplicate getter from category-section-link (#17705) 2022-08-02 13:26:36 +08:00
Alan Guo Xiang Tan f204538f7c
UX: Remove count from more section links (#17747)
Less is more...
2022-08-02 11:20:55 +08:00
Kris 8df2756bba
DEV: set CSS custom property for footer-nav-height (#17744) 2022-08-01 18:01:06 -04:00
Arpit Jalan cfd0a04965
FIX: wizard last step "corporate" was not saving changes (#17739) 2022-08-01 14:49:09 +05:30
Joffrey JAFFEUX 6ce75d3824
DEV: dom clean should be cancelled on aborted transition (#17736) 2022-08-01 10:56:41 +02:00
Alan Guo Xiang Tan de54bdd73d
DEV: Add API bridge for custom hamburger menu links to sidebar (#17742)
The old hamburger menu widget was customizable via the
`api.decorateWidget("hamburger-menu:generalLinks")` plugin API. As the
hamburger menu is going to be replaced by the sidebar dropdown, we need
a way to smoothly transit plugins and theme components to the new
sidebar. This commit makes a best effort attempt to bridge
`api.decorateWidget` with `api.addCommunitySectionLink`. If an error is
encountered, a deprecation notice is logged.
2022-08-01 16:45:09 +08:00
David Taylor 9534f13256
DEV: Replace `site-settings:main` with `service:site-settings` (#17734)
This will allow consumers to inject it using `siteSettings: service()` in preparation for the removal of implicit injections in Ember 4.0. `site-settings:main` is still available and will print a deprecation notice.
2022-08-01 09:43:33 +01:00
Alan Guo Xiang Tan ad6b5825bf
DEV: `addTopicsSectionLink` -> `addCommunitySectionLink` plugin api (#17740) 2022-08-01 15:19:52 +08:00
Krzysztof Kotlarek af912b4b0e
DEV: Experimental scroll sidebar to specific element event handler (#17727) 2022-08-01 12:39:00 +08:00
Kris 2743339a7e
UX: adjust sidebar margin to avoid composer height (#17731) 2022-08-01 11:02:11 +08:00
Pixlz e58c25939c
UX: Fix extra spacing for group metadata in user profile (#17725) 2022-07-29 13:47:14 -04:00