Skip to content

Commit

Permalink
get doi in delete activities. #213
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Mar 10, 2019
1 parent 86fe991 commit 690d598
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 },
Expand Down Expand Up @@ -234,4 +233,8 @@ def self.index_by_id(options={})

count
end

def uid
doi.present? ? doi.uid : changes.to_h['doi']
end
end

0 comments on commit 690d598

Please sign in to comment.