diff --git a/app/controllers/admin/embedding_controller.rb b/app/controllers/admin/embedding_controller.rb index 623c2a25a26..4c5f8548b59 100644 --- a/app/controllers/admin/embedding_controller.rb +++ b/app/controllers/admin/embedding_controller.rb @@ -9,6 +9,10 @@ class Admin::EmbeddingController < Admin::AdminController end def update + if params[:embedding][:embed_by_username].blank? + return render_json_error(I18n.t('site_settings.embed_username_required')) + end + Embedding.settings.each do |s| @embedding.send("#{s}=", params[:embedding][s]) end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 6a77f12a016..308aeb3955c 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1195,6 +1195,7 @@ en: embed_username_key_from_feed: "Key to pull discourse username from feed." embed_truncate: "Truncate the embedded posts." embed_post_limit: "Maximum number of posts to embed." + embed_username_required: "The username for topic creation is required." embed_whitelist_selector: "CSS selector for elements that are allowed in embeds." embed_blacklist_selector: "CSS selector for elements that are removed from embeds." notify_about_flags_after: "If there are flags that haven't been handled after this many hours, send an email to the contact_email. Set to 0 to disable."