Skip to content
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

Chore: Remove dead code #976

Merged
merged 6 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions app/controllers/static_controller.rb

This file was deleted.

6 changes: 0 additions & 6 deletions app/helpers/stories_helper.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/models/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ def fix_story_accepted_at
project.start_date = accepted_at
end

def cycle_time_in(unit = :days)
raise 'wrong unit' unless %i[days weeks months years].include?(unit)
(cycle_time / 1.send(unit)).round
end

def release_date=(val)
return if val.blank?

Expand Down
10 changes: 0 additions & 10 deletions app/models/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ def not_archived

has_attachment :logo, accept: %i[jpg png gif bmp]

def allowed_domain?(email)
whitelist = (registration_domain_whitelist || '').split(DOMAIN_SEPARATORS_REGEX).map(&:strip)
blacklist = (registration_domain_blacklist || '').split(DOMAIN_SEPARATORS_REGEX).map(&:strip)
has_whitelist = true
has_whitelist = whitelist.any? { |domain| email.include?(domain) } unless whitelist.empty?
has_blacklist = false
has_blacklist = blacklist.any? { |domain| email.include?(domain) } unless blacklist.empty?
has_whitelist && !has_blacklist
end

def to_param
::FriendlyId::Disabler.disabled? ? (id&.to_s) : super
end
Expand Down
4 changes: 0 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def not_archived
reset_password_keys: AUTHENTICATION_KEYS
# unlock_keys: AUTHENTICATION_KEYS

scope :recently_created, lambda { |created_at|
where('users.created_at > ?', created_at) if created_at
}

def password_required?
# Password is required if it is being set, but not for new records
if !persisted?
Expand Down
156 changes: 0 additions & 156 deletions app/views/static/testcard.html.erb

This file was deleted.

3 changes: 0 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
end

if Rails.env.development?
get 'testcard' => 'static#testcard'
mount LetterOpenerWeb::Engine, at: "/letter_opener"
end

Expand All @@ -118,8 +117,6 @@

root 'projects#index'

mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)

namespace :gitlab do
namespace :projects do
resources :events, only: :create
Expand Down
1 change: 0 additions & 1 deletion spec/models/story_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@
subject.started_at = 5.days.ago
subject.update_attribute :state, 'accepted'
expect(subject.accepted_at).to eq(Time.current)
expect(subject.cycle_time_in(:days)).to eq(5)
end
end
end
Expand Down
25 changes: 0 additions & 25 deletions spec/models/team_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,6 @@
it { is_expected.to have_many(:api_tokens) }
it { is_expected.to have_many(:tag_groups) }

context '#allowed_domain' do
it 'is in whitelist' do
subject.registration_domain_whitelist = 'codeminer42.com, uol.com.br'
expect(subject.allowed_domain?('[email protected]')).to be_truthy
expect(subject.allowed_domain?('[email protected]')).to be_truthy
expect(subject.allowed_domain?('[email protected]')).to be_falsey
end

it 'is not in blacklist' do
subject.registration_domain_blacklist = "hotmail.com\ngmail.com\nyahoo.com.br"
expect(subject.allowed_domain?('[email protected]')).to be_truthy
expect(subject.allowed_domain?('[email protected]')).to be_truthy
expect(subject.allowed_domain?('[email protected]')).to be_falsey
end

it 'it is both in the whitelist and not in the blacklist' do
subject.registration_domain_whitelist = 'codeminer42.com, uol.com.br'
subject.registration_domain_blacklist = "hotmail.com\ngmail.com\nyahoo.com.br"
expect(subject.allowed_domain?('[email protected]')).to be_truthy
expect(subject.allowed_domain?('[email protected]')).to be_truthy
expect(subject.allowed_domain?('[email protected]')).to be_falsey
expect(subject.allowed_domain?('[email protected]')).to be_falsey
end
end

describe 'scopes' do
describe '.ordered_by_name' do
let!(:first_team) { create(:team, name: 'Team 2') }
Expand Down
Loading