diff --git a/app/models/communication/website/with_publishable_objects.rb b/app/models/communication/website/with_publishable_objects.rb index 98bb2b20e48d359fa461b9d504e38db55a4ce623..78b8d7f2bbdb6789243d21907538db2a9f905d28 100644 --- a/app/models/communication/website/with_publishable_objects.rb +++ b/app/models/communication/website/with_publishable_objects.rb @@ -5,25 +5,10 @@ module Communication::Website::WithPublishableObjects def publish_about_object # TODO: Handle Research::Journal then use the commented version. - # publish_object(about) unless about.nil? - publish_object(about) if about.is_a?(Education::School) + # about.force_publish! unless about.nil? + about.force_publish! if about.is_a?(Education::School) end - def publish_object(object) - # "object" can be an Education::Program, ... - return unless github.valid? - object_model_name = object.class.name.demodulize - if object.respond_to?(:github_path) - github_path = object.github_path - else - root_folder = "_#{object_model_name.pluralize.underscore}" - github_path = "#{root_folder}/#{object.id}.md" - end - github_commit_message = "[#{object_model_name}] Save #{object.to_s}" - github.publish(path: github_path, commit: github_commit_message, data: object.to_jekyll) - end - handle_asynchronously :publish_object, queue: 'default' - def publish_blob(blob) return unless github.valid? blob.analyze unless blob.analyzed? @@ -38,18 +23,6 @@ module Communication::Website::WithPublishableObjects end handle_asynchronously :publish_blob, queue: 'default' - def remove_object(object) - return unless github.valid? - if object.respond_to?(:github_path) - github_path = object.github_path - else - root_folder = "_#{object_model_name.pluralize.underscore}" - github_path = "#{root_folder}/#{object.id}.md" - end - github_commit_message = "[#{object_model_name}] Remove #{object.to_s}" - github.remove(github_path, github_commit_message) - end - def remove_blob(blob) return unless github.valid? github_path = "_data/media/#{blob.id[0..1]}/#{blob.id}.yml" diff --git a/app/models/research/journal/article.rb b/app/models/research/journal/article.rb index 1dd1124fb98ef0265679ccbfe71ad72bd00ca095..4c9e455171626598bb78340c0911d00a3d1e5dc5 100644 --- a/app/models/research/journal/article.rb +++ b/app/models/research/journal/article.rb @@ -63,9 +63,6 @@ class Research::Journal::Article < ApplicationRecord private def update_researchers - return unless websites.any? - researchers.each do |researcher| - websites.each { |website| website.publish_object(researcher) } - end + researchers.each(&:force_publish!) end end