2023-02-23 10:32:53 -05:00
|
|
|
import { classNames } from "@ember-decorators/component";
|
|
|
|
import { alias } from "@ember/object/computed";
|
2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2020-05-13 16:23:41 -04:00
|
|
|
import I18n from "I18n";
|
2021-11-04 19:23:28 -04:00
|
|
|
import UppyUploadMixin from "discourse/mixins/uppy-upload";
|
2022-09-27 14:47:13 -04:00
|
|
|
import { dialog } from "discourse/lib/uploads";
|
2017-06-28 16:56:44 -04:00
|
|
|
|
2023-02-23 10:32:53 -05:00
|
|
|
@classNames("watched-words-uploader")
|
|
|
|
export default class WatchedWordUploader extends Component.extend(
|
|
|
|
UppyUploadMixin
|
|
|
|
) {
|
|
|
|
type = "txt";
|
|
|
|
uploadUrl = "/admin/customize/watched_words/upload";
|
|
|
|
|
|
|
|
@alias("uploading") addDisabled;
|
|
|
|
|
|
|
|
preventDirectS3Uploads = true;
|
2017-06-28 16:56:44 -04:00
|
|
|
|
|
|
|
validateUploadedFilesOptions() {
|
2019-07-22 07:59:56 -04:00
|
|
|
return { skipValidation: true };
|
2023-02-23 10:32:53 -05:00
|
|
|
}
|
2017-06-28 16:56:44 -04:00
|
|
|
|
2022-06-17 05:07:58 -04:00
|
|
|
_perFileData() {
|
|
|
|
return { action_key: this.actionKey };
|
2023-02-23 10:32:53 -05:00
|
|
|
}
|
2017-06-28 16:56:44 -04:00
|
|
|
|
|
|
|
uploadDone() {
|
|
|
|
if (this) {
|
2022-09-27 14:47:13 -04:00
|
|
|
dialog.alert(I18n.t("admin.watched_words.form.upload_successful"));
|
2019-01-10 05:06:01 -05:00
|
|
|
this.done();
|
2017-06-28 16:56:44 -04:00
|
|
|
}
|
2023-02-23 10:32:53 -05:00
|
|
|
}
|
|
|
|
}
|