Fixed: post-receive, project remove, tests

This commit is contained in:
Dmitriy Zaporozhets 2013-02-05 12:47:50 +02:00
parent 39e37677f2
commit 70e3bffd95
9 changed files with 43 additions and 47 deletions

View file

@ -15,11 +15,10 @@ class ProjectObserver < ActiveRecord::Observer
def after_destroy(project)
GitoliteWorker.perform_async(
:remove_repository,
self.path_with_namespace
project.path_with_namespace
)
project.satellite.destroy
project.destroy_repository
log_info("Project \"#{project.name}\" was removed")
end

View file

@ -27,8 +27,9 @@ class PostReceive
User.find_by_email(email) if email
elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
User.find_by_email(identifier)
else
User.find_by_username(identifier.strip)
elsif identifier =~ /key/
key_id = identifier.gsub("key-", "")
Key.find_by_id(key_id).try(:user)
end
unless user