workarea-core 3.4.21 → 3.4.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43fdd50f2d9a692430643d0df84315a29540ffccb3d4f3bdf822555280a154be
4
- data.tar.gz: 4fe3d5c333e3400b5855c63eeb83c92ca2d861a6b5dddd9ce9a5e13046ab8f34
3
+ metadata.gz: e0ac39dbd2237a5eee6f5e178777a066ffd0a147ea8a44acf39bd9fbfae3a552
4
+ data.tar.gz: 33761ee41ab2947ceac2ba27e698691d620ff97b1312a70a0288c1838fc47e1e
5
5
  SHA512:
6
- metadata.gz: 8e86f64b2bdc446737cb257a6414bbdfc7788b66f354e6220c4a27edb26b279c7aa095117ea187ef121626f64d91f38e8c2a20f5dcb29bab8881a8c35de2e2f0
7
- data.tar.gz: dbb29d99e58f970a2a6e85da982379d6675079c39bc61db6185b5aa9cad94272bc36b85494006bb04b7ec491ea019c2f4e5dc955b9cd0ea02f267d13718f623e
6
+ metadata.gz: 4e7764b6fd43aa82afdb84c211ea9d52b21a1cc96d5bc4aba13ceb0f86811406fc0ae5921b86b3975fa162c03c7d4b1d5073563fe9e7f2af33be662f85af2014
7
+ data.tar.gz: 0aefa8eb85b5ae78cbd9fb503e94d80306ead3268fbf06b44e03982f686cc362cf35c1a455a42c7de05d1cc0eef1d02c5f9080edd85fe1cf3bec81ed48d1838f
@@ -37,6 +37,10 @@ module Workarea
37
37
  Workarea.config.data_file_formats.first
38
38
  end
39
39
 
40
+ def mime_type
41
+ "#{MIME::Types.type_for(file_type).first.to_s}; charset=utf-8"
42
+ end
43
+
40
44
  def process!
41
45
  raise NotImplementedError
42
46
  end
@@ -92,6 +92,7 @@ module Workarea
92
92
  class_name: 'Workarea::Pricing::Discount::Redemption'
93
93
 
94
94
  index(active: 1)
95
+ index(updated_at: 1)
95
96
 
96
97
  validates :name, presence: true
97
98
 
@@ -242,7 +243,7 @@ module Workarea
242
243
  # @return [Time]
243
244
  #
244
245
  def auto_deactivates_at
245
- start = last_redemption.try(:created_at) || created_at
246
+ start = last_redemption.try(:created_at) || updated_at
246
247
  start + Workarea.config.discount_staleness_ttl
247
248
  end
248
249
 
@@ -7,6 +7,9 @@ module Workarea
7
7
  url = "#{uri.scheme}://#{uri.host}"
8
8
  url += ":#{uri.port}" unless uri.port.in? [80, 443]
9
9
 
10
+ redis_key = "cors_#{url.optionize}"
11
+ return if Workarea.redis.get(redis_key) == 'true'
12
+
10
13
  Workarea.s3.put_bucket_cors(
11
14
  Configuration::S3.bucket,
12
15
  'CORSConfiguration' => [
@@ -18,6 +21,8 @@ module Workarea
18
21
  }
19
22
  ]
20
23
  )
24
+
25
+ Workarea.redis.set(redis_key, 'true')
21
26
  end
22
27
 
23
28
  attr_reader :type, :filename
@@ -29,7 +29,7 @@ module Workarea
29
29
 
30
30
  def all_active_discount_ids
31
31
  Pricing::Discount
32
- .where(:created_at.lt => Workarea.config.discount_staleness_ttl.ago)
32
+ .where(:updated_at.lt => Workarea.config.discount_staleness_ttl.ago)
33
33
  .active
34
34
  .pluck(:id)
35
35
  .map(&:to_s)
@@ -50,6 +50,28 @@ en:
50
50
  unit: instance
51
51
  csv:
52
52
  unit: row
53
+ duration:
54
+ years:
55
+ one: '%{count} year'
56
+ other: '%{count} years'
57
+ months:
58
+ one: '%{count} month'
59
+ other: '%{count} months'
60
+ weeks:
61
+ one: '%{count} week'
62
+ other: '%{count} weeks'
63
+ days:
64
+ one: '%{count} day'
65
+ other: '%{count} days'
66
+ hours:
67
+ one: '%{count} hour'
68
+ other: '%{count} hours'
69
+ minutes:
70
+ one: '%{count} minute'
71
+ other: '%{count} minutes'
72
+ seconds:
73
+ one: '%{count} second'
74
+ other: '%{count} seconds'
53
75
  errors:
54
76
  messages:
55
77
  contains_type: cannot contain 'type'
@@ -1267,7 +1267,7 @@ module Workarea
1267
1267
  # setting to configure the `:encoding` options for `CSV.foreach`
1268
1268
  # if your CSV files are failing to import with a UTF-8 encoding
1269
1269
  # error.
1270
- config.csv_import_options = {}
1270
+ config.csv_import_options = { encoding: 'bom|utf-8' }
1271
1271
  end
1272
1272
  end
1273
1273
  end
@@ -2,7 +2,7 @@ module Workarea
2
2
  module VERSION
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 21
5
+ PATCH = 22
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
@@ -403,6 +403,21 @@ module Workarea
403
403
  assert_equal("Bowl Light\u0099", product.name)
404
404
  end
405
405
  end
406
+
407
+ def test_bom_characters_in_unicode
408
+ csv = %(\xEF\xBB\xBF_id,name,slug,details_keywords\n653911,Bowl Light,Bowl_Light,"testing")
409
+ import = create_import(
410
+ model_type: Catalog::Product.name,
411
+ file: create_tempfile(csv, extension: 'csv'),
412
+ file_type: 'csv'
413
+ )
414
+
415
+ Csv.new(import).import!
416
+
417
+ product = Catalog::Product.find_by(slug: 'bowl_light')
418
+
419
+ assert_equal('653911', product.id)
420
+ end
406
421
  end
407
422
  end
408
423
  end
@@ -83,8 +83,11 @@ module Workarea
83
83
 
84
84
 
85
85
  assert(DirectUpload.ensure_cors!('http://test.host/admin/content_assets'))
86
+ assert_equal('true', Workarea.redis.get('cors_http_test_host'))
86
87
  assert(DirectUpload.ensure_cors!('http://localhost:3000/admin/content_assets'))
88
+ assert_equal('true', Workarea.redis.get('cors_http_localhost_3000'))
87
89
  assert(DirectUpload.ensure_cors!('https://example.com/admin/direct_uploads'))
90
+ assert_equal('true', Workarea.redis.get('cors_https_example_com'))
88
91
  end
89
92
 
90
93
  private
@@ -4,7 +4,7 @@ module Workarea
4
4
  class DeactivateStaleDiscountsTest < TestCase
5
5
  def create_category_discount(attributes = {})
6
6
  before_ttl = (Workarea.config.discount_staleness_ttl + 1.day).ago
7
- super(attributes.reverse_merge(created_at: before_ttl))
7
+ super(attributes.reverse_merge(updated_at: before_ttl))
8
8
  end
9
9
 
10
10
  def test_perform
@@ -71,7 +71,7 @@ module Workarea
71
71
  end
72
72
 
73
73
  def test_all_active_discount_ids
74
- too_new = create_category_discount(active: true, created_at: Time.current)
74
+ too_new = create_category_discount(active: true, updated_at: Time.current)
75
75
  active = create_category_discount(active: true)
76
76
 
77
77
  worker = DeactivateStaleDiscounts.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.21
4
+ version: 3.4.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-12 00:00:00.000000000 Z
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler