diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 318de2942..ee37927d3 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -379,6 +379,16 @@ class Mailer < ActionMailer::Base end + # issue截止时间提醒 + def issue_due_date(issue, recipients) + @author = issue.author + @issue_name = issue.subject + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) + @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} " + mail :to => recipients, + :subject => @subject + end + # Builds a Mail::Message object used to email recipients of the added issue. # # Example: diff --git a/app/views/mailer/issue_due_date.html.erb b/app/views/mailer/issue_due_date.html.erb new file mode 100644 index 000000000..f0ac2907a --- /dev/null +++ b/app/views/mailer/issue_due_date.html.erb @@ -0,0 +1,10 @@ +
+ +
+
\ No newline at end of file diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 6cac445ee..2c7d36fb5 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -47,6 +47,9 @@ <% else %> <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "f14 c_blue02" %> <% end %> + <% unless @project.project_score.changeset_num == 0 %> + <%= link_to "(#{@project.project_score.changeset_num})", ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> + <% end %> <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %> <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index 7b56011b1..00a1bfafd 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -28,4 +28,6 @@ zh: mail_homework: "作业:" mail_anonymous_comment_close: "作业匿评已经关闭,请您关注!" mail_anonymous_comment_open: "作业匿评已经开启,请您关注!" - mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" \ No newline at end of file + mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" + mail_issue_due_date: "问题跟踪截止时间快到了,请您关注!" + mail_issue: "问题跟踪:" \ No newline at end of file diff --git a/lib/tasks/issue_due_date.rake b/lib/tasks/issue_due_date.rake index f40fa290f..74ee242f5 100644 --- a/lib/tasks/issue_due_date.rake +++ b/lib/tasks/issue_due_date.rake @@ -8,12 +8,14 @@ namespace :issue_due_date do if ForgeMessage.where("forge_message_type =? and forge_message_id =? and status =?", "Issue", issue.id, 1).first.nil? recipients = [] assigner = User.find(issue.assigned_to_id) - recipients << issue.author + unless assigner.id == issue.author.id + recipients << issue.author + end recipients << assigner recipients.each do |r| issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1) - # 发送邮件通知 - # Mailer.homework_endtime__added(homework_common, s.student_id).deliver + # issue截止时间邮件提醒 + Mailer.issue_due_date(issue, recipients).deliver end end end diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index 1f6f7c146..d41b813e7 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -53,6 +53,19 @@ module Trustie ) project.gpid = gproject.id project.save! + + # 创建的时候一并同步成员及角色 + project.members.each do |m| + begin + gid = m.user.gid + unless gid + gid = sync_user(m.user).id + end + self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER) + rescue => e + puts e + end + end end def sync_project(project, opt={})