From 940b4734300ed50757c08c992b68bee9b815b347 Mon Sep 17 00:00:00 2001 From: jambun Date: Thu, 19 Jul 2018 11:45:34 +1000 Subject: [PATCH] Apply the note filter to Resource.publish! --- backend/plugin_init.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/plugin_init.rb b/backend/plugin_init.rb index 9cd1911..5976121 100644 --- a/backend/plugin_init.rb +++ b/backend/plugin_init.rb @@ -2,3 +2,15 @@ ChildPublishing.add_filter(Note.exclude{Sequel.like(:notes, '%"type":"otherfindaid"%') & Sequel.like(:notes, '%"content":"https://preservica.library.yale.edu%')}) ArchivalObject.include(ChildPublisher) + +Resource.class_eval do + def publish!(setting = true) + object_graph = self.object_graph(ChildPublishing.filters) + + object_graph.each do |model, ids| + next unless model.publishable? + + model.handle_publish_flag(ids, setting) + end + end +end