Commit Graph

46291 Commits

Author SHA1 Message Date
David Taylor 801a284968
DEV: make ember-cli skip plugin directories without `plugin.rb` (#18171)
This updates the ember-cli plugin detection logic to match the logic in `Plugin::Instance.find_all`. It will now ignore plugin directories which do not have a `plugin.rb` file.
2022-09-02 19:48:45 +01:00
Andrei Prigorshnev 3501468db7
UX: make user status emoji on post stream smaller (#18169) 2022-09-02 21:48:36 +04:00
Gerhard Schlager fd6109a6e1
FIX: Theme components should work with empty locale files (#18167)
Theme components didn't work with empty locale files (just the locale key without any translations) that are created by translator-bot.
2022-09-02 18:28:18 +02:00
Jordan Vidrine 73a2d2e9ac
UX: Fix width of preview pane to fix scroll (#18166) 2022-09-02 11:28:11 -05:00
Krzysztof Kotlarek 661a903a0b
FEATURE: other notifications tab for redesign user menu (#18164)
This commit adds to the experimental user menu a new "other notifications" tab that's very similar to the "all notifications" tab, but with the main difference being that it doesn't show notification types that do have dedicated tabs in the menu (e.g. mentions, likes, replies etc.).

The rationale behind this is that the notification types that do have dedicated tabs tend to dominate the "all notifications" tab, leaving very small chances for the user to notice rarer or infrequent notification types. Adding a tab for all the other types gives the user a way to review those infrequent notification types.

Internal ticket: t72978.

Co-authored-by: OsamaSayegh <asooomaasoooma90@gmail.com>
2022-09-02 14:49:49 +03:00
jbrw bf6c9e0f28
DEV: Add tags to a topic fixture (#18162)
It can be useful to have a topic with some predefined tags
2022-09-02 13:48:31 +02:00
David Taylor 1279966f59
FIX: Use plugin's defined name for es6 module path (#18159)
We were using the directory name rather than the plugin's defined `name`. This was an unintended change in behaviour from the old sprockets implementation. This commit makes the ember-cli naming logic match the old sprockets logic.
2022-09-01 22:15:32 +01:00
David Taylor a335492d20
FIX: Ensure discovery-categories always clears PreloadStore (#18157)
If the server is configured to use a view like `categories_and_latest_topics`, it will preload data for the topic list. If the client doesn't actually use it (e.g. on mobile), then that preloaded data would remain cached and be used for the next loaded topic list. This commit ensures it's always removed, and adds a test for the behaviour.

https://meta.discourse.org/t/237126/35
2022-09-01 16:11:13 +01:00
Bianca Nenciu 0f70eae7b0
FIX: Create single notification per post and user (#18091)
A user could receive more than a notification for the same post if they
watched both the categories and tags at different levels. This commit
makes sure that only the watching notification is created.

* Add DiscourseEvent before post notifications are created
2022-09-01 16:07:18 +03:00
Ghassan Maslamani a671fb4449
DEV: Add below-login-buttons plugin outlet (#18154) 2022-09-01 13:15:40 +01:00
David Taylor c782125985
UX: Close the revamped user menu when opening modals (#18148)
When opening the DnD modal and the User Status modal, user menu remained open, this fixes it.
2022-09-01 15:22:41 +04:00
Arpit Jalan 5bc858c676
FIX: do not show "create topics" notice on wizard route (#18153) 2022-09-01 16:37:57 +05:30
David Taylor 7e74dd0afe
DEV: Use DiscourseJsProcessor for theme template compilation (#18135)
Previously we were relying on a highly-customized version of the unmaintained Barber gem for theme template compilation. This commit switches us to use our own DiscourseJsProcessor, which makes use of more modern patterns and will be easier to maintain going forward.

In summary:
- Refactors DiscourseJsProcessor to move multiline JS heredocs into a companion `discourse-js-processor.js` file
- Use MiniRacer's `.call` method to avoid manually escaping JS strings
- Move Theme template AST transformers into DiscourseJsProcessor, and formalise interface for extending RawHandlebars AST transformations
- Update Ember template compilation to use a babel-based approach, just like Ember CLI. This gives each template its own ES6 module rather than directly assigning `Ember.TEMPLATES` values
- Improve testing of template compilation (and move some tests from `theme_javascript_compiler_spec.rb` to `discourse_js_processor_spec.rb`
2022-09-01 11:50:46 +01:00
Bianca Nenciu 19ed9dd183
FIX: Keep private theme key secret from user (#18106)
The generate RSA key and import theme routes worked separate from each
other. The RSA key returned both the public and private key and it was
the frontend which posted the private key back to the server. With this
commit, only the public key is necessary as the server keeps a map of
public and private keys that is used to get the private key back from
a public key.
2022-09-01 13:15:23 +03:00
Bianca Nenciu 5092c9804c
FIX: Return next bookmarks page only if it exists (#18139)
It used to return the next URL anyway which lead to an additional
request. On the frontend, if the result set was empty, it kept retrying
until at least one result was returned. This bug is fixed in this commit
too.
2022-09-01 13:04:00 +03:00
Jarek Radosz 07aa324f61
DEV: Try to kickstart npm updates (#18152)
Dependabot hasn't picked up the previous config change. Let's see if it picks up this one.
2022-09-01 11:46:02 +02:00
David Taylor 15025ac958 UX: Show information about badge errors when saving
`popupAjaxError` is used by the controller to handle errors when saving the badge model. That only works properly when it gets the original exception from the ajax call. This manipulation of the error in the badge model was breaking that behavior.

The admin-badges controller is the only place which saves this model, so this shouldn't cause any issues elsewhere in the app.
2022-09-01 09:59:14 +01:00
David Taylor 240669da3a FIX: Immediately show sql options when badge query is supplied
`buffered` and `model` are EmberObjects, so we need to call `get()` when accessing values to ensure they are autotracked
2022-09-01 09:59:14 +01:00
David Taylor 0f8e4d7acc
DEV: Compile splash screen JS with ember-cli before inlining (#18150)
This lets us use all our normal JS tooling like prettier, esline and babel on the splash screen JS. At runtime the JS file is read and inlined into the HTML. This commit also switches us to use a CSP hash rather than a nonce for the splash screen.
2022-09-01 09:58:48 +01:00
David Taylor 4ccbb91691
DEV: Improve testing and documentation of RenderGlimmer actions (#18145) 2022-09-01 09:57:48 +01:00
Arpit Jalan 3aaf4dcfd0
FIX: hide welcome topic banner as soon as the welcome topic is edited (#18125)
* FIX: hide welcome topic banner as soon as the welcome topic is edited

This commit adds a message bus listener on client to hide the welcome
topic banner as soon as the welcome topic is edited.

* update test

* only subscribe when show_welcome_topic_banner is true

* Do not lookup for messageBus service if it's not required

* Remove unneeded code

* Cache result for Site.show_welcome_topic_banner

* Update tests per latest changes

* Changes per PR review
2022-09-01 09:44:21 +05:30
Jarek Radosz 8fa9f0cf92
DEV: Fix a flaky spec (#18146)
In some cases the topic of the fabricated post can be titled "This is a test topic 777" which matches the search query "#777"
2022-08-31 20:52:57 +02:00
Alan Guo Xiang Tan 0f0048e8e3
DEV: Enable new user menu when experimental sidebar hamburger is enabled (#18133)
When `enable_experimental_sidebar_hamburger` site setting is enabled, we
will switch to rendering the new user menu.
2022-08-31 21:15:01 +03:00
Joffrey JAFFEUX bbf00fd087
DEV: message bus is always present (#18147) 2022-08-31 16:41:29 +02:00
David Taylor 564787d1dd
FIX: Transpile start-discourse.js to fix iOS12 support (#18149)
33a2624f09 introduced a JS safe-navigation operator in `discourse-boot.js`. This needs to be transpiled to maintain iOS 12 support.
2022-08-31 15:15:19 +01:00
Krzysztof Kotlarek de8cd19438
FEATURE: unified user menu notifications count (#18132)
Each new user menu notifications should have their own count. Therefore, we need to include all types to serializer and not only `grouped_unread_high_priority_notifications`

Additional PR will be created for chat and assign plugin, as they will have to switch to  `grouped_unread_notifications` as well.
2022-08-31 11:16:28 +10:00
David Taylor 2e00d4d024
DEV: Fix flaky twitter onebox behavior (#18141)
The order in which Onebox engines are loaded is not guaranteed. Occasionally during tests, the twitter engine would be loaded before the instagram engine, and cause the Instagram Onebox spec to fail due to the lack of `Onebox.options.twitter_client`.

This commit makes the load order of Onebox engines consistent, and fixes the issue in the twitter_status_onebox.
2022-08-31 08:42:55 +08:00
Jarek Radosz 2595e368b1
DEV: Enable dependabot for frontend deps (#18138) 2022-08-31 01:08:23 +02:00
dependabot[bot] b734b6817d
Build(deps-dev): Bump parallel_tests from 3.11.1 to 3.12.0 (#18142)
Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 3.11.1 to 3.12.0.
- [Release notes](https://github.com/grosser/parallel_tests/releases)
- [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md)
- [Commits](https://github.com/grosser/parallel_tests/compare/v3.11.1...v3.12.0)

---
updated-dependencies:
- dependency-name: parallel_tests
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-31 01:02:59 +02:00
David Taylor 7eaa4f6ad3
DEV: Add test for EmberCli#ember_version (#18140)
Followup to 6570fed175
2022-08-30 20:33:08 +01:00
Bianca Nenciu daa3f96d54
FIX: Allow .git end to miss from Git repo URL (#18092)
When installing private themes and theme components, the public key does
not show until the administrator types a valid Git repo URL. The regular
expression that checked the URL was too strict and it required the URL
to end with ".git".
2022-08-30 22:05:43 +03:00
Discourse Translator Bot 1ed4442c10
Update translations (#18134) 2022-08-30 20:17:57 +02:00
Jarek Radosz af7620cef8
FIX: In prod builds classes may not be "instancesof" EmberObject (#18137)
They do have CoreObject in their prototype chain.

Fixes the issue mentioned in https://github.com/discourse/discourse-chat/pull/1204
2022-08-30 17:36:20 +02:00
David Taylor 6570fed175
DEV: Fix Ember version lookup (#18136)
The source-of-truth for our ember version is now the installed node_module. The `ember_source` gem carries an old version of Ember and so the constant is no longer useful. We'll be dropping the gem soon.
2022-08-30 16:27:14 +01:00
Jarek Radosz e33d694361
DEV: Stick to ipv4 when proxying testem requests (#18064)
`localhost` made it use ipv6, which didn't work (on macOS 13)
2022-08-30 13:38:55 +02:00
dependabot[bot] 8a02c24493
Build(deps): Bump sidekiq from 6.5.5 to 6.5.6 (#18128)
Bumps [sidekiq](https://github.com/mperham/sidekiq) from 6.5.5 to 6.5.6.
- [Release notes](https://github.com/mperham/sidekiq/releases)
- [Changelog](https://github.com/mperham/sidekiq/blob/main/Changes.md)
- [Commits](https://github.com/mperham/sidekiq/compare/v6.5.5...v6.5.6)

---
updated-dependencies:
- dependency-name: sidekiq
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-30 15:34:53 +08:00
Alan Guo Xiang Tan c245b74398
FIX: Avoid leaking TopicTrackingState listeners due to sidebar (#18131)
In eb12daa7f8 when adding community
section support for anonymous users, we changed the `sectionLinks`
property into a getter method. This meant that if the getter method was
called again after the community section has been rendered, we would end
up reintializing the section links classes. As part of the
initialisation, some section links would setup a TopicTrackingState
onStateChange listener. However, the listener is only removed when the
entire community section is removed which resulted in us leaking the
onStateChange listeners.

This commit reverts the `sectionLinks` from being defined as a getter
method into a property which is only set once when the community section
is being constructor. Also, we changed it such that the community
section will register the listener instead of each section link since it
makes cleaning up much easier to reason about.

No tests have been added for this commit because the original bug is
not possible after this change and we already have an existing tests
ensuring that TopicTrackingState change listeners are cleaned up when
the community section is destroyed.

Internal ref: /t/73224
2022-08-30 11:39:32 +08:00
Osama Sayegh 417f156f6d
DEV: Use all unread notifications count for the count in document title (#18120)
When you receive a new notification, Discourse prepends a small count `(n)` to the tab title (i.e. `document.title`) if the tab is in the background to alert the user that they have a new notification. The count that's shown in the tab title should reflect the numbers shown on the notification bubbles above the user's avatar. Prior to the experimental user menu, there were 2 bubbles: a blue one which was removed once the user opened the menu and a green one that indicated high priority notifications and it was only removed when the user read all of their high priority notifications.

In the new experimental user menu, we no longer have the green bubble; everything is now combined (including flags/reviewables) into the blue one with no change to its behavior (i.e. it's removed once the user opens the menu). However, the logic that is responsible for updating the tab title hasn't been updated and still updates the tab title to include the count of the old green bubble. This commit updates the logic for the tab title count so that it only reflects the number on the blue bubble when the experimental user menu is enabled.
2022-08-30 05:37:03 +03:00
Jarek Radosz 0d4b1f25f0
DEV: Reformat dependabot config whitespace (#18126)
In preparation for npm addition
2022-08-30 10:02:33 +08:00
dependabot[bot] f64bf0dd9a
Build(deps-dev): Bump rb-fsevent from 0.11.1 to 0.11.2 (#18129)
Bumps [rb-fsevent](https://github.com/thibaudgg/rb-fsevent) from 0.11.1 to 0.11.2.
- [Release notes](https://github.com/thibaudgg/rb-fsevent/releases)
- [Commits](https://github.com/thibaudgg/rb-fsevent/compare/v0.11.1...v0.11.2)

---
updated-dependencies:
- dependency-name: rb-fsevent
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-30 09:49:28 +08:00
Blake Erickson 00539307e1
FIX: Only seed general category on new sites (#18130)
* FIX: Only seed general category on new sites

If the site already has human users (users with an id > 0) don't seed
the categories.

Follow up to: a6ad74c759

* use human_users scope
2022-08-29 18:23:14 -06:00
Martin Brennan b58d168f05
FIX: Do not save default auto_delete_preference for bookmark (#18119)
We don't want to save the auto_delete_preference for bookmarks to the
user options if it was passed through as nil from the frontend,
this leads to confusion for the end user since they did not explicitly set it.

It's fine to create the bookmark with the default of "never" if no
auto_delete_preference is provided since it applies only to the
single bookmark, not future bookmarks.
2022-08-30 09:21:41 +10:00
Keegan George a046f0306a
UX: Improve `max-height` value on toolbar popup menu (#18030)
* UX: Improve `max-height` value on toolbar popup menu

* UX: Popup menu based on new editor height property

* DEV: Update heights on resize

* DEV: Remove `--d-editor-height` property

* UX: Calculate max height based on composer type

* DEV: Remove event listener `willDestroyElement()` hook

* FIX: Remove unnecessary check and calculation

* DEV: Remove explicitly calling `updateHeightOnViewportResize()`

* UX: Update max-height

* UX: Different max-height values for reply/create

* DEV: Add comments for clarity

* DEV: Remove `updateHeightOnViewportResize()` event listener
2022-08-29 12:59:35 -07:00
Blake Erickson eba8b8d34d
FEATURE: Replace Lounge with General Category (#18097)
- Seed the General category so that the general chat channel will have
  a home
- Do not seed the Lounge category anymore
- Move the "Welcome to Site" topic to the General category
2022-08-29 13:05:41 -06:00
David Taylor e16c8ea2e7
DEV: Support inline-hbs compilation in themes (#18112)
This commit makes a number of improvements to the DiscourseJsProcessor:

1. Remove dependence on the out-of-date Ember template compiler from the ember-rails gem; switch to modern template compiler
2. Refactor to make use of a proper module system with `define`/`require`
3. Introduce `babel-plugin-ember-template-compilation` to enable inline hbs compilation

The `mini-loader` is upgraded to support relative lookup and `require.has`, so that these new JS packages work correctly.
2022-08-29 19:53:42 +01:00
David Taylor 1bd1664ae0
DEV: Compile markdown-it-bundle with ember-cli (#18104)
We were already compiling the markdown bundle via ember-cli, but that version was only being used in the test environment. This commit improves the implementation, and updates the filename so it's also used in production.

This commit also
- Removes the vendored copy of `markdown-it.js` and fetches from node_modules instead
- Updates `pretty_text.rb` to remove the custom sprockets-manifest-parsing
- Removes `pretty-text-bundle.js`, which was only being used by `pretty_text.rb`
2022-08-29 19:11:59 +01:00
Penar Musaraj 4116bce902
DEV: Add A11Y-friendly dialog addon (#18028)
This adds a new framework for accessible dialogs that will eventually replace bootbox. Under the hood, it uses the a11y-dialog package and an in-repo Ember addon. See PR for usage details.
2022-08-29 13:59:57 -04:00
Andrei Prigorshnev c3a93597c1
FEATURE: show user status description on the mention popup (#18110) 2022-08-29 21:16:48 +04:00
Andrei Prigorshnev 007980fdaf
FEATURE: make user status on post streams live (#17903) 2022-08-29 19:33:50 +04:00
Bianca Nenciu 6564d04e0d
FIX: Do not notify admins watching PM tags (#18103)
Admins received notifications if a PM was tagged with a tag they
watched even if they were not invited to the PM.
2022-08-29 16:11:11 +03:00