Merge branch 'guange_dev' into szzh

This commit is contained in:
sw 2015-04-28 15:08:00 +08:00
commit ee0ef7dc69
12 changed files with 71 additions and 35 deletions

View File

@ -236,24 +236,10 @@ update
end
def destroy
@root_path=RepositoriesHelper::ROOT_PATH
@repo_name=User.current.login.to_s+"_"+@repository.identifier.to_s
@repository_name=User.current.login.to_s+"/"+@repository.identifier.to_s+".git"
@middle=User.current.login.to_s+"_"+@repository.identifier.to_s+"-write:"
@repository.destroy if request.delete?
DestroyRepositoryTask.new.destroy(User.current.id, @repository.id)
@repository.hidden = true
@repository.save
redirect_to settings_project_url(@project, :tab => 'repositories')
if(@repository.type=="Repository::Git")
logger.info "destory the repository value"+"root path"+@root_path+"repo_name"+@repo_name+
"repository_name"+@repository_name+"user group"+@middle
system "sed -i /"+@repo_name+"/{d} "+@root_path+"htdocs/user.passwd"
system "sed -i /"+@middle+"/{d} "+@root_path+"htdocs/group.passwd"
system "rm -r "+@root_path+"htdocs/"+@repository_name
# if(@sed_user&&@sed_group&&@remove)
# else
# logger.info "An error occured when destory the repository"+"delete form passwd: \n"+
# @sed_user+"delete from group"+@sed_group+"delete from file"+@remove
# end
end
end
def show

View File

@ -817,12 +817,12 @@ class Mailer < ActionMailer::Base
headers[:references] = @references_objects.collect {|o| "<#{self.class.message_id_for(o)}>"}.join(' ')
end
set_language_if_valid @initial_language
super headers do |format|
format.text
format.html unless Setting.plain_text_mail?
end
set_language_if_valid @initial_language
end
def initialize(*args)

View File

@ -51,7 +51,7 @@ class Project < ActiveRecord::Base
has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name"
has_many :boards, :dependent => :destroy, :order => "position ASC"
has_one :repository, :conditions => ["is_default = ?", true]
has_many :repositories, :dependent => :destroy
has_many :repositories, :dependent => :destroy, conditions: "hidden=false"
has_many :changesets, :through => :repository
#added by xianbo for delete biding_project
has_many :biding_projects, :dependent => :destroy

View File

@ -0,0 +1,25 @@
#coding=utf-8
#
class DestroyRepositoryTask
def destroy(user_id, rep_id)
user = User.find(user_id)
repository = Repository.find(rep_id)
Rails.logger.info "start delete repository #{user} #{repository}"
@root_path=RepositoriesHelper::ROOT_PATH
@repo_name=user.login.to_s+"_"+repository.identifier.to_s
@repository_name=user.login.to_s+"/"+repository.identifier.to_s+".git"
@middle=user.login.to_s+"_"+repository.identifier.to_s+"-write:"
repository.destroy
if(repository.type=="Repository::Git")
Rails.logger.info "destory the repository value"+"root path"+@root_path+"repo_name"+@repo_name+
"repository_name"+@repository_name+"user group"+@middle
system "sed -i /"+@repo_name+"/{d} "+@root_path+"htdocs/user.passwd"
system "sed -i /"+@middle+"/{d} "+@root_path+"htdocs/group.passwd"
system "rm -r "+@root_path+"htdocs/"+@repository_name
end
end
handle_asynchronously :destroy,:queue => 'repository'
end

View File

@ -1,3 +1,9 @@
<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %>
<%= link_to( l(:mail_issue_footer), @user_url) %>
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
<% else %>
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
<% end %>
<% end %>

View File

@ -5,4 +5,10 @@
--------------------------------------------------------------------------------
<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %>
<%= link_to( l(:mail_issue_footer), @user_url) %>
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
<% else %>
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
<% end %>
<% end %>

View File

@ -293,4 +293,10 @@
<!--贴吧动态 end-->
<% end %>
<%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
<%= l(mail_option) %>
<% else %>
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
<% end %>
<% end %>

View File

@ -48,7 +48,7 @@ module RedmineApp
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :zh
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

View File

@ -215,11 +215,12 @@ production:
# specific configuration options for development environment
# that overrides the default ones
development:
delivery_method: :smtp
smtp_settings:
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"

View File

@ -0,0 +1,5 @@
class AddHiddenToRepositories < ActiveRecord::Migration
def change
add_column :repositories, :hidden, :boolean, default: false
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150422034543) do
ActiveRecord::Schema.define(:version => 20150428021035) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1058,6 +1058,7 @@ ActiveRecord::Schema.define(:version => 20150422034543) do
t.text "extra_info"
t.string "identifier"
t.boolean "is_default", :default => false
t.boolean "hidden", :default => false
end
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"

View File

@ -186,9 +186,9 @@ END_DESC
ActionMailer::Base.raise_delivery_errors = true
begin
Mailer.with_synched_deliveries do
Mailer.test_email(user).deliver
end
# Mailer.with_synched_deliveries do
Mailer.test_email(user).deliver!
# end
puts l(:notice_email_sent, user.mail)
rescue Exception => e
abort l(:notice_email_error, e.message)