calmlens 0.31.0 → 0.31.1
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/calmlens/testing/fake_api.rb +17 -4
- data/lib/calmlens/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb92c3f2338dd93756f4b08b425f6234d31a1f77c0000c938814d671474170ff
|
|
4
|
+
data.tar.gz: 4c57d18c2fa05e27b81171760e3878c0cd3476e0756d7aee5efcd29462aa6f65
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0864ec596bc1f6bef85fe947a7235db81bb728561975de69b662f163e7cffb22a101381bc04a7a268934203b2ff53e5a4d5958521a02c2e12cb0a6ceaaef023
|
|
7
|
+
data.tar.gz: be5a3d9d4237cd912d2adbae2210b8a2f2e394da7eefeabeca786d516f7e48d8487ec3763da79c7da0038fb61f9cf62351c655f65f71a81eb4d7bfca80fe8373
|
|
@@ -296,9 +296,9 @@ module CalmLens
|
|
|
296
296
|
# the API key as its events' actor; the test hook's is a reviewer's (a `user`).
|
|
297
297
|
def record_decision(item, decision, note, by_api_key)
|
|
298
298
|
apply_outcome(item, decision, 'requested')
|
|
299
|
-
# Like the API: the human review queue's decision settles its review,
|
|
300
|
-
#
|
|
301
|
-
item['classification']['moderation']['pendingReview'] = nil
|
|
299
|
+
# Like the API: the human review queue's decision settles its review, and so does the app's own
|
|
300
|
+
# decision through the API.
|
|
301
|
+
item['classification']['moderation']['pendingReview'] = nil
|
|
302
302
|
review = { 'id' => @create_id.call('rev'), 'decision' => decision, 'note' => note,
|
|
303
303
|
'decidedBy' => deep_copy(API_KEY_ACTOR), 'reviewedAt' => @now.call, 'applied' => true }
|
|
304
304
|
actor = by_api_key ? API_KEY_ACTOR : REVIEWER_ACTOR
|
|
@@ -328,7 +328,13 @@ module CalmLens
|
|
|
328
328
|
fail!(ErrorCodes::ASSET_PROCESSING) if processing
|
|
329
329
|
status = item['classification']['moderation']['decision']
|
|
330
330
|
fail!(ErrorCodes::ASSET_DECISION_NOT_ALLOWED) if status.nil? && !%w[blocked purged].include?(decision)
|
|
331
|
-
|
|
331
|
+
if status == decision
|
|
332
|
+
# Like the API: agreeing with the decision a queued review waits on settles the review,
|
|
333
|
+
# leaving the decision as it is.
|
|
334
|
+
fail!(ErrorCodes::ASSET_DECISION_UNCHANGED) if item['classification']['moderation']['pendingReview'].nil?
|
|
335
|
+
item['classification']['moderation']['pendingReview'] = nil
|
|
336
|
+
return item
|
|
337
|
+
end
|
|
332
338
|
fail!(ErrorCodes::ASSET_CONTENT_PURGED) if status == 'purged' && decision != 'blocked'
|
|
333
339
|
|
|
334
340
|
record_decision(item, decision, note, true)
|
|
@@ -1258,6 +1264,13 @@ module CalmLens
|
|
|
1258
1264
|
# the most recent ones, newest first, while CONTEXT_USED_ITEMS posts and
|
|
1259
1265
|
# CONTEXT_USED_CHARACTERS characters allow, returned oldest first. The newest is always kept.
|
|
1260
1266
|
def select_context(items)
|
|
1267
|
+
# Like the API's schema, a reference that isn't an asset ID is refused before any lookup.
|
|
1268
|
+
Array(items).each_with_index do |item, index|
|
|
1269
|
+
asset_id = item.is_a?(Hash) ? item['assetId'] : nil
|
|
1270
|
+
next if asset_id.is_a?(String) && asset_id.match?(ASSET_ID_PATTERN)
|
|
1271
|
+
|
|
1272
|
+
invalid!('validation/invalid-format', "context.items.#{index}.assetId")
|
|
1273
|
+
end
|
|
1261
1274
|
posts = Array(items).map do |item|
|
|
1262
1275
|
asset_id = item.is_a?(Hash) ? item['assetId'] : nil
|
|
1263
1276
|
asset = asset_id.is_a?(String) ? @state.assets[asset_id] : nil
|
data/lib/calmlens/version.rb
CHANGED