From bb765f55d5ad89e1f87821147e7fac7b2fdc21ea Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 23 Jun 2020 23:37:56 -0500 Subject: [PATCH] Eliminate misc dead code. --- app/logical/current_user.rb | 9 --------- app/logical/tag_relationship_retirement_service.rb | 8 -------- app/models/moderation_report.rb | 2 +- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/app/logical/current_user.rb b/app/logical/current_user.rb index 292bf4a72..4c8d80349 100644 --- a/app/logical/current_user.rb +++ b/app/logical/current_user.rb @@ -24,15 +24,6 @@ class CurrentUser scoped(user, &block) end - def self.as_system(&block) - if block_given? - scoped(::User.system, "127.0.0.1", &block) - else - self.user = User.system - self.ip_addr = "127.0.0.1" - end - end - def self.user RequestStore[:current_user] end diff --git a/app/logical/tag_relationship_retirement_service.rb b/app/logical/tag_relationship_retirement_service.rb index 0f11ee931..0aa79cc6b 100644 --- a/app/logical/tag_relationship_retirement_service.rb +++ b/app/logical/tag_relationship_retirement_service.rb @@ -11,14 +11,6 @@ module TagRelationshipRetirementService "This topic deals with tag relationships created two or more years ago that have not been used since. They will be retired. This topic will be updated as an automated system retires expired relationships." end - def dry_run - [TagAlias, TagImplication].each do |model| - each_candidate(model) do |rel| - puts "#{rel.relationship} #{rel.antecedent_name} -> #{rel.consequent_name} retired" - end - end - end - def forum_topic topic = ForumTopic.where(title: forum_topic_title).first if topic.nil? diff --git a/app/models/moderation_report.rb b/app/models/moderation_report.rb index 17083458b..b45a6d86c 100644 --- a/app/models/moderation_report.rb +++ b/app/models/moderation_report.rb @@ -34,7 +34,7 @@ class ModerationReport < ApplicationRecord def forum_topic topic = ForumTopic.find_by_title(forum_topic_title) if topic.nil? - CurrentUser.as_system do + CurrentUser.scoped(User.system) do topic = ForumTopic.create!(creator: User.system, title: forum_topic_title, category_id: 0, min_level: User::Levels::MODERATOR) forum_post = ForumPost.create!(creator: User.system, body: forum_topic_body, topic: topic) end