infopark_reactor 1.19.0 → 1.20.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4565152e9620ee1549db9c630f29fc09963aca7c
|
4
|
+
data.tar.gz: 2f73a2ba9c91bf01bb6e976c5dc3f7c95ae69131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea47b54ec12a7c0d158194e00af28291028d63a9873fb88b66cf881891ed1f55ea3ab26709aa7741f45eeaf79bf6aa16b255170a0b5e9ad39fc04e80639aff04
|
7
|
+
data.tar.gz: 666ca185f3ff1ecbbc9fc489c37c88e2cfa7be23c48e2fa4da3aa9de8408635f7641dad6fb308bc6d2c2e521a328cadf93766abc55310afb06d3237c05abed37
|
data/lib/reactor/attributes.rb
CHANGED
@@ -197,6 +197,14 @@ module Reactor
|
|
197
197
|
set(:body, value)
|
198
198
|
end
|
199
199
|
|
200
|
+
def blob
|
201
|
+
if attr_dict.respond_to?(:blob)
|
202
|
+
attr_dict.send :blob
|
203
|
+
else
|
204
|
+
nil
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
200
208
|
def blob=(value)
|
201
209
|
set(:blob, value)
|
202
210
|
end
|
@@ -230,9 +238,14 @@ module Reactor
|
|
230
238
|
not_formated_value = value
|
231
239
|
formated_value = serialize_value(key, value)
|
232
240
|
crul_set(attr, formated_value, options)
|
241
|
+
|
242
|
+
__send__(:attribute_will_change!, key)
|
243
|
+
|
233
244
|
active_record_set(key, formated_value) if active_record_attr?(key)
|
234
245
|
rails_connector_set(key, formated_value)
|
235
|
-
|
246
|
+
|
247
|
+
# return new value
|
248
|
+
__send__(key)
|
236
249
|
end
|
237
250
|
|
238
251
|
|
@@ -346,6 +359,7 @@ module Reactor
|
|
346
359
|
if Reactor.rails4_2?
|
347
360
|
@attributes.write_from_user(field.to_s, value)
|
348
361
|
else
|
362
|
+
@attributes_cache.delete(field.to_s)
|
349
363
|
@attributes[field.to_s] = value
|
350
364
|
end
|
351
365
|
end
|
@@ -14,7 +14,7 @@ module Reactor
|
|
14
14
|
|
15
15
|
private
|
16
16
|
def serialize_html
|
17
|
-
link_expressions = [/(href|src)\s*=\s*"([^"]*)"/, /(href|src)\s*=\s*'([^']*)'/]
|
17
|
+
link_expressions = [/(href|src|usemap)\s*=\s*"([^"]*)"/, /(href|src|usemap)\s*=\s*'([^']*)'/]
|
18
18
|
link_expressions.each do |expr|
|
19
19
|
@value.gsub!(expr) do |string|
|
20
20
|
link = Reactor::Support::LinkMatcher.new($2)
|
@@ -16,6 +16,10 @@ module Reactor
|
|
16
16
|
super(transform_into_link(link_data))
|
17
17
|
end
|
18
18
|
|
19
|
+
def []=(idx, value)
|
20
|
+
super(idx, transform_into_link(value))
|
21
|
+
end
|
22
|
+
|
19
23
|
# install #size_changed callback
|
20
24
|
Array.instance_methods(false).each do |meth|
|
21
25
|
old = instance_method(meth)
|
data/lib/reactor/cm/obj.rb
CHANGED
@@ -142,15 +142,42 @@ module Reactor
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
def
|
145
|
+
def set_multiple(attrs)
|
146
146
|
attrs.each {|a,(v,o)| set(a,v,o||{}) }
|
147
147
|
end
|
148
148
|
|
149
149
|
def composite_save(attrs, links_to_add, links_to_remove, links_to_set, links_modified=false)
|
150
|
-
|
150
|
+
set_multiple(attrs)
|
151
151
|
|
152
152
|
skip_version_creation = @attrs.empty? && links_to_remove.empty? && links_to_set.empty? && !links_modified
|
153
153
|
|
154
|
+
# The save procedure consists of following steps:
|
155
|
+
# First request (assign attributes):
|
156
|
+
# a. Execute take to assign the edited content to the current user
|
157
|
+
# b. Execute edit to create an edited content if there is none present
|
158
|
+
# c. Set object attributes (name, permalink, etc.)
|
159
|
+
# d. Set content attributes (title, body etc. + custom attributes)
|
160
|
+
# e. Resolve all links in *html* attributes
|
161
|
+
# Second request (overwrite linklists):
|
162
|
+
# f. Remove superflous links
|
163
|
+
# g. Overwrite existing links
|
164
|
+
# h. Add missing links
|
165
|
+
#
|
166
|
+
# Second request is optional and only happens if linklists
|
167
|
+
# have been changed.
|
168
|
+
#
|
169
|
+
# Steps a,b,d,e,f,g,h are optional and are skipped if only
|
170
|
+
# object attributes have been supplied.
|
171
|
+
#
|
172
|
+
# It can happen that the second request is received by
|
173
|
+
# a different CM slave than the first request. If additionaly
|
174
|
+
# the slave has invalid cache (for example when the cache
|
175
|
+
# invalidate command has not yet been fully propagated among
|
176
|
+
# slaves), then race condition can occur.
|
177
|
+
# It is therefore extremely important for the second request
|
178
|
+
# to be resistant against invalid cache, otherwise then
|
179
|
+
# save operation aborts.
|
180
|
+
|
154
181
|
resp = MultiXmlRequest.execute do |reqs|
|
155
182
|
reqs.optional {|xml| SimpleCommandRequest.build(xml, @obj_id, 'take') } unless skip_version_creation
|
156
183
|
reqs.optional {|xml| SimpleCommandRequest.build(xml, @obj_id, 'edit') } unless skip_version_creation
|
@@ -158,6 +185,7 @@ module Reactor
|
|
158
185
|
|
159
186
|
reqs.mandatory {|xml| ObjSetRequest.build(xml, @obj_id, @obj_attrs) } unless @obj_attrs.empty? #important! requires different permissions
|
160
187
|
reqs.mandatory {|xml| ContentSetRequest.build(xml, @obj_id, @attrs, @attr_options) } unless skip_version_creation
|
188
|
+
reqs.mandatory {|xml| ResolveRefsRequest.build(xml, @obj_id) } unless skip_version_creation
|
161
189
|
end
|
162
190
|
|
163
191
|
resp.assert_success
|
@@ -165,20 +193,21 @@ module Reactor
|
|
165
193
|
yield(attrs, links_to_add, links_to_remove, links_to_set) if block_given?
|
166
194
|
|
167
195
|
resp = MultiXmlRequest.execute do |reqs|
|
196
|
+
reqs.optional {|xml| SimpleCommandRequest.build(xml, @obj_id, 'take') }
|
197
|
+
reqs.optional {|xml| SimpleCommandRequest.build(xml, @obj_id, 'edit') }
|
198
|
+
|
168
199
|
links_to_remove.each do |link_id|
|
169
200
|
reqs.mandatory {|xml| LinkDeleteRequest.build(xml, link_id) }
|
170
201
|
end
|
171
|
-
links_to_add.each do |(attr, link)|
|
172
|
-
|
173
|
-
reqs.mandatory {|xml| LinkAddRequest.build(xml, @obj_id, attr, link) }
|
174
|
-
end
|
175
202
|
|
176
203
|
links_to_set.each do |(link_id, link)|
|
177
204
|
reqs.mandatory {|xml| LinkSetRequest.build(xml, link_id, link) }
|
178
205
|
end
|
179
206
|
|
180
|
-
|
181
|
-
|
207
|
+
links_to_add.each do |(attr, link)|
|
208
|
+
reqs.mandatory {|xml| LinkAddRequest.build(xml, @obj_id, attr, link) }
|
209
|
+
end
|
210
|
+
end unless skip_version_creation || (links_to_remove.empty? && links_to_add.empty? && links_to_set.empty?)
|
182
211
|
|
183
212
|
resp.assert_success
|
184
213
|
end
|
data/lib/reactor/persistence.rb
CHANGED
@@ -288,7 +288,12 @@ module Reactor
|
|
288
288
|
end
|
289
289
|
|
290
290
|
def sanitize_name
|
291
|
-
|
291
|
+
return unless self.name.present?
|
292
|
+
|
293
|
+
sanitized_name = self.class.send(:sanitize_name, self.name)
|
294
|
+
if sanitized_name != self.name
|
295
|
+
self.name = sanitized_name
|
296
|
+
end
|
292
297
|
end
|
293
298
|
|
294
299
|
def crul_attributes_set?
|
data/lib/reactor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_reactor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Przedmojski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|