Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow last version unyanking by original owner #467

Merged
merged 2 commits into from Jul 13, 2013

Conversation

Projects
None yet
4 participants
Contributor

laserlemon commented Oct 10, 2012

This postpones deletion of gem ownerships (when the last version is yanked) until a new owner comes along to claim the gem. That way, the original owner can at any time unyank an accidentally-yanked version without losing permissions.

laserlemon added some commits Oct 10, 2012

Allow fully-yanked gems to be unyanked by the original owner
This still allows for a new user to swoop in and claim the gem by pushing their own version. Doing so would delete the previous ownership.
Member

sferik commented Oct 10, 2012

The code looks good to me but I wonder about the policy change. @qrush, any particular reason why it was originally built the way it was? If not, this should be good to merge. Thanks for the patch, Steve.

@adkron adkron commented on the diff Nov 9, 2012

app/models/pusher.rb
@@ -77,6 +77,7 @@ def notify(message, code)
end
def update
+ rubygem.disown if rubygem.versions.indexed.count.zero?
@adkron

adkron Nov 9, 2012

Contributor

Move that if down so it doesn't have to chain so much. Change this line to rubygem.disown and let that decide what do do. Maybe something like:

class Rubygem
  #...
  def disown
    ownerships.delete_all if versions.indexed.exists?
  end
  #...
end

I still think the versions.indexed.count.zero? is a big smell, but I can't think of how to clean that up right now.

Moving the if inside the Rubygem keeps the logic closer to the domain at hand.

evanphx added a commit that referenced this pull request Jul 13, 2013

Merge pull request #467 from rubygems/unyank-by-owner
Allow last version unyanking by original owner

@evanphx evanphx merged commit 154853e into master Jul 13, 2013

1 check passed

default The Travis build passed
Details

@dwradcliffe dwradcliffe deleted the unyank-by-owner branch Sep 26, 2014

evanphx added a commit that referenced this pull request Jan 29, 2015

Merge pull request #467 from rubygems/unyank-by-owner
Allow last version unyanking by original owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment