Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[review] html_escape設定を必須に #91

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["3.0", 3.1, 3.2]
gemfile: ["6.1", "7.0", "main"]
ruby: ["3.0", 3.1, 3.2, 3,3]
gemfile: ["6.1", "7.0", "7.1", "main"]
exclude:
- ruby: "3.0"
gemfile: "main"
- ruby: "3.1"
gemfile: "6.1"
- ruby: "3.2"
gemfile: "6.1"
- ruby: "3.3"
gemfile: "6.1"
steps:
- name: Install packages
run: |
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.importModuleSpecifier": "non-relative",
Expand Down
5 changes: 5 additions & 0 deletions gemfiles/7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "http://rubygems.org"

gem "rails", "~> 7.1"

gemspec :path => "../"
9 changes: 8 additions & 1 deletion lib/copy_tuner_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,20 @@ def initialize
self.upload_disabled_environments = %w[production staging]
self.s3_host = 'copy-tuner-data-prod.s3.amazonaws.com'
self.disable_copyray_comment_injection = false
self.html_escape = false
# TODO: 0.18.0以降のバージョンで初期値をtrueにしたい
self.html_escape = nil
self.ignored_keys = []
self.ignored_key_handler = -> (e) { raise e }

@applied = false
end

def html_escape
raise 'CopyTunerClient.configuration.html_escape is required' if @html_escape.nil?

@html_escape
end

# Allows config options to be read like a hash
#
# @param [Symbol] option Key for a given attribute
Expand Down
2 changes: 1 addition & 1 deletion lib/copy_tuner_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module CopyTunerClient
# Client version
VERSION = '0.16.3'.freeze
VERSION = '0.17.0'.freeze

# API version being used to communicate with the server
API_VERSION = '2.0'.freeze
Expand Down
4 changes: 2 additions & 2 deletions spec/copy_tuner_client/i18n_backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def build_backend
expect(cache['en.test.key']).to eq 'default %{interpolate}'
end

it "marks strings as html safe" do
it "dose not mark strings as html safe" do
cache['en.test.key'] = FakeHtmlSafeString.new("Hello")
backend = build_backend
expect(backend.translate('en', 'test.key')).to be_html_safe
expect(backend.translate('en', 'test.key')).to_not be_html_safe
end

it "looks up an array of defaults" do
Expand Down
1 change: 1 addition & 0 deletions spec/support/client_spec_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def reset_config
CopyTunerClient.configure(false) do |config|
config.api_key = 'abc123'
config.s3_host = 'copy-tuner.com'
config.html_escape = true
end
end
end
Loading