about summary refs log tree commit diff
path: root/app/helpers/jsonld_helper.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-22 21:35:07 +0200
committerGitHub <noreply@github.com>2018-08-22 21:35:07 +0200
commit8aa58e34bb2b62192a997ac7ea8919b22fc45f80 (patch)
treeabc0ea9862c55c2e114c855b20eb4a35f1141709 /app/helpers/jsonld_helper.rb
parent628fca50e20bcf41f206877083fc5ee8789c1088 (diff)
parente70fc059a9511d43b42c2502514f6220b416cdd5 (diff)
Merge pull request #665 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/helpers/jsonld_helper.rb')
-rw-r--r--app/helpers/jsonld_helper.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/helpers/jsonld_helper.rb b/app/helpers/jsonld_helper.rb
index 9d2b6cf00..532397272 100644
--- a/app/helpers/jsonld_helper.rb
+++ b/app/helpers/jsonld_helper.rb
@@ -73,8 +73,10 @@ module JsonLdHelper
     end
   end
 
-  def body_to_json(body)
-    body.is_a?(String) ? Oj.load(body, mode: :strict) : body
+  def body_to_json(body, compare_id: nil)
+    json = body.is_a?(String) ? Oj.load(body, mode: :strict) : body
+    return if compare_id.present? && json['id'] != compare_id
+    json
   rescue Oj::ParseError
     nil
   end