contentful-scheduler-custom 1.5.3 → 1.5.4
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 +4 -4
- data/lib/contentful/scheduler/queue.rb +12 -3
- data/lib/contentful/scheduler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa465a2deabf1a667623e3d5c53819691426f8fb
|
4
|
+
data.tar.gz: b5c0b957db793cbd0d63b17f631db350441ae787
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61fbec12553f55075e76bb56cc3504d2da2101074d8425b7ef8767052ab0ebaed0153f89f4d3c4288a958fbc1099521e78004f23deb4fe50cd704b621b1bb7d1
|
7
|
+
data.tar.gz: 6276006917017c3fbbcc0453d1e53da6934d1283a9f7a55077ab6a404a0b08122f4a5709c296b23bbb0bcd19af292243ff54a7f39f54ec77da7bd007cee805da
|
@@ -17,14 +17,15 @@ module Contentful
|
|
17
17
|
if publishable?(webhook)
|
18
18
|
success = update_or_create_for_publish(webhook)
|
19
19
|
log_event_success(webhook, success, 'publish', 'added to')
|
20
|
+
updateContentBlocks(webhook, 'publish')
|
20
21
|
end
|
21
22
|
|
22
23
|
if unpublishable?(webhook)
|
23
24
|
success = update_or_create_for_unpublish(webhook)
|
24
25
|
log_event_success(webhook, success, 'unpublish', 'added to')
|
26
|
+
updateContentBlocks(webhook, 'unpublish')
|
25
27
|
end
|
26
28
|
|
27
|
-
updateContentBlocks(webhook)
|
28
29
|
end
|
29
30
|
|
30
31
|
def update_or_create_for_publish(webhook)
|
@@ -74,12 +75,12 @@ module Contentful
|
|
74
75
|
log_event_success(webhook, success, 'publish', 'removed from')
|
75
76
|
end
|
76
77
|
|
77
|
-
def updateContentBlocks(webhook)
|
78
|
+
def updateContentBlocks(webhook, type)
|
78
79
|
if isContentBlockAvailable(webhook)
|
79
80
|
webhook.fields['contentBlocks']['fi-FI'].each do |sys|
|
80
81
|
success = Resque.enqueue_at(
|
81
82
|
publish_date(webhook),
|
82
|
-
|
83
|
+
getScheduleType(type),
|
83
84
|
webhook.space_id,
|
84
85
|
sys['sys']['id'],
|
85
86
|
::Contentful::Scheduler.config[:spaces][webhook.space_id][:management_token]
|
@@ -93,6 +94,14 @@ module Contentful
|
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
97
|
+
def getScheduleType(type)
|
98
|
+
if type == 'unpublish'
|
99
|
+
return ::Contentful::Scheduler::Tasks::Unpublish
|
100
|
+
else
|
101
|
+
return ::Contentful::Scheduler::Tasks::Publish
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
96
105
|
def removeContentBlocks(webhook)
|
97
106
|
if isContentBlockAvailable(webhook)
|
98
107
|
webhook.fields['contentBlocks']['fi-FI'].each do |sys|
|