2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { alias } from "@ember/object/computed";
|
|
|
|
import { classNames } from "@ember-decorators/component";
|
2022-09-28 02:47:13 +08:00
|
|
|
import { dialog } from "discourse/lib/uploads";
|
2023-10-11 02:38:59 +08:00
|
|
|
import UppyUploadMixin from "discourse/mixins/uppy-upload";
|
|
|
|
import I18n from "I18n";
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2023-02-23 23:32:53 +08: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-29 04:56:44 +08:00
|
|
|
|
|
|
|
validateUploadedFilesOptions() {
|
2019-07-22 19:59:56 +08:00
|
|
|
return { skipValidation: true };
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2022-06-17 17:07:58 +08:00
|
|
|
_perFileData() {
|
|
|
|
return { action_key: this.actionKey };
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
2017-06-29 04:56:44 +08:00
|
|
|
|
|
|
|
uploadDone() {
|
|
|
|
if (this) {
|
2022-09-28 02:47:13 +08:00
|
|
|
dialog.alert(I18n.t("admin.watched_words.form.upload_successful"));
|
2019-01-10 18:06:01 +08:00
|
|
|
this.done();
|
2017-06-29 04:56:44 +08:00
|
|
|
}
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
|
|
|
}
|