From 524e152b24613780c017a80ea04d79ea9954b995 Mon Sep 17 00:00:00 2001
From: huang <huang.jingquan@163.com>
Date: Thu, 21 Jan 2016 11:19:08 +0800
Subject: [PATCH 1/4] =?UTF-8?q?Issue=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?=
 =?UTF-8?q?=E5=88=B0=E4=BA=86=E9=82=AE=E4=BB=B6=E6=8F=90=E9=86=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/models/mailer.rb                     | 10 ++++++++++
 app/views/mailer/issue_due_date.html.erb | 10 ++++++++++
 config/locales/mailers/zh.yml            |  4 +++-
 lib/tasks/issue_due_date.rake            |  4 ++--
 4 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 app/views/mailer/issue_due_date.html.erb

diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 318de2942..81c568133 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.login
+    @issue_name = issue.subject
+    @issue_url = url_for(:controller  => 'issues', :action => 'show', :id => issue.id)
+    @subject = "#{l(:mail_issue)}#{issue.name} #{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..a4fd81236
--- /dev/null
+++ b/app/views/mailer/issue_due_date.html.erb
@@ -0,0 +1,10 @@
+<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
+  <ul style="list-style-type:none; margin:0; padding:0;">
+    <li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
+		<span style="float: left; width: 526px">
+          <p><%=link_to @author, user_url(@author) %> 发布的问题跟踪:<%=link_to @issue_name, @issue_url %> <span style="color: red">截止时间快到了,请您关注!</span></p>
+        </span>
+    </li>
+  </ul>
+  <div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
+</div>
\ No newline at end of file
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..8d101ff94 100644
--- a/lib/tasks/issue_due_date.rake
+++ b/lib/tasks/issue_due_date.rake
@@ -12,8 +12,8 @@ namespace :issue_due_date do
         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

From 024e29981737d81e5ce78d8a173556d550cca1ed Mon Sep 17 00:00:00 2001
From: huang <huang.jingquan@163.com>
Date: Thu, 21 Jan 2016 15:29:06 +0800
Subject: [PATCH 2/4] =?UTF-8?q?gitlab=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/trustie/gitlab/sync.rb | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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={})

From 56e804b423b242240bcfc877941d9de29a0b39e3 Mon Sep 17 00:00:00 2001
From: huang <huang.jingquan@163.com>
Date: Thu, 21 Jan 2016 15:52:07 +0800
Subject: [PATCH 3/4] =?UTF-8?q?issue=E9=82=AE=E4=BB=B6name=E9=97=AE?=
 =?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/models/mailer.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 81c568133..e7a17d4d1 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -384,7 +384,7 @@ class Mailer < ActionMailer::Base
     @author = issue.author.login
     @issue_name = issue.subject
     @issue_url = url_for(:controller  => 'issues', :action => 'show', :id => issue.id)
-    @subject = "#{l(:mail_issue)}#{issue.name} #{l(:mail_issue_due_date)} "
+    @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} "
     mail :to => recipients,
          :subject => @subject
   end

From 0ba724776ed6ac549602107fd623a4737e30a6e0 Mon Sep 17 00:00:00 2001
From: huang <huang.jingquan@163.com>
Date: Thu, 21 Jan 2016 16:06:50 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=89=88=E6=9C=AC?=
 =?UTF-8?q?=E5=BA=93=E5=B7=A6=E4=BE=A7=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4?=
 =?UTF-8?q?=E6=AC=A1=E6=95=B0=E7=BB=9F=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/views/projects/_development_group.html.erb | 3 +++
 1 file changed, 3 insertions(+)

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 %>
     <!--<a class="subnav_num">(<%= @project.repositories.count %>)</a>-->
     <% 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" %>