summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-02-10 03:09:44 +0100
committerGitHub <noreply@github.com>2022-02-10 03:09:44 +0100
commit1bfcb75105baae556101f44957d0fa5b28ef013b (patch)
tree178e593392c283257cb8d1f38400f2542754f92c /app
parent63002cde03a836b4510aca5da564504ecaedb5e9 (diff)
Fix outdated iso-639 reference in update status service (#17496)
Diffstat (limited to 'app')
-rw-r--r--app/services/update_status_service.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb
index 69dc18e87da..68e73d3b468 100644
--- a/app/services/update_status_service.rb
+++ b/app/services/update_status_service.rb
@@ -2,6 +2,7 @@
class UpdateStatusService < BaseService
include Redisable
+ include LanguagesHelper
# @param [Status] status
# @param [Integer] account_id
@@ -95,16 +96,12 @@ class UpdateStatusService < BaseService
@status.text = @options[:text].presence || @options.delete(:spoiler_text) || ''
@status.spoiler_text = @options[:spoiler_text] || ''
@status.sensitive = @options[:sensitive] || @options[:spoiler_text].present?
- @status.language = language_from_option || @status.language
+ @status.language = valid_locale_or_nil(@options[:language] || @status.language || @status.account.user&.preferred_posting_language || I18n.default_locale)
@status.edited_at = Time.now.utc
@status.save!
end
- def language_from_option
- ISO_639.find(@options[:language])&.alpha2
- end
-
def reset_preview_card!
return unless @status.text_previously_changed?