This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse
Martin Brennan 8eabbdae5c
DEV: Move composer-editor upload functions into mixin (#13923)
This PR moves all the upload related functions into a new
ComposerUpload mixin that is extended by the composer-editor
component. This is being done so I can introduce a ComposerUploadUppy
mixin that overrides functions in the regular ComposerUpload mixin,
via a new composer-editor-uppy component that inherits from
ComposerEditor. The proposed structure, which will be in the next PR,
looks like this:

composer-editor-uppy

```javascript
import ComposerEditor from "discourse/components/composer-editor"
import ComposerUploadUppy from "discourse/mixins/composer-upload-uppy"

export default ComposerEditor.extend(ComposerUploadUppy, {
  layoutName: "components/composer-editor"
});
```

This way the new composer-editor is a dumb component purely used for
testing uppy safely, and within the template for composer.hbs we do
this:

```javascript
@discourseComputed
composerComponent() {
  return this.siteSettings.enable_experimental_composer_uploader
    ? "composer-editor-uppy"
    : "composer-editor";
},
```

```handlebars
{{component composerComponent ...}}
```

This is the only way I can think to do it, because it is not possible to
access the site settings when the component is first declared I can't do
something like:

```javascript
const uploaderMixin = this.siteSettings.use_experimental_uploader?
ComposerUploaderUppy : ComposerUploader;

Component.extend(uploaderMixin, {});
```

An additional change in this PR is explicitly passing in these four
plugin data structures to the composer-editor Component, rather
than relying on JS closures which the mixin cannot do:

* uploadMarkdownResolvers
* uploadProcessorActions
* uploadProcessorQueue
* uploadHandlers
2021-08-03 14:46:32 +10:00
..
app DEV: Move composer-editor upload functions into mixin (#13923) 2021-08-03 14:46:32 +10:00
config FIX: ember-cli proxy subfolder fix (#12996) 2021-05-10 10:02:33 -07:00
lib FIX: allows authentication data to be present in bootstrap (#13885) 2021-07-29 15:01:11 +02:00
public/assets/scripts DEV: Allow plugin tests to run in Ember CLI qunit 2021-06-24 10:13:35 -04:00
tests FEATURE: Add post edits count to user activity (#13495) 2021-08-02 10:15:53 -04:00
.ember-cli REFACTOR: Sync up master with changes for Ember-CLI (#11671) 2021-01-12 10:13:21 -05:00
ember-cli-build.js DEV: Allow plugin tests to run in Ember CLI qunit 2021-06-24 10:13:35 -04:00
package.json FEATURE: Uppy image uploader with UppyUploadMixin (#13656) 2021-07-13 12:22:00 +10:00
testem.js FIX: Use the no-sandbox flag when running Ember CLI tests. (#12951) 2021-05-05 14:02:26 -03:00