Skip to content

Commit

Permalink
Merge tag 'v4.1.9' into ertona.net
Browse files Browse the repository at this point in the history
  • Loading branch information
shibafu528 committed Sep 21, 2023
2 parents c6acd91 + e4c0aaf commit eb99832
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 49 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/lint-ruby.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Changelog

All notable changes to this project will be documented in this file.

## [4.1.9] - 2023-09-20

### Fixed

- Fix post translation erroring out ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/26990))

## [4.1.8] - 2023-09-19

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion app/lib/translation_service/deepl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def transform_response(str)

raise UnexpectedResponseError unless json.is_a?(Hash)

Translation.new(text: json.dig('translations', 0, 'text'), detected_source_language: json.dig('translations', 0, 'detected_source_language')&.downcase, provider: 'DeepL.com')
Translation.new(text: Sanitize.fragment(json.dig('translations', 0, 'text'), Sanitize::Config::MASTODON_STRICT), detected_source_language: json.dig('translations', 0, 'detected_source_language')&.downcase, provider: 'DeepL.com')
rescue Oj::ParseError
raise UnexpectedResponseError
end
Expand Down
2 changes: 1 addition & 1 deletion app/lib/translation_service/libre_translate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def transform_response(str, source_language)

raise UnexpectedResponseError unless json.is_a?(Hash)

Translation.new(text: json['translatedText'], detected_source_language: source_language, provider: 'LibreTranslate')
Translation.new(text: Sanitize.fragment(json['translatedText'], Sanitize::Config::MASTODON_STRICT), detected_source_language: source_language, provider: 'LibreTranslate')
rescue Oj::ParseError
raise UnexpectedResponseError
end
Expand Down
4 changes: 2 additions & 2 deletions app/services/translate_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def call(status, target_language)
@content = status_content_format(@status)
@target_language = target_language

Rails.cache.fetch("translations/#{@status.language}/#{@target_language}/#{content_hash}", expires_in: CACHE_TTL) do
Sanitize.fragment(translation_backend.translate(@content, @status.language, @target_language), Sanitize::Config::MASTODON_STRICT)
Rails.cache.fetch("translations:v2/#{@status.language}/#{@target_language}/#{content_hash}", expires_in: CACHE_TTL) do
translation_backend.translate(@content, @status.language, @target_language)
end
end

Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ services:

web:
build: .
image: ghcr.io/mastodon/mastodon:v4.1.8
image: ghcr.io/mastodon/mastodon:v4.1.9
restart: always
env_file: .env.production
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
Expand All @@ -77,7 +77,7 @@ services:

streaming:
build: .
image: ghcr.io/mastodon/mastodon:v4.1.8
image: ghcr.io/mastodon/mastodon:v4.1.9
restart: always
env_file: .env.production
command: node ./streaming
Expand All @@ -95,7 +95,7 @@ services:

sidekiq:
build: .
image: ghcr.io/mastodon/mastodon:v4.1.8
image: ghcr.io/mastodon/mastodon:v4.1.9
restart: always
env_file: .env.production
command: bundle exec sidekiq
Expand Down
2 changes: 1 addition & 1 deletion lib/mastodon/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def minor
end

def patch
8
9
end

def flags
Expand Down

0 comments on commit eb99832

Please sign in to comment.