From d5b72a54ae5b51b00da6aaa96c12e3d1a471cd50 Mon Sep 17 00:00:00 2001 From: Keegan George Date: Wed, 11 Jun 2025 08:01:56 -0700 Subject: [PATCH] Revert "FEATURE: Add post language on creating a new post (#33001)" (#33157) This reverts commit b55af383f779d01d983a3ccf1149438aee9c6725. --- .../app/components/composer-action-title.gjs | 26 --------- .../edit-category-localizations.gjs | 2 +- .../app/components/language-switcher.gjs | 22 ++++++-- .../components/modal/post-translations.gjs | 10 +--- .../app/components/post-language-selector.gjs | 54 ------------------- .../components/post-translation-editor.gjs | 50 ++++++++--------- .../discourse/app/models/composer.js | 7 --- .../discourse/app/services/composer.js | 6 +-- .../common/components/post-translations.scss | 12 ----- .../post_localizations_controller.rb | 31 ++++------- app/controllers/posts_controller.rb | 7 +-- app/models/site_setting.rb | 14 ----- .../post_localization_serializer.rb | 10 +--- .../topic_localization_serializer.rb | 5 -- lib/post_creator.rb | 1 - lib/post_revisor.rb | 2 +- spec/system/anon_language_switcher_spec.rb | 10 +--- .../edit_category_localizations_spec.rb | 11 +--- spec/system/post_translation_spec.rb | 13 ++--- 19 files changed, 65 insertions(+), 228 deletions(-) delete mode 100644 app/assets/javascripts/discourse/app/components/post-language-selector.gjs delete mode 100644 app/serializers/topic_localization_serializer.rb diff --git a/app/assets/javascripts/discourse/app/components/composer-action-title.gjs b/app/assets/javascripts/discourse/app/components/composer-action-title.gjs index a7c528bbcff..00b4dfb8d64 100644 --- a/app/assets/javascripts/discourse/app/components/composer-action-title.gjs +++ b/app/assets/javascripts/discourse/app/components/composer-action-title.gjs @@ -1,10 +1,8 @@ import Component from "@ember/component"; import { hash } from "@ember/helper"; import { alias } from "@ember/object/computed"; -import { service } from "@ember/service"; import { htmlSafe } from "@ember/template"; import { classNames } from "@ember-decorators/component"; -import PostLanguageSelector from "discourse/components/post-language-selector"; import discourseComputed from "discourse/lib/decorators"; import escape from "discourse/lib/escape"; import { iconHTML } from "discourse/lib/icon-library"; @@ -30,9 +28,6 @@ const TITLES = { @classNames("composer-action-title") export default class ComposerActionTitle extends Component { - @service currentUser; - @service siteSettings; - @alias("model.replyOptions") options; @alias("model.action") action; @@ -69,20 +64,6 @@ export default class ComposerActionTitle extends Component { } } - get showPostLanguageSelector() { - const allowedActions = [CREATE_TOPIC, EDIT, REPLY]; - if ( - this.currentUser && - this.siteSettings.experimental_content_localization && - this.currentUser.can_localize_content && - allowedActions.includes(this.model.action) - ) { - return true; - } - - return false; - } - _formatEditUserPost(userAvatar, userLink, postLink, originalUser) { let editTitle = ` ${postLink.anchor} @@ -133,12 +114,5 @@ export default class ComposerActionTitle extends Component { {{this.actionTitle}} - - {{#if this.showPostLanguageSelector}} - - {{/if}} } diff --git a/app/assets/javascripts/discourse/app/components/edit-category-localizations.gjs b/app/assets/javascripts/discourse/app/components/edit-category-localizations.gjs index f01f5b7f2cd..f9569973bf6 100644 --- a/app/assets/javascripts/discourse/app/components/edit-category-localizations.gjs +++ b/app/assets/javascripts/discourse/app/components/edit-category-localizations.gjs @@ -10,7 +10,7 @@ export default class EditCategoryLocalizations extends buildCategoryPanel( @service siteSettings; get availableLocales() { - return this.siteSettings.available_content_localization_locales; + return JSON.parse(this.siteSettings.available_locales); }