-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dead code #806
base: master
Are you sure you want to change the base?
Remove dead code #806
Changes from 8 commits
87c6da7
455ca8d
610f4fd
63b24cb
dddd14a
7998d3d
f7c3960
6275377
7f42342
9ee05dd
e0fbd0d
fbe154e
060efe2
37636be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class DumpsController < ApplicationController | ||
before_action :set_dump, only: %i[show edit update destroy] | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The four methods in only clause does not exist. |
||
# GET /dumps | ||
# GET /dumps.json | ||
def index | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class SmokeDetectorsController < ApplicationController | ||
before_action :authenticate_user!, except: %i[audits check_token] | ||
before_action :verify_admin, except: %i[audits force_failover force_pull mine token_regen new create check_token] | ||
before_action :authenticate_user!, except: :audits | ||
before_action :verify_admin, except: %i[audits force_failover force_pull mine token_regen new create] | ||
before_action :verify_blacklist_manager, only: %i[force_failover force_pull] | ||
before_action :verify_smoke_detector_runner, only: %i[mine token_regen new create] | ||
before_action :set_smoke_detector, except: %i[audits mine new create check_token] | ||
before_action :set_smoke_detector, except: %i[audits mine new create] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think Helios is still active but this may need to be reverted. |
||
|
||
def destroy | ||
unless current_user.present? && (current_user.has_role?(:admin) || current_user.id == @smoke_detector.user_id) | ||
|
@@ -83,20 +83,6 @@ def token_regen | |
redirect_to params[:redirect] || smoke_detector_mine_path | ||
end | ||
|
||
# Used by Helios to verify new tokens | ||
def check_token | ||
token = SmokeDetector.where(access_token: params[:token]).first | ||
payload = { | ||
exists: token.present?, | ||
owner_name: token&.user&.username, | ||
location: token&.location, | ||
created_at: token&.created_at, | ||
updated_at: token&.updated_at | ||
} | ||
|
||
render json: payload | ||
end | ||
Comment on lines
-87
to
-98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forget when this was introduced, but I think we will want to keep this unless helios is official dead. |
||
|
||
private | ||
|
||
def set_smoke_detector | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,6 @@ | |
class ApplicationRecord < ActiveRecord::Base | ||
self.abstract_class = true | ||
|
||
def self.fuzzy_search(term, **cols) | ||
sanitized = sanitize_for_search term, **cols | ||
select(Arel.sql("`#{table_name}`.*, #{sanitized} AS search_score")) | ||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is never used. |
||
def self.match_search(term, with_search_score: true, **cols) | ||
sanitized = sanitize_for_search term, **cols | ||
if with_search_score | ||
|
@@ -37,15 +32,6 @@ def self.sanitize_for_search(term, **cols) | |
ActiveRecord::Base.send(:sanitize_sql_array, ["MATCH (#{cols}) AGAINST (? IN BOOLEAN MODE)", term]) | ||
end | ||
|
||
# From http://stackoverflow.com/questions/6591722/how-to-generate-fixtures-based-on-my-development-database | ||
def dump_fixture | ||
fixture_file = "#{Rails.root}/test/fixtures/#{self.class.table_name}.yml" | ||
File.open(fixture_file, 'a') do |f| | ||
f.puts({ "#{self.class.table_name.singularize}_#{id}" => attributes } | ||
.to_yaml.sub!(/---\s?/, "\n")) | ||
end | ||
end | ||
|
||
user12986714 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def self.sanitize_like(unsafe, *args) | ||
sanitize_sql_like unsafe, *args | ||
end | ||
|
@@ -69,14 +55,4 @@ def self.mass_habtm(join_table, first_type, second_type, record_pairs) | |
def self.fields(*names) | ||
names.map { |n| "#{table_name}.#{n}" } | ||
end | ||
|
||
def self.full_dump | ||
username = Rails.configuration.database_configuration[Rails.env]['username'] | ||
password = Rails.configuration.database_configuration[Rails.env]['password'] | ||
host = Rails.configuration.database_configuration[Rails.env]['host'] | ||
`#{Rails.root}/dump/dump.sh "#{username}" "#{password}" "#{host}"` | ||
|
||
Dump.destroy_all | ||
Dump.create file: File.open(Dir.glob('dumps/*')[0]) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bugged and no longer used. |
||
end |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class DropTableDumps < ActiveRecord::Migration[5.2] | ||
execute 'DROP TABLE dumps' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class RemoveAPITokenLegacy < ActiveRecord::Migration[5.2] | ||
remove_column :users, :encrypted_api_token_legacy | ||
remove_column :users, :token_migrated_legacy | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method has been deleted long before.