app/models/spotlight/exhibit.rb in blacklight-spotlight-0.31.0 vs app/models/spotlight/exhibit.rb in blacklight-spotlight-0.32.0

- old
+ new

@@ -30,10 +30,11 @@ has_many :contacts, dependent: :delete_all # These are the contacts who appear in the sidebar has_many :custom_fields, dependent: :delete_all has_many :feature_pages, extend: FriendlyId::FinderMethods has_many :main_navigations, dependent: :delete_all has_many :owned_taggings, class_name: 'ActsAsTaggableOn::Tagging', as: :tagger + has_many :reindexing_log_entries, dependent: :destroy has_many :resources has_many :roles, as: :resource, dependent: :delete_all has_many :searches, dependent: :destroy, extend: FriendlyId::FinderMethods has_many :solr_document_sidecars, dependent: :delete_all has_many :users, through: :roles, class_name: Spotlight::Engine.config.user_class @@ -77,12 +78,12 @@ filters.each_with_object({}) do |filter, hash| hash.merge! filter.to_hash end end - def reindex_later - Spotlight::ReindexJob.perform_later(self) + def reindex_later(user = nil) + Spotlight::ReindexJob.perform_later(self, new_reindexing_log_entry(user)) end def uploaded_resource_fields Spotlight::Engine.config.upload_fields end @@ -98,15 +99,19 @@ def requested_by roles.first.user if roles.first end def reindex_progress - @reindex_progress ||= ReindexProgress.new(resources) if resources + @reindex_progress ||= ReindexProgress.new(self) end protected def sanitize_description self.description = ::Rails::Html::FullSanitizer.new.sanitize(description) + end + + def new_reindexing_log_entry(user = nil) + Spotlight::ReindexingLogEntry.create(exhibit: self, user: user, items_reindexed_count: 0, job_status: 'unstarted') end end end