From 690d5985c74e0b964261d2d41a8d4af448a55bb5 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 10 Mar 2019 17:54:18 +0100 Subject: [PATCH] get doi in delete activities. #213 --- app/models/activity.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/activity.rb b/app/models/activity.rb index 0511e6aef..632db7da4 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -4,8 +4,6 @@ class Activity < Audited::Audit # include helper module for Elasticsearch include Indexable - delegate :uid, to: :doi - alias_attribute :created, :created_at alias_attribute :doi_id, :uid alias_attribute :changes, :audited_changes @@ -30,6 +28,7 @@ def after_audit indexes :version, type: :keyword indexes :request_uuid, type: :keyword indexes :changes, type: :object, properties: { + doi: { type: :keyword }, url: { type: :text, fields: { keyword: { type: "keyword" }}}, creators: { type: :object, properties: { nameType: { type: :keyword }, @@ -234,4 +233,8 @@ def self.index_by_id(options={}) count end + + def uid + doi.present? ? doi.uid : changes.to_h['doi'] + end end \ No newline at end of file