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

Remove Adoptions #5356

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 0 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Rails/I18nLocaleTexts:
Exclude:
- 'app/mailers/mailer.rb'
- 'app/mailers/owners_mailer.rb'
- 'app/models/ownership_call.rb'
- 'app/models/user.rb'

# Offense count: 5
Expand All @@ -107,8 +106,6 @@ Rails/RedundantPresenceValidationOnBelongsTo:
Exclude:
- 'app/models/api_key_rubygem_scope.rb'
- 'app/models/deletion.rb'
- 'app/models/ownership_call.rb'
- 'app/models/ownership_request.rb'
- 'app/models/subscription.rb'
- 'app/models/version.rb'

Expand Down
36 changes: 0 additions & 36 deletions app/assets/stylesheets/modules/shared.css
Original file line number Diff line number Diff line change
Expand Up @@ -222,46 +222,10 @@ span.github-btn {
font-weight: 800;
}

.adoption__tag {
display: inline-block;
font-size: 0.8em;
font-weight: 800;
color: #e9573f;
border: 1px solid #e9573f;
border-radius: 8px;
padding: 0.25em 1em;
margin-bottom: 0.9em;
vertical-align: 0.3em;
transition: color 0.25s ease-in,
background-color 0.25s ease-in,
transform 0.3s ease-out;
}

.adoption__tag:hover{
color: white;
background-color: #e9573f;
}

.adoption__heading {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not being removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s used elsewhere. Probably it should be renamed.

color: #e9573f;
}

.t-body h2.adoption__heading--no-padding {
padding-top: 0px;
}

.adoption__blog__link {
color: #e9573f;
text-decoration: underline;
font-size: 0.6em;
font-weight: bold;
}

.adoption__rdoc__link {
text-decoration: underline;
font-weight: bold;
}

.tooltip__text {
color: #e9573f;
vertical-align: text-bottom;
Expand Down
1 change: 0 additions & 1 deletion app/avo/resources/ownership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def fields

field :push_notifier, as: :boolean
field :owner_notifier, as: :boolean
field :ownership_request_notifier, as: :boolean

field :authorization, as: :heading

Expand Down
2 changes: 0 additions & 2 deletions app/avo/resources/rubygem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def fields

field :ownerships, as: :has_many
field :ownerships_including_unconfirmed, as: :has_many
field :ownership_calls, as: :has_many
field :ownership_requests, as: :has_many
field :organization, as: :belongs_to

field :subscriptions, as: :has_many
Expand Down
2 changes: 0 additions & 2 deletions app/avo/resources/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ def fields # rubocop:disable Metrics
field :web_hooks, as: :has_many
field :unconfirmed_ownerships, as: :has_many
field :api_keys, as: :has_many, name: "API Keys"
field :ownership_calls, as: :has_many
field :ownership_requests, as: :has_many
field :pushed_versions, as: :has_many
field :oidc_api_key_roles, as: :has_many
field :webauthn_credentials, as: :has_many
Expand Down
19 changes: 0 additions & 19 deletions app/controllers/adoptions_controller.rb

This file was deleted.

4 changes: 1 addition & 3 deletions app/controllers/notifiers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ def show
def update
to_enable_push, to_disable_push = notifier_options("push")
to_enable_owner, to_disable_owner = notifier_options("owner")
to_enable_ownership_request, to_disable_ownership_request = notifier_options("ownership_request")

current_user.transaction do
current_user.ownerships.update_push_notifier(to_enable_push, to_disable_push)
current_user.ownerships.update_owner_notifier(to_enable_owner, to_disable_owner)
current_user.ownerships.update_ownership_request_notifier(to_enable_ownership_request, to_disable_ownership_request)
Mailer.notifiers_changed(current_user.id).deliver_later
end

Expand All @@ -25,7 +23,7 @@ def update
private

def notifier_params
params.expect(ownerships: [%i[push owner ownership_request]])
params.expect(ownerships: [%i[push owner]])
end

def notifier_options(param)
Expand Down
46 changes: 0 additions & 46 deletions app/controllers/ownership_calls_controller.rb

This file was deleted.

56 changes: 0 additions & 56 deletions app/controllers/ownership_requests_controller.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ def destroy
redirect_to root_path, notice: t(".request_queued")
end

def adoptions
@ownership_calls = current_user.ownership_calls.includes(:user, rubygem: %i[latest_version gem_download])
@ownership_requests = current_user.ownership_requests.includes(:rubygem)
end

def security_events
@security_events = current_user.events.order(id: :desc).page(params[:page]).per(50)
render Profiles::SecurityEventsView.new(security_events: @security_events)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/rubygems_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def index

def show
@versions = @rubygem.public_versions.limit(5)
@adoption = @rubygem.ownership_call
if @versions.to_a.any?
render "show"
else
Expand Down
1 change: 0 additions & 1 deletion app/controllers/versions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def show
@latest_version = @rubygem.find_version_by_slug!(params[:id])
@versions = @rubygem.public_versions_with_extra_version(@latest_version)
@versioned_links = @rubygem.links(@latest_version)
@adoption = @rubygem.ownership_call
@on_version_page = true
render "rubygems/show"
end
Expand Down
5 changes: 0 additions & 5 deletions app/helpers/rubygems_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ def resend_owner_confirmation_link(rubygem)
resend_confirmation_rubygem_owners_path(rubygem.slug), class: "gem__link t-list__item"
end

def rubygem_adoptions_link(rubygem)
link_to "Adoption",
rubygem_adoptions_path(rubygem.slug), class: "gem__link t-list__item"
end

def rubygem_security_events_link(rubygem)
link_to "Security Events",
security_events_rubygem_path(rubygem.slug), class: "gem__link t-list__item"
Expand Down
24 changes: 0 additions & 24 deletions app/mailers/owners_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,4 @@ def owner_added(user_id, owner_id, authorizer_id, gem_id)
mail to: @user.email,
subject: t("mailer.owner_added.subject_#{owner_i18n_key(@owner, @user)}", gem: @rubygem.name, owner_handle: @owner.display_handle)
end

def new_ownership_requests(rubygem_id, user_id)
@user = User.find(user_id)
@rubygem = Rubygem.find(rubygem_id)
@ownership_requests_count = @rubygem.ownership_requests.opened.count
mail to: @user.email,
subject: "New ownership request(s) for #{@rubygem.name}"
end

def ownership_request_approved(ownership_request_id)
@ownership_request = OwnershipRequest.find(ownership_request_id)
@rubygem = @ownership_request.rubygem
@user = @ownership_request.user
mail to: @user.email,
subject: "Your ownership request was approved."
end

def ownership_request_closed(ownership_request_id)
@ownership_request = OwnershipRequest.find(ownership_request_id)
@rubygem = @ownership_request.rubygem
@user = @ownership_request.user
mail to: @user.email,
subject: "Your ownership request was closed."
end
end
6 changes: 2 additions & 4 deletions app/models/ownership.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Ownership < ApplicationRecord
self.ignored_columns += %w[ownership_request_notifier]

belongs_to :rubygem
belongs_to :user
belongs_to :authorizer, class_name: "User"
Expand Down Expand Up @@ -53,10 +55,6 @@ def self.update_owner_notifier(to_enable_owner, to_disable_owner)
update_notifier(to_enable_owner, to_disable_owner, "owner_notifier")
end

def self.update_ownership_request_notifier(to_enable_ownership_request, to_disable_ownership_request)
update_notifier(to_enable_ownership_request, to_disable_ownership_request, "ownership_request_notifier")
end

def valid_confirmation_token?
token_expires_at > Time.zone.now
end
Expand Down
19 changes: 0 additions & 19 deletions app/models/ownership_call.rb

This file was deleted.

43 changes: 0 additions & 43 deletions app/models/ownership_request.rb

This file was deleted.

Loading
Loading