activestorage 7.1.3.3 → 7.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/jobs/active_storage/preview_image_job.rb +16 -0
- data/app/models/active_storage/attachment.rb +12 -2
- data/app/models/active_storage/blob/representable.rb +8 -0
- data/lib/active_storage/attached/model.rb +8 -4
- data/lib/active_storage/gem_version.rb +2 -2
- data/lib/active_storage.rb +1 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7090b004185703ae6dc98db17916ed43277cc6e2f36cfe1ed9c80b6ac1571ab0
|
4
|
+
data.tar.gz: 1d767b1c2a6c88390ac96ba2e17f6215c30487a87541c03780ba3e3feeb40a34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dde4aa29cd76824dfe0b3b177c20e2ae87d81a8e86d3ad2272ce5507de30a8fbfbb28bab0b81e7bd1845a0f9a0f80c17d5a1dbc951055f7e9c07f88d2bb3d9cf
|
7
|
+
data.tar.gz: 1f21e247f8f191da8c81044e194acda189736ff9e4c19939833425f5d0659627988f8a2314cdf193c6f99ff5088d170f3c8b09e8b86459371b3721829ff7e3ae
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ActiveStorage::PreviewImageJob < ActiveStorage::BaseJob
|
4
|
+
queue_as { ActiveStorage.queues[:preview_image] }
|
5
|
+
|
6
|
+
discard_on ActiveRecord::RecordNotFound, ActiveStorage::UnrepresentableError
|
7
|
+
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
|
8
|
+
|
9
|
+
def perform(blob, variations)
|
10
|
+
blob.preview({}).processed
|
11
|
+
|
12
|
+
variations.each do |transformations|
|
13
|
+
blob.preprocessed(transformations)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -132,8 +132,18 @@ class ActiveStorage::Attachment < ActiveStorage::Record
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def transform_variants_later
|
135
|
-
named_variants.
|
136
|
-
|
135
|
+
preprocessed_variations = named_variants.filter_map { |_name, named_variant|
|
136
|
+
if named_variant.preprocessed?(record)
|
137
|
+
named_variant.transformations
|
138
|
+
end
|
139
|
+
}
|
140
|
+
|
141
|
+
if blob.preview_image_needed_before_processing_variants?
|
142
|
+
blob.create_preview_image_later(preprocessed_variations)
|
143
|
+
else
|
144
|
+
preprocessed_variations.each do |transformations|
|
145
|
+
blob.preprocessed(transformations)
|
146
|
+
end
|
137
147
|
end
|
138
148
|
end
|
139
149
|
|
@@ -98,6 +98,14 @@ module ActiveStorage::Blob::Representable
|
|
98
98
|
variable? || previewable?
|
99
99
|
end
|
100
100
|
|
101
|
+
def preview_image_needed_before_processing_variants? # :nodoc:
|
102
|
+
previewable? && !preview_image.attached?
|
103
|
+
end
|
104
|
+
|
105
|
+
def create_preview_image_later(variations) # :nodoc:
|
106
|
+
ActiveStorage::PreviewImageJob.perform_later(self, variations) if representable?
|
107
|
+
end
|
108
|
+
|
101
109
|
def preprocessed(transformations) # :nodoc:
|
102
110
|
ActiveStorage::TransformJob.perform_later(self, transformations) if representable?
|
103
111
|
end
|
@@ -74,8 +74,10 @@ module ActiveStorage
|
|
74
74
|
# The system has been designed to having you go through the ActiveStorage::Attached::One
|
75
75
|
# proxy that provides the dynamic proxy to the associations and factory methods, like +attach+.
|
76
76
|
#
|
77
|
-
#
|
78
|
-
# (i.e. destroyed) whenever the record is destroyed.
|
77
|
+
# The +:dependent+ option defaults to +:purge_later+. This means the attachment will be
|
78
|
+
# purged (i.e. destroyed) in the background whenever the record is destroyed.
|
79
|
+
# If an ActiveJob::Backend queue adapter is not set in the application set it to
|
80
|
+
# +purge+ instead.
|
79
81
|
#
|
80
82
|
# If you need the attachment to use a service which differs from the globally configured one,
|
81
83
|
# pass the +:service+ option. For instance:
|
@@ -162,8 +164,10 @@ module ActiveStorage
|
|
162
164
|
# The system has been designed to having you go through the ActiveStorage::Attached::Many
|
163
165
|
# proxy that provides the dynamic proxy to the associations and factory methods, like +#attach+.
|
164
166
|
#
|
165
|
-
#
|
166
|
-
# (i.e. destroyed) whenever the record is destroyed.
|
167
|
+
# The +:dependent+ option defaults to +:purge_later+. This means the attachments will be
|
168
|
+
# purged (i.e. destroyed) in the background whenever the record is destroyed.
|
169
|
+
# If an ActiveJob::Backend queue adapter is not set in the application set it to
|
170
|
+
# +purge+ instead.
|
167
171
|
#
|
168
172
|
# If you need the attachment to use a service which differs from the globally configured one,
|
169
173
|
# pass the +:service+ option. For instance:
|
data/lib/active_storage.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.1.
|
19
|
+
version: 7.1.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.1.
|
26
|
+
version: 7.1.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 7.1.
|
33
|
+
version: 7.1.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 7.1.
|
40
|
+
version: 7.1.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activejob
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 7.1.
|
47
|
+
version: 7.1.4
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 7.1.
|
54
|
+
version: 7.1.4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activerecord
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 7.1.
|
61
|
+
version: 7.1.4
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 7.1.
|
68
|
+
version: 7.1.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: marcel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- app/jobs/active_storage/analyze_job.rb
|
117
117
|
- app/jobs/active_storage/base_job.rb
|
118
118
|
- app/jobs/active_storage/mirror_job.rb
|
119
|
+
- app/jobs/active_storage/preview_image_job.rb
|
119
120
|
- app/jobs/active_storage/purge_job.rb
|
120
121
|
- app/jobs/active_storage/transform_job.rb
|
121
122
|
- app/models/active_storage/attachment.rb
|
@@ -189,10 +190,10 @@ licenses:
|
|
189
190
|
- MIT
|
190
191
|
metadata:
|
191
192
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
192
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.1.
|
193
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.
|
193
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.4/activestorage/CHANGELOG.md
|
194
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.4/
|
194
195
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
195
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.
|
196
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.4/activestorage
|
196
197
|
rubygems_mfa_required: 'true'
|
197
198
|
post_install_message:
|
198
199
|
rdoc_options: []
|
@@ -209,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
210
|
- !ruby/object:Gem::Version
|
210
211
|
version: '0'
|
211
212
|
requirements: []
|
212
|
-
rubygems_version: 3.5.
|
213
|
+
rubygems_version: 3.5.11
|
213
214
|
signing_key:
|
214
215
|
specification_version: 4
|
215
216
|
summary: Local and cloud file storage framework.
|