diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index c90cc1cc3..5fe953563 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index eacead013..a930b5467 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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) diff --git a/app/models/project.rb b/app/models/project.rb index 07854822e..f257058ea 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/tasks/destroy_repository_task.rb b/app/tasks/destroy_repository_task.rb new file mode 100644 index 000000000..3e434422e --- /dev/null +++ b/app/tasks/destroy_repository_task.rb @@ -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 diff --git a/app/views/mailer/issue_add.text.erb b/app/views/mailer/issue_add.text.erb index c5b391685..cc2eb814f 100644 --- a/app/views/mailer/issue_add.text.erb +++ b/app/views/mailer/issue_add.text.erb @@ -1,3 +1,9 @@ <%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %> -<%= link_to( l(:mail_issue_footer), @user_url) %> \ No newline at end of file +<% [: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 %> + + <% 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 %> diff --git a/app/views/mailer/issue_edit.text.erb b/app/views/mailer/issue_edit.text.erb index 1434a7a33..d1d625cec 100644 --- a/app/views/mailer/issue_edit.text.erb +++ b/app/views/mailer/issue_edit.text.erb @@ -5,4 +5,10 @@ -------------------------------------------------------------------------------- <%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %> -<%= link_to( l(:mail_issue_footer), @user_url) %> \ No newline at end of file +<% [: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 %> + + <% 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 %> diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 4de42b8aa..59735225d 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -293,4 +293,10 @@ <% 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 %> diff --git a/config/application.rb b/config/application.rb index 57ae436cb..4a0e56115 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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" diff --git a/config/configuration.yml b/config/configuration.yml index 5eba1c71d..87a54a976 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -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" diff --git a/db/migrate/20150428021035_add_hidden_to_repositories.rb b/db/migrate/20150428021035_add_hidden_to_repositories.rb new file mode 100644 index 000000000..13f10ce4f --- /dev/null +++ b/db/migrate/20150428021035_add_hidden_to_repositories.rb @@ -0,0 +1,5 @@ +class AddHiddenToRepositories < ActiveRecord::Migration + def change + add_column :repositories, :hidden, :boolean, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 3e07b71db..dcbe017fb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake index 5f9bf7769..5126d7a69 100644 --- a/lib/tasks/email.rake +++ b/lib/tasks/email.rake @@ -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)