actiontext 6.0.4.8 → 6.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actiontext might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fb3dbccbbe86edfad8d61aa2599dbcd0969e51c629add231fc737f1caac542c
4
- data.tar.gz: bc9b8ed354e689ff6d22fb2ab2eb8fe0f2ac3467d93d1af548e3e22412cee88a
3
+ metadata.gz: 4475a564fddc94eab3c96d86f66a3190b5859647e0c8023857e743aaa684a117
4
+ data.tar.gz: bbd377f44089938f0112534f70a492ec5db8fe1c15ceee5caeb729198e34c5bb
5
5
  SHA512:
6
- metadata.gz: 47c4bc3bc7ea6dc52842b8784dd7eed9f05532dc96329648cde789754f4f56d06b4f3f03c207caca5e79034d6bce27b22704171099b69216c0e92e71231e8871
7
- data.tar.gz: ada97b11cf94365024ffabcb02cd1a7016bcfdc05df8f13e8cd646ccd7737a1f05dc95e6ff7327fd5489fed76dbe8374e80a32c6b9b826b8d43706f6ad583b5d
6
+ metadata.gz: 859c99be184e2d2c9dd782ad388170045a6d1ee72b267fa5e5c2290c9f97781b059e1ad9d38ec50ed3d33f38307049fbdb740ada564f50329835b1bf7d444b7f
7
+ data.tar.gz: 9a51b912b87719543d378892b50548d265d5c96b2bed7d6d38e1e906d01947a3db90fea90382bdaea44a6d02b69085c0c5daaeef3a2d2f255553d79886736ad7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## Rails 6.0.5 (May 09, 2022) ##
2
+
3
+ * Disentangle Action Text from ApplicationController
4
+
5
+ Allow Action Text to be used without having an ApplicationController
6
+ defined.
7
+ This makes sure:
8
+ * Action Text attachments render the correct URL host in mailers.
9
+ * an ActionController::Renderer isn't allocated per request.
10
+ * Sidekiq doesn't hang with the "classic" autoloader.
11
+
12
+ *Jonathan Hefner*
13
+
1
14
  ## Rails 6.0.4.8 (April 26, 2022) ##
2
15
 
3
16
  * No changes.
@@ -10,6 +10,7 @@ module ActionText
10
10
  mattr_accessor(:scrubber)
11
11
 
12
12
  def render_action_text_content(content)
13
+ self.prefix_partial_path_with_controller_namespace = false
13
14
  sanitize_action_text_content(render_action_text_attachments(content))
14
15
  end
15
16
 
@@ -26,7 +26,7 @@ module ActionText
26
26
  private
27
27
  def trix_attachment_content
28
28
  if partial_path = attachable.try(:to_trix_content_attachment_partial_path)
29
- ActionText::Content.renderer.render(partial: partial_path, object: self, as: model_name.element)
29
+ ActionText::Content.render(partial: partial_path, object: self, as: model_name.element)
30
30
  end
31
31
  end
32
32
  end
@@ -1,12 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/core_ext/module/attribute_accessors_per_thread"
4
-
5
3
  module ActionText
6
4
  class Content
7
- include Serialization
8
-
9
- thread_cattr_accessor :renderer
5
+ include Rendering, Serialization
10
6
 
11
7
  attr_reader :fragment
12
8
 
@@ -88,7 +84,7 @@ module ActionText
88
84
  end
89
85
 
90
86
  def to_rendered_html_with_layout
91
- renderer.render(partial: "action_text/content/layout", locals: { content: self })
87
+ render partial: "action_text/content/layout", locals: { content: self }
92
88
  end
93
89
 
94
90
  def to_s
@@ -37,21 +37,24 @@ module ActionText
37
37
  end
38
38
 
39
39
  initializer "action_text.helper" do
40
- ActiveSupport.on_load(:action_controller_base) do
41
- helper ActionText::Engine.helpers
40
+ %i[action_controller_base action_mailer].each do |abstract_controller|
41
+ ActiveSupport.on_load(abstract_controller) do
42
+ helper ActionText::Engine.helpers
43
+ end
42
44
  end
43
45
  end
44
46
 
45
- initializer "action_text.renderer" do |app|
46
- app.executor.to_run { ActionText::Content.renderer = ApplicationController.renderer }
47
- app.executor.to_complete { ActionText::Content.renderer = ApplicationController.renderer }
48
-
47
+ initializer "action_text.renderer" do
49
48
  ActiveSupport.on_load(:action_text_content) do
50
- self.renderer = ApplicationController.renderer
49
+ self.renderer = Class.new(ActionController::Base).renderer
51
50
  end
52
51
 
53
- ActiveSupport.on_load(:action_controller_base) do
54
- before_action { ActionText::Content.renderer = ApplicationController.renderer.new(request.env) }
52
+ %i[action_controller_base action_mailer].each do |abstract_controller|
53
+ ActiveSupport.on_load(abstract_controller) do
54
+ around_action do |controller, action|
55
+ ActionText::Content.with_renderer(controller, &action)
56
+ end
57
+ end
55
58
  end
56
59
  end
57
60
  end
@@ -9,8 +9,8 @@ module ActionText
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 4
13
- PRE = "8"
12
+ TINY = 5
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+ require "active_support/core_ext/module/attribute_accessors_per_thread"
5
+
6
+ module ActionText
7
+ module Rendering #:nodoc:
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ thread_cattr_accessor :renderer, instance_accessor: false
12
+ delegate :render, to: :class
13
+ end
14
+
15
+ class_methods do
16
+ def with_renderer(renderer)
17
+ previous_renderer = self.renderer
18
+ self.renderer = renderer
19
+ yield
20
+ ensure
21
+ self.renderer = previous_renderer
22
+ end
23
+
24
+ def render(*args, &block)
25
+ renderer.render_to_string(*args, &block)
26
+ end
27
+ end
28
+ end
29
+ end
data/lib/action_text.rb CHANGED
@@ -16,6 +16,7 @@ module ActionText
16
16
  autoload :Fragment
17
17
  autoload :HtmlConversion
18
18
  autoload :PlainTextConversion
19
+ autoload :Rendering
19
20
  autoload :Serialization
20
21
  autoload :TrixAttachment
21
22
 
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rails/actiontext",
3
- "version": "6.0.4-8",
3
+ "version": "6.0.5",
4
4
  "description": "Edit and display rich text in Rails applications",
5
5
  "main": "app/javascript/actiontext/index.js",
6
6
  "files": [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actiontext
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.4.8
4
+ version: 6.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javan Makhmali
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-04-26 00:00:00.000000000 Z
13
+ date: 2022-05-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -18,56 +18,56 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 6.0.4.8
21
+ version: 6.0.5
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 6.0.4.8
28
+ version: 6.0.5
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: activerecord
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 6.0.4.8
35
+ version: 6.0.5
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 6.0.4.8
42
+ version: 6.0.5
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: activestorage
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 6.0.4.8
49
+ version: 6.0.5
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 6.0.4.8
56
+ version: 6.0.5
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: actionpack
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 6.0.4.8
63
+ version: 6.0.5
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 6.0.4.8
70
+ version: 6.0.5
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: nokogiri
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,7 @@ files:
122
122
  - lib/action_text/gem_version.rb
123
123
  - lib/action_text/html_conversion.rb
124
124
  - lib/action_text/plain_text_conversion.rb
125
+ - lib/action_text/rendering.rb
125
126
  - lib/action_text/serialization.rb
126
127
  - lib/action_text/trix_attachment.rb
127
128
  - lib/action_text/version.rb
@@ -135,10 +136,11 @@ licenses:
135
136
  - MIT
136
137
  metadata:
137
138
  bug_tracker_uri: https://github.com/rails/rails/issues
138
- changelog_uri: https://github.com/rails/rails/blob/v6.0.4.8/actiontext/CHANGELOG.md
139
- documentation_uri: https://api.rubyonrails.org/v6.0.4.8/
139
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.5/actiontext/CHANGELOG.md
140
+ documentation_uri: https://api.rubyonrails.org/v6.0.5/
140
141
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
141
- source_code_uri: https://github.com/rails/rails/tree/v6.0.4.8/actiontext
142
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.5/actiontext
143
+ rubygems_mfa_required: 'true'
142
144
  post_install_message:
143
145
  rdoc_options: []
144
146
  require_paths:
@@ -154,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
156
  - !ruby/object:Gem::Version
155
157
  version: '0'
156
158
  requirements: []
157
- rubygems_version: 3.1.6
159
+ rubygems_version: 3.3.7
158
160
  signing_key:
159
161
  specification_version: 4
160
162
  summary: Rich text framework.