contentful-scheduler-custom-build-john 1.12 → 1.13
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: cd7879dca084282d83eb0b2b68d51595ee2bb490
|
4
|
+
data.tar.gz: 70b18738b7c0299117476a673db14b5111b0662c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de387823a3772352a2eeaa82291699ebba8163a7b96445abfed4f0389af8e84a38ce4b418bc1f06c02aa26984c3988e59c2dc34364b6587c229a358f934fbdfb
|
7
|
+
data.tar.gz: 91bb034e50171ffadc658ed5c21dafc56a3932cfb8285e842402c9b32495de49b280ee01df799fdfbae0f12a146574e5ca6113a905ccf066971ee23e14f47989
|
@@ -63,7 +63,8 @@ module Contentful
|
|
63
63
|
|
64
64
|
def already_published?(webhook)
|
65
65
|
return true if publish_date(webhook) < Time.now.utc
|
66
|
-
|
66
|
+
puts !webhook_is_publish_in_future(webhook)
|
67
|
+
if !webhook_is_publish_in_future(webhook)
|
67
68
|
return false unless webhook.sys.key?('publishedAt')
|
68
69
|
if !webhook.sys['publishedAt'].nil?
|
69
70
|
return Chronic.parse(webhook.sys['publishedAt']).utc < Time.now.utc
|
@@ -98,7 +99,11 @@ module Contentful
|
|
98
99
|
end
|
99
100
|
|
100
101
|
def webhook_is_publish_in_future(webhook)
|
101
|
-
webhook.fields
|
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
|
102
107
|
end
|
103
108
|
|
104
109
|
private
|
@@ -132,10 +132,10 @@ describe Contentful::Scheduler::Queue do
|
|
132
132
|
)).to be_falsey
|
133
133
|
end
|
134
134
|
|
135
|
-
it '
|
135
|
+
it 'false if sys.publishedAt is in past and is_publish_in_future is true' do
|
136
136
|
expect(subject.already_published?(
|
137
137
|
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})
|
138
|
-
)).to
|
138
|
+
)).to be_falsey
|
139
139
|
end
|
140
140
|
|
141
141
|
it 'false if sys.publishedAt is not present and is_publish_in_future is false' do
|
@@ -149,6 +149,18 @@ describe Contentful::Scheduler::Queue do
|
|
149
149
|
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00', 'is_publish_in_future' => true})
|
150
150
|
)).to be_truthy
|
151
151
|
end
|
152
|
+
|
153
|
+
it 'false if webhook publish_date is in future and is_publish_in_future is false' do
|
154
|
+
expect(subject.already_published?(
|
155
|
+
WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00', 'is_publish_in_future' => false})
|
156
|
+
)).to be_falsey
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'true if webhook publish_date is in future and is_publish_in_future is false' do
|
160
|
+
expect(subject.already_published?(
|
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
|
+
)).to be_truthy
|
163
|
+
end
|
152
164
|
end
|
153
165
|
|
154
166
|
describe '#publishable?' do
|