contentful-scheduler-custom-build-john 1.13 → 1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a3ad6b71a82b2e86208b3742260bfa99c417c8d
|
4
|
+
data.tar.gz: 2fc217e5c6864866986107dbba00ec406ceae2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76c3630273048ffbe92baac8622127c448d363bdf6b6039f9d0ac4cf6311e39f3bbddcd7c3cd93a0dbf9ad1fd34447f3b986b1f69f65caf58ead4dbf01a871b6
|
7
|
+
data.tar.gz: 0b227b979bc3c0522bad48b07778db4b1c1a3673e623bb84beb71fcfe5f9495c9ddcc3697c0d3826ce87a9c689ee21a4e47e98c46278b0f46b575056dfda3405
|
@@ -16,6 +16,7 @@ module Contentful
|
|
16
16
|
def update_or_create(webhook)
|
17
17
|
return unless publishable?(webhook)
|
18
18
|
remove(webhook) if in_queue?(webhook)
|
19
|
+
puts already_published?(webhook)
|
19
20
|
return if already_published?(webhook)
|
20
21
|
|
21
22
|
success = Resque.enqueue_at(
|
@@ -63,8 +64,7 @@ module Contentful
|
|
63
64
|
|
64
65
|
def already_published?(webhook)
|
65
66
|
return true if publish_date(webhook) < Time.now.utc
|
66
|
-
|
67
|
-
if !webhook_is_publish_in_future(webhook)
|
67
|
+
if !webhook.fields[spaces[webhook.space_id][:is_publish_in_future]]
|
68
68
|
return false unless webhook.sys.key?('publishedAt')
|
69
69
|
if !webhook.sys['publishedAt'].nil?
|
70
70
|
return Chronic.parse(webhook.sys['publishedAt']).utc < Time.now.utc
|
@@ -98,14 +98,6 @@ module Contentful
|
|
98
98
|
webhook.fields[spaces[webhook.space_id][:publish_field]]
|
99
99
|
end
|
100
100
|
|
101
|
-
def webhook_is_publish_in_future(webhook)
|
102
|
-
if webhook.fields.key?(spaces.fetch(webhook.space_id, {})[:is_publish_in_future])
|
103
|
-
return webhook.fields[spaces[webhook.space_id][:is_publish_in_future]]
|
104
|
-
else
|
105
|
-
return true
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
101
|
private
|
110
102
|
|
111
103
|
def initialize(logger)
|
@@ -161,6 +161,12 @@ describe Contentful::Scheduler::Queue do
|
|
161
161
|
WebhookDouble.new('bar', 'foo', {'publishedAt' => '2011-04-04T22:00:00+00:00'}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => false})
|
162
162
|
)).to be_truthy
|
163
163
|
end
|
164
|
+
|
165
|
+
it 'false if webhook publish_date is in future and is_publish_in_future is true' do
|
166
|
+
expect(subject.already_published?(
|
167
|
+
WebhookDouble.new('bar', 'foo', {'publishedAt' => '2011-04-04T22:00:00+00:00'}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => true})
|
168
|
+
)).to be_falsey
|
169
|
+
end
|
164
170
|
end
|
165
171
|
|
166
172
|
describe '#publishable?' do
|