Skip to content

Commit

Permalink
Merge pull request #1527 from ODNZSL/revert-1524-task/nzsl-167-presig…
Browse files Browse the repository at this point in the history
…n-sign-asset-requests

Revert "NZSL-167: Presign asset requests"
  • Loading branch information
joshmcarthur authored Jan 17, 2024
2 parents a0c33ff + 140685a commit 186374d
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 220 deletions.
6 changes: 0 additions & 6 deletions app/models/signbank/asset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,5 @@ class Asset < Signbank::Record
default_scope -> { order(display_order: :asc) }

scope :image, -> { where("filename LIKE '%.png'") }

def url
return unless super.presence

AssetURL.new(super).url.to_s
end
end
end
69 changes: 0 additions & 69 deletions app/models/signbank/asset_url.rb

This file was deleted.

6 changes: 0 additions & 6 deletions app/models/signbank/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,5 @@ class Example < Signbank::Record
foreign_key: :word_id,
inverse_of: :examples
default_scope -> { order(display_order: :asc).where.not(video: nil) }

def video
return unless super.presence

AssetURL.new(super).url.to_s
end
end
end
6 changes: 0 additions & 6 deletions app/models/signbank/sign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ def picture_url
picture&.url
end

def video
return unless super.presence

AssetURL.new(super).url.to_s
end

##
# These are all aliases for the object shape that
# existing code is expecting
Expand Down
8 changes: 4 additions & 4 deletions config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
Expand All @@ -12,6 +11,7 @@
# inflect.uncountable %w( fish sheep )
# end

ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym 'URL'
end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
19 changes: 0 additions & 19 deletions spec/models/signbank/asset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,6 @@
end
end

describe '#url' do
it 'uses Signbank::AssetURL' do
double = instance_double(Signbank::AssetURL, url: URI.parse('/test.png'))
allow(Signbank::AssetURL).to receive(:new).and_return(double)
asset = Signbank::Asset.new(url: 'test.png')
expect(asset.url).to eq '/test.png'
end

it 'is nil when the URL is nil' do
asset = Signbank::Asset.new(url: nil)
expect(asset.url).to be_nil
end

it 'is nil when the URL is blank' do
asset = Signbank::Asset.new(url: '')
expect(asset.url).to be_nil
end
end

describe '.scoped' do
it 'is ordered by display_order' do
sign = Signbank::Sign.create!(id: SecureRandom.uuid)
Expand Down
72 changes: 0 additions & 72 deletions spec/models/signbank/asset_url_spec.rb

This file was deleted.

19 changes: 0 additions & 19 deletions spec/models/signbank/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,4 @@
expect(sign.examples).to be_empty
end
end

describe '#video' do
it 'uses Signbank::AssetURL' do
double = instance_double(Signbank::AssetURL, url: URI.parse('/test.png'))
allow(Signbank::AssetURL).to receive(:new).and_return(double)
example = Signbank::Example.new(video: 'test.png')
expect(example.video).to eq '/test.png'
end

it 'is nil when the URL is nil' do
example = Signbank::Example.new(video: nil)
expect(example.video).to be_nil
end

it 'is nil when the URL is blank' do
example = Signbank::Example.new(video: '')
expect(example.video).to be_nil
end
end
end
19 changes: 0 additions & 19 deletions spec/models/signbank/sign_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,4 @@ module Signbank
end
end
end

describe '#url' do
it 'uses Signbank::AssetURL' do
double = instance_double(Signbank::AssetURL, url: URI.parse('/test.png'))
allow(Signbank::AssetURL).to receive(:new).and_return(double)
sign = Signbank::Sign.new(video: 'test.png')
expect(sign.video).to eq '/test.png'
end

it 'is nil when the URL is nil' do
sign = Signbank::Sign.new(video: nil)
expect(sign.video).to be_nil
end

it 'is nil when the URL is blank' do
sign = Signbank::Sign.new(video: '')
expect(sign.video).to be_nil
end
end
end

0 comments on commit 186374d

Please sign in to comment.