Skip to content

Commit

Permalink
Add support for ActiveStorage expires_in (#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bramjetten authored Dec 23, 2021
1 parent 8b36256 commit 2905605
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 89 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gemspec
gem 'rails', '~> 6.1.4'

group :development do
gem 'letter_opener'
Expand Down
117 changes: 58 additions & 59 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,65 +24,65 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.4.4)
actionpack (= 6.1.4.4)
activesupport (= 6.1.4.4)
actioncable (7.0.0)
actionpack (= 7.0.0)
activesupport (= 7.0.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.4.4)
actionpack (= 6.1.4.4)
activejob (= 6.1.4.4)
activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
actionmailbox (7.0.0)
actionpack (= 7.0.0)
activejob (= 7.0.0)
activerecord (= 7.0.0)
activestorage (= 7.0.0)
activesupport (= 7.0.0)
mail (>= 2.7.1)
actionmailer (6.1.4.4)
actionpack (= 6.1.4.4)
actionview (= 6.1.4.4)
activejob (= 6.1.4.4)
activesupport (= 6.1.4.4)
actionmailer (7.0.0)
actionpack (= 7.0.0)
actionview (= 7.0.0)
activejob (= 7.0.0)
activesupport (= 7.0.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.4.4)
actionview (= 6.1.4.4)
activesupport (= 6.1.4.4)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.0)
actionview (= 7.0.0)
activesupport (= 7.0.0)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.4.4)
actionpack (= 6.1.4.4)
activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
actiontext (7.0.0)
actionpack (= 7.0.0)
activerecord (= 7.0.0)
activestorage (= 7.0.0)
activesupport (= 7.0.0)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.4.4)
activesupport (= 6.1.4.4)
actionview (7.0.0)
activesupport (= 7.0.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.4.4)
activesupport (= 6.1.4.4)
activejob (7.0.0)
activesupport (= 7.0.0)
globalid (>= 0.3.6)
activemodel (6.1.4.4)
activesupport (= 6.1.4.4)
activerecord (6.1.4.4)
activemodel (= 6.1.4.4)
activesupport (= 6.1.4.4)
activestorage (6.1.4.4)
actionpack (= 6.1.4.4)
activejob (= 6.1.4.4)
activerecord (= 6.1.4.4)
activesupport (= 6.1.4.4)
marcel (~> 1.0.0)
activemodel (7.0.0)
activesupport (= 7.0.0)
activerecord (7.0.0)
activemodel (= 7.0.0)
activesupport (= 7.0.0)
activestorage (7.0.0)
actionpack (= 7.0.0)
activejob (= 7.0.0)
activerecord (= 7.0.0)
activesupport (= 7.0.0)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.4.4)
activesupport (7.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ancestry (4.1.0)
Expand Down Expand Up @@ -184,21 +184,20 @@ GEM
rack-rewrite (1.5.1)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.4.4)
actioncable (= 6.1.4.4)
actionmailbox (= 6.1.4.4)
actionmailer (= 6.1.4.4)
actionpack (= 6.1.4.4)
actiontext (= 6.1.4.4)
actionview (= 6.1.4.4)
activejob (= 6.1.4.4)
activemodel (= 6.1.4.4)
activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
rails (7.0.0)
actioncable (= 7.0.0)
actionmailbox (= 7.0.0)
actionmailer (= 7.0.0)
actionpack (= 7.0.0)
actiontext (= 7.0.0)
actionview (= 7.0.0)
activejob (= 7.0.0)
activemodel (= 7.0.0)
activerecord (= 7.0.0)
activestorage (= 7.0.0)
activesupport (= 7.0.0)
bundler (>= 1.15.0)
railties (= 6.1.4.4)
sprockets-rails (>= 2.0.0)
railties (= 7.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -208,12 +207,13 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (6.1.4.4)
actionpack (= 6.1.4.4)
activesupport (= 6.1.4.4)
railties (7.0.0)
actionpack (= 7.0.0)
activesupport (= 7.0.0)
method_source
rake (>= 0.13)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
regexp_parser (2.2.0)
request_store (1.5.0)
Expand Down Expand Up @@ -273,7 +273,6 @@ DEPENDENCIES
mocha
pry-rails
puma
rails (~> 6.1.4)
rails-controller-testing
selenium-webdriver (~> 4.1.0)
simplecov
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/spina/admin/images_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def edit
# 2. We destroy the entire record if the uploaded file is not an image
def create
@images = params[:image][:files].map do |file|
next if file.blank? # Skip the blank string posted by the hidden files[] field

# Create the image and attach the file
image = Image.create(media_folder_id: image_params[:media_folder_id])
image.file.attach(file)
Expand Down
2 changes: 1 addition & 1 deletion app/models/spina/parts/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def present?
signed_blob_id.present?
end

def signed_id
def signed_id(expires_in: nil)
signed_blob_id
end

Expand Down
1 change: 1 addition & 0 deletions lib/spina/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require 'view_component'
require 'jsonapi/serializer'
require 'browser'
require 'sprockets/railtie'

module Spina
class Engine < ::Rails::Engine
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
config.load_defaults 7.0

config.hosts << "dummy.puma"
config.hosts << "dummy.test"
Expand Down
27 changes: 0 additions & 27 deletions test/dummy/config/initializers/new_framework_defaults_6_1.rb

This file was deleted.

0 comments on commit 2905605

Please sign in to comment.