mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-17 07:22:56 +08:00
Toasts can now have two durations: - `short` -> 3000ms - `long` -> 5000ms For backwards compatibility integer values still work but will display a deprecation message in the browser console.
38 lines
1 KiB
JavaScript
38 lines
1 KiB
JavaScript
import Controller, { inject as controller } from "@ember/controller";
|
|
import { action } from "@ember/object";
|
|
import { service } from "@ember/service";
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
export default class AdminEmbeddingCrawlersController extends Controller {
|
|
@service toasts;
|
|
@controller adminEmbedding;
|
|
|
|
get formData() {
|
|
const embedding = this.adminEmbedding.embedding;
|
|
|
|
return {
|
|
allowed_embed_selectors: embedding.allowed_embed_selectors,
|
|
blocked_embed_selectors: embedding.blocked_embed_selectors,
|
|
allowed_embed_classnames: embedding.allowed_embed_classnames,
|
|
};
|
|
}
|
|
|
|
@action
|
|
async save(data) {
|
|
const embedding = this.adminEmbedding.embedding;
|
|
|
|
try {
|
|
await embedding.update({
|
|
type: "crawlers",
|
|
...data,
|
|
});
|
|
this.toasts.success({
|
|
duration: "short",
|
|
data: { message: i18n("admin.embedding.crawler_settings_saved") },
|
|
});
|
|
} catch (error) {
|
|
popupAjaxError(error);
|
|
}
|
|
}
|
|
}
|