Revert "FEATURE: Add post language on creating a new post (#33001)" (#33157)

This reverts commit b55af383f779d01d983a3ccf1149438aee9c6725.
This commit is contained in:
Keegan George
2025-06-11 08:01:56 -07:00
committed by GitHub
parent b55af383f7
commit d5b72a54ae
19 changed files with 65 additions and 228 deletions

View File

@ -6,33 +6,20 @@ class PostLocalizationsController < ApplicationController
def show
guardian.ensure_can_localize_content!
params.require(:post_id)
params.require(%i[post_id])
localizations = PostLocalization.where(post_id: params[:post_id])
post = Post.find_by(id: params[:post_id])
return render json_error(I18n.t("not_found"), status: :not_found) if post.blank?
post_localizations = PostLocalization.where(post_id: post.id)
topic_localizations_by_locale = {}
if post.is_first_post?
TopicLocalization
.where(topic_id: post.topic_id)
.each { |tl| topic_localizations_by_locale[tl.locale] = tl }
end
post_localizations.each do |pl|
pl.define_singleton_method(:topic_localization) { topic_localizations_by_locale[pl.locale] }
end
render json: {
post_localizations:
if localizations
render json:
ActiveModel::ArraySerializer.new(
post_localizations,
localizations,
each_serializer: PostLocalizationSerializer,
root: false,
).as_json,
},
status: :ok
status: :ok
else
render json_error I18n.t("not_found"), status: :not_found
end
end
def create_or_update