Commit 6b1ddc5e86321d27de427ed6dc1c2512b00add19

Mail the user when someone adds him as a committer, no test. (Just playing around with git)

Commit diff

TODO.txt

 
2525* only load scriptacolous+friends when needed
2626* git-blame rendering?
2727* Reword /about page
28* mail the user when someone adds him as a comitter
28* mail the user when someone adds him as a comitter - add test
2929* expire fragment caches for project+repos on deletion
3030*a Tone down the "owner" of a repository, or implement a proper "mirror" project type.
3131*b be able to mark a project as a "mirror"
toggle raw diff

app/controllers/committers_controller.rb

 
2121
2222 respond_to do |format|
2323 if @repository.add_committer(@committer)
24 Mailer.deliver_added_as_committer(@repository, @committer)
2425 format.html { redirect_to([@repository.project, @repository]) }
2526 format.xml do
2627 render :xml => @committer
toggle raw diff

app/models/mailer.rb

 
3838 @body[:password] = password
3939 end
4040
41 def added_as_committer(repository, user)
42 setup_email(user)
43 @subject += "You are now a committer on #{repository.project.slug}/#{repository.parent.name}"
44 @body[:repository] = repository
45 @body[:project] = repository.project
46 @body[:url] = "http://#{GitoriousConfig['gitorious_host']}/p/#{repository.project.slug}/repos/#{repository.name}"
47 end
48
4149 protected
4250 def setup_email(user)
4351 @recipients = "#{user.email}"
toggle raw diff

app/views/mailer/added_as_committer.rhtml

 
1Hello <%= @user.login -%>,
2
3You have been added as a committer on the <%= @repository.name -%> repository in the "<%= @project.title -%>" project.
4
5<%= @url %>
6
7Thank you
8
9http://<%= GitoriousConfig['gitorious_host'] %>
toggle raw diff