Commit Graph

50276 Commits

Author SHA1 Message Date
David Taylor eb94ec16da
DEV: introduce Ember `<template>` tag support (.gjs) (#22719)
The gjs/gts formats are a new pattern for authoring Ember components. This commit introduces support for these patterns to our build pipeline for core/plugins, and converts a handful of components to use the new format. It also introduces relevant updates to our linting config, and to our sample vscode configuration.

Co-authored-by: Godfrey Chan <godfreykfc@gmail.com>
Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com>
2023-07-20 21:01:12 +01:00
Jarek Radosz 9bbd5efbec
DEV: Convert helpers into plain functions (#22385)
Since 0fa92529ed, helpers can now be implemented as plain JS functions. This makes them much easier to write/read, and also makes them usable in `<template>` gjs files.
2023-07-20 19:45:40 +01:00
Roman Rizzi 238d71bcad
FEATURE: Regenerate outdated summaries. (#22718)
Users unable to generate new summaries won't be able to regenerate them. They'll only see the warning saying it's outdated.
2023-07-20 15:25:46 -03:00
Andrei Prigorshnev 3349ce2c79
DEV: extract channel. joined_by method (#21752)
This only moves code around and doesn't change any behavior. This does two things:

1. Extracts the `channel.joined_by?` methods
2. Uses term "members" instead of "participants" for chat members
2023-07-20 22:06:36 +04:00
Loïc Guitaut 050828d1de DEV: Allow chat services to have optional models
This is extracted from #22390.

This patch adds a new `optional` option to the `model` step. This
means if an optional model returns something blank (`nil` or an empty
collection) then the service won’t fail and will execute the next step.
However if a model is properly returned, the step will try to check if
it is valid or not (if it responds to `#invalid?`). If the model isn’t
valid, then the step will fail (so no change here).
2023-07-20 17:27:44 +02:00
Selase Krakani c90e399003
FIX: `user_id` arg override in Slack import (#22713)
Fixes `user_id` arg override during mention parsing.
2023-07-20 11:22:43 +00:00
Jarek Radosz 6c8dcdb30c
DEV: Consistently use html5 loofah (#22711)
Turns out making a html4 fragment and then operating on parts of it using html5 fragments is a bad idea. ;)
This seems to fix the issue with occasionally missing GH icons in oneboxes.
2023-07-20 12:01:45 +02:00
David Battersby 88dc6afe64
DEV: skip flaky lightbox loading state test (#22709)
Skips a flaky test for the new lightbox loading state.
2023-07-20 11:00:22 +08:00
Krzysztof Kotlarek 3355298f9f
FEATURE: ability to position switch panel buttons (#22707)
SiteSetting which allow to position switch panels buttons at the top or the bottom of the Sidebar.
2023-07-20 12:52:46 +10:00
Ted Johansson 9a6bbac5bd
DEV: migrate ignore duration to Glimmer and DModal (#22687)
This PR migrates the ignore modal to a Glimmer component and DModal. Most of the code is lift-and-shift.
2023-07-20 10:49:58 +08:00
Krzysztof Kotlarek 117f6d92a8
FEATURE: allow sidebar section api to create external links (#22609)
* FEATURE: allow sidebar section api to create external links

Right now, sidebar API allows creating sections with internal links. It should be extended to allow creating links to external URLs as well.

* FIX: after rebase
2023-07-20 09:07:18 +08:00
Jarek Radosz b105c6c510
DEV: Remove the last/only use of inline-date helper (#22692)
See: https://github.com/discourse/discourse/pull/22385
2023-07-19 21:13:40 +02:00
Juan David Martínez Cubillos 9e83d64723
DEV: Add Custom emoji sanitization (#22697)
* DEV: Add Custom emoji sanitization

* added tests for implemented changes
2023-07-19 14:09:26 -05:00
Roman Rizzi 9650bf9d08
DEV: disambiguate system spec find to prevent flakyness (#22698) 2023-07-19 15:57:23 -03:00
Blake Erickson 90f395a118
DEV: Skip srcset for onebox thumbnails (#22621)
* DEV: Skip srcset for onebox thumbnails

In an effort to preserve bandwidth especially for mobile devices this
change will prevent upscaled srcset attributes from being added to
onebox thumbnail images.

Besides checking the html for onebox classes, our database structure for
uploads does not distinguish between regular images and onebox thumbnail
images, but all upload images in discourse do have a thumbnail. By
default this thumbnail is what is used for the non-upscaled image for
onebox images, so we should only use that thumbnail. Because the
rendered onebox image size is likely smaller than the upload thumbnail
size there really shouldn't be a need to upscale.
2023-07-19 12:21:34 -06:00
Andrei Prigorshnev d1760727cf
DEV: check if user can_chat inside the can_join_chat_channel guardian (#21812)
Someone who cannot chat is also not able to join chat channels, 
so we may not check all the time user.can_chat? && user.can_join_chat_channel? 
and just call user.can_join_chat_channel? instead.
2023-07-19 21:55:00 +04:00
Godfrey Chan e1d27400f5
DEV: refactor ember-cli-build (#22694)
pass the extra public trees to `app.toTree()` to match:

0e00f2bf15/packages/test-setup/src/index.ts (L24-L27)

The ember-cli-terser addon now takes care of minifying all additional trees, so we can remove our custom terser-related logic
2023-07-19 17:48:20 +01:00
Roman Rizzi 132bd375f6
UX: Show the info icon outside the tooltip (#22696) 2023-07-19 13:33:17 -03:00
Godfrey Chan a295298649
DEV: update index.html files (#22695)
This brings them more in line with an idiomatic ember app looks
like, in particular, embroider really expects the CSS file to be
there.

As far as I can tell this is fairly harmless, since in production
the actual HTML is generated and served by Rails anyway.

Down the road, this may also be a good alternative to hacking the
build pipeline to bring in styles for tests.
2023-07-19 17:31:08 +01:00
Isaac Janzen 1561e51a13
DEV: Revert "DEV: Update `replaceWith` on Route (#22645)" (#22693)
This reverts commit 33db93c9b2.
2023-07-19 10:47:31 -05:00
Ted Johansson 341acacba8
DEV: Add endpoint for dismissing outdated translations (#22509)
Recently we started giving admins a notice in the advice panel when their translations have become outdated due to changes in core. However, we didn't include any additional information.

This PR adds more information about the outdated translation inside the site text edit page, together with an option to dismiss the warning.
2023-07-19 23:06:13 +08:00
Roman Rizzi 3820fae041
UX: Disclose AI model used and add animation to placeholder (#22670)
* UX: Disclose AI model used and add animation to placeholder

* Move text into hbs template

DTooltip (weirdly) attaches to a sibling element, so we need something else to be rendered inside the RenderGlimmer wrapper div

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2023-07-19 12:03:36 -03:00
Jarek Radosz 00ab94bf53
DEV: Migrate topic-bulk-actions to the new modal API (#22690) 2023-07-19 15:27:51 +02:00
David Taylor 6fd06bc411
FIX: Ensure 'modern' modal is closed when opening legacy modal (#22689)
e.g. the modernised share-topic modal will attempt to open the `create-invite` modal. Prior to this commit, this mixing of modern/legacy would fail silently, and the create-invite modal was never shown.
2023-07-19 12:22:00 +01:00
Sam e5bb4bbd59
FIX: banners not removing when unset (#22678)
Initializing an EmberObject with a null object leads to an exception. This commit stops that from happening, and introduces an acceptance test for adding/removing banner topics via message-bus.

Co-authored-by: David Taylor <david@taylorhq.com>
2023-07-19 11:57:52 +01:00
David Taylor 125903f682
FIX: Staff action log could not be accessed via link (#22688)
011ba5b9 slightly changed the way the staff-action-log route is activated. It's now possible for `deserializeQueryParam` to be called with a null value, so we need to deal with that case.

This route is currently untested - we'll follow-up with another commit to add some.
2023-07-19 11:40:48 +01:00
Jarek Radosz bdd97ff931
DEV: Convert fast-edit on mobile to a modal (#22570)
Motivation: to fix an issue with fast-edit positioning on mobile (android) Trying to correctly position that textarea/popper element proved difficult

see: https://meta.discourse.org/t/fast-edit-input-container-position/263190
2023-07-19 11:43:00 +02:00
Jarek Radosz 70cebfb6ab
DEV: Skip hidden elements in J / K navigation (#22671) 2023-07-19 11:41:18 +02:00
Martin Brennan a6956af902
FIX: Show mention count for channel list on mobile (#22682)
Followup to 07c3782e51

The above incorrectly removed the channel unread count in
the mobile/drawer channel list when the user has mentions
(meaning the unreads are urgent). This commit adds it
back and refactors system specs a little.
2023-07-19 16:24:01 +10:00
Alan Guo Xiang Tan d753e00eb5
DEV: Avoid waiting full Capbyara default wait timeout in system tests (#22684)
Avoid using negated matchers with custom RSpec matchers that rely on
`has_css?` as it'll result in Capybara waiting the full default wait
time.
2023-07-19 14:23:43 +08:00
Krzysztof Kotlarek 77b4e42f61
FIX: specify chrome version (#22681) 2023-07-19 15:06:56 +10:00
Ted Johansson c2e90f8c07
DEV: Migrate publish page modal to Glimmer and DModal (#22663)
This PR migrates the publish page modal to a Glimmer component and DModal.

Most of the code is lift-and-shift. However, the component state getters were implemented using meta-programming in the original controller. They have all been inlined here for clarity, searchability, etc.
2023-07-19 10:37:07 +08:00
Krzysztof Kotlarek 20ec7ac174
FEATURE: new API to add panels to sidebar (#22534)
Define new concept of panels in sidebar. Panels are wrappers around sidebar sections. In the future, it allows creating full focus mode by switching between panels.

A new API method called addSidebarPanel was added. Default main panel is already registered and by default all API sections are mounted to main.
2023-07-19 11:31:45 +10:00
Sam 9ef2a2ac9b
DEV: spec hanging in CI (#22679)
Thread wakeup was failing to properly wake up thread under certain circumstances

Amend it so we use a tight loop instead.
2023-07-19 09:01:30 +08:00
Martin Brennan 3be9e6c97e
FIX: Hashtag error in PrettyText when processing email (#22680)
Followup to b583872eed
and 54001060ea

Another place where we need to filter hashtag types to
only enabled ones is PrettyText, though the latter PR
above should also already make it so the correct priority
types are passed.

This is causing errors in the email processing workflow
for some customers (presumably ones with tagging disabled).
2023-07-19 10:52:18 +10:00
Alan Guo Xiang Tan 7cee80d699
DEV: Use the main default session for main test assertions (#22677)
Why this change?

The test being changed in question has been flaky on our CI. However, we
are unable to view the screenshot of why it failed because
ActionDispatch will only take a screenshot of the default session upon
failure. At the same time, taking screenshot of all sessions
automatically upon failure is not possible via the official Capybara or
Rails APIs at the moment. Therefore, we're changing this system test to
avoid using two custom session and instead have the main assertion use
the default session such that any failures will provide us with a
screenshot.
2023-07-19 08:21:31 +08:00
Martin Brennan 54001060ea
FIX: Termless hashtag search when a type is disabled (#22660)
When a type was disabled, the hashtag search _without_ a
term was erroring. This was because we weren't filtering
out the disabled types from types_in_priority_order first
like we were if there was a term provided.

This commit fixes that issue, and also makes it so
contexts_with_ordered_types and ordered_types_for_context
will only return hashtag types which are enabled.
2023-07-19 10:10:33 +10:00
Martin Brennan 2cc353104e
DEV: Add more chrome options for system specs (#22659)
* CHROME_LOAD_EXTENSIONS_MANIFEST - An env var with a path to a file
  that contains one path per line. These are paths to extensions installed
  in chrome that the user wants to load while running system specs.
  Useful to run things like Ember Inspector.
* CHROME_DISABLE_FORCE_DEVICE_SCALE_FACTOR - On some systems the
  --force-device-scale-factor=1 argument makes the UI for chrome
  super small, add a way to disable this.
2023-07-19 10:09:34 +10:00
Martin Brennan 6efae69c61
FIX: Doubled up or not tracked threads in thread list (#22631)
This commit fixes two issues with the thread list:

1. All threads were being shown regardless of whether the user had
   a membership in the thread. This was happening because the list
   and the channel share the same thread store, so if the channel
   had OMs with threads we would load them and they showed in the list.
2. Threads created by the user from a staged thread would double up.
   This is because the _cache in the channel threadsManager would use
   the staged thread ID even after we'd replaced the object's ID with
   the actual thread from the DB. The answer to this is to remove and
   re-add the thread to the local cache with the actual ID.
2023-07-19 10:09:22 +10:00
dependabot[bot] bf799fb1e7
Build(deps): Bump msgpack from 1.7.1 to 1.7.2 (#22676)
Bumps [msgpack](https://github.com/msgpack/msgpack-ruby) from 1.7.1 to 1.7.2.
- [Changelog](https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog)
- [Commits](https://github.com/msgpack/msgpack-ruby/compare/v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: msgpack
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 01:08:34 +02:00
dependabot[bot] 21a4489732
Build(deps): Bump mini_portile2 from 2.8.2 to 2.8.4 (#22675)
Bumps [mini_portile2](https://github.com/flavorjones/mini_portile) from 2.8.2 to 2.8.4.
- [Release notes](https://github.com/flavorjones/mini_portile/releases)
- [Changelog](https://github.com/flavorjones/mini_portile/blob/main/CHANGELOG.md)
- [Commits](https://github.com/flavorjones/mini_portile/compare/v2.8.2...v2.8.4)

---
updated-dependencies:
- dependency-name: mini_portile2
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 01:06:59 +02:00
Isaac Janzen bd88b7d6c4
DEV: Remove `transition-methods` deprecation (#22673)
All https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods deprecations have been resolved.
2023-07-18 16:09:28 -05:00
Isaac Janzen 72edb7270c
DEV: Upgrade `replaceRoute` on Controller (#22648)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.replaceRoute` calls on controllers to directly call the router service (`this.router.replaceRoute`)
2023-07-18 15:16:41 -05:00
Isaac Janzen 33db93c9b2
DEV: Update `replaceWith` on Route (#22645)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.replaceWith` calls on routes to directly call the router service (`this.router.replaceWith`)
2023-07-18 15:05:53 -05:00
Juan David Martínez Cubillos 7422fe7c3f
FIX: Embedding checkbox bug (#22672) 2023-07-18 15:02:07 -05:00
Isaac Janzen a2ea9c5417
DEV: upgrade `transitionToRoute` on Controller (#22647)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.transitionToRoute` calls on controllers to directly call the router service (`this.router.transitionTo`)
2023-07-18 14:53:23 -05:00
Isaac Janzen 011ba5b9f6
DEV: Update `transitionTo` on Route (#22644)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.transitionTo` calls on routes to directly call the router service (`this.router.transitionTo`)
2023-07-18 14:52:55 -05:00
Penar Musaraj bd7e5c15fb
UX: Fix focus state style for date button in composer (#22669) 2023-07-18 15:39:52 -04:00
Jean defa8904b9
FEATURE: Add limit and group exclusion to the directory items endpoint (#22667)
* FEATURE: Add limit and group exclusion to the directory items endpoint
2023-07-18 15:09:32 -04:00
Jarek Radosz 2a96064e6b
DEV: Modernize topic-bulk-actions (#22186)
Introduces new plugin api for adding bulk topic actions:

Example:

```js
api.addBulkActionButton({
  label: "super_plugin.bulk.enhance",
  icon: "magic",
  class: "btn-default",
  visible: ({ currentUser, siteSettings }) => siteSettings.super_plugin_enabled && currentUser.staff,
  async action({ setComponent }) {
    await doSomething(this.model.topics);
    setComponent(MyBulkModal);
  },
});
```
2023-07-18 20:10:16 +02:00