-
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 all 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 |
---|---|---|
|
@@ -45,25 +45,6 @@ onLoad(() => { | |
}); | ||
}); | ||
|
||
$('input.pin-checkbox').change(function () { | ||
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. Pinned roles are indistinguishable from non-pinned roles. |
||
const $this = $(this); | ||
$this.disabled = true; | ||
$.ajax({ | ||
type: 'put', | ||
data: { | ||
permitted: $this.is(':checked'), | ||
pinned: true, | ||
user_id: $this.data('user-id'), | ||
role: $this.data('role') | ||
}, | ||
dataType: 'json', | ||
url: '/admin/permissions/update', | ||
success() { | ||
$this.disabled = false; | ||
} | ||
}); | ||
}); | ||
|
||
$('input.trust-checkbox').change(function () { | ||
const $this = $(this); | ||
$this.disabled = true; | ||
|
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 | ||
|
@@ -69,14 +64,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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,4 @@ def both_percentage | |
|
||
count.to_f / posts.count | ||
end | ||
|
||
# Attempt to use cached post_count if it's available (included in the dashboard/index query) | ||
def fast_post_count | ||
try(:post_count) || posts.count | ||
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. |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,20 +250,6 @@ def moderator? | |
moderator_sites.any? | ||
end | ||
|
||
def add_pinned_role(name) | ||
role = Role.find_by name: name | ||
if UsersRole.where(user: self, role: role).exists? | ||
UsersRole.where(user: self, role: role).order(:user_id).last.update(pinned: true) | ||
else | ||
UsersRole.create(user: self, role: role, pinned: true) | ||
end | ||
end | ||
|
||
# rubocop:disable Style/PredicateName | ||
def has_pinned_role?(role) | ||
UsersRole.where(user: self, role: Role.find_by(name: role), pinned: true).exists? | ||
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. Indistinguishable |
||
def can_use_regex_search? | ||
(has_role? :reviewer) || moderator_sites.any? | ||
end | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class DropTableDumps < ActiveRecord::Migration[5.2] | ||
def change | ||
execute 'DROP TABLE dumps' | ||
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. Table no longer being used after Rails based full dump being disabled. |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class RemoveAPITokenLegacy < ActiveRecord::Migration[5.2] | ||
def change | ||
remove_column :users, :encrypted_api_token_legacy | ||
remove_column :users, :token_migrated_legacy | ||
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. Legacy column; may introduce security risks. |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class RemovePinnedRole < ActiveRecord::Migration[5.2] | ||
def change | ||
remove_column :users_roles, :pinned | ||
end | ||
end |
This file was deleted.
This file was deleted.
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.