Send update instructions after project namespace id changed or namespace path changed

This commit is contained in:
Dmitriy Zaporozhets 2012-12-20 22:16:51 +02:00
parent d188adfd97
commit 75dd704294
5 changed files with 47 additions and 2 deletions

View file

@ -59,7 +59,10 @@ class Namespace < ActiveRecord::Base
if File.exists?(new_path)
raise "Already exists"
end
system("mv #{old_path} #{new_path}")
if system("mv #{old_path} #{new_path}")
send_update_instructions
end
end
end
@ -67,4 +70,8 @@ class Namespace < ActiveRecord::Base
dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
system("rm -rf #{dir_path}")
end
def send_update_instructions
projects.each(&:send_move_instructions)
end
end

View file

@ -259,4 +259,10 @@ class Project < ActiveRecord::Base
merge_requests
end
end
def send_move_instructions
self.users_projects.each do |member|
Notify.project_was_moved_email(member.id).deliver
end
end
end