diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index b68db3563..6f245a92b 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -190,7 +190,7 @@ class PullRequestsController < ApplicationController begin status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid) # 接受后,给用户发消息 - send_message_to_author(@project.id, status.author.try(:user_name), params[:id], 2) + send_message_to_author(@project.id, status.author.try(:username), params[:id], 2) respond_to do |format| format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)} @@ -220,8 +220,8 @@ class PullRequestsController < ApplicationController user = User.find_by_login(request.author.try(:username)) status = params[:state] == "close" ? 4 : 3 send_message_to_manager(@project.id, params[:id], status) - if !is_project_manager?(user.id, @project.id) - send_message_to_author(@project, user.login, request.id, status) + if is_project_manager?(User.current.id, @project.id) + send_message_to_author(@project.id, user.login, request.id, status) end respond_to do |format| format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)} @@ -350,7 +350,9 @@ class PullRequestsController < ApplicationController :forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true, - :status => status) + :status => status, + :operate_user_id => User.current.id, + ) end def authorize_logged diff --git a/app/models/forge_message.rb b/app/models/forge_message.rb index bc514025e..e131eb600 100644 --- a/app/models/forge_message.rb +++ b/app/models/forge_message.rb @@ -1,7 +1,7 @@ class ForgeMessage < ActiveRecord::Base # status在不同的类中,作用不同 # Isseu: satus nil:发布了缺陷;:1:缺陷计划完成日志到了提醒 - attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status + attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status, :operate_user_id belongs_to :forge_message ,:polymorphic => true belongs_to :project diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 282df48c3..05b8d40d0 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -27,17 +27,17 @@ <% unless @entries.nil? %> ZIP下载 - <% if User.current.member_of?(@project) && @project.is_public? %> - <% if quality_analysis(User.current.try(:login), @repository.id).nil? %> - <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> - <% else %> - <%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> - <% end %> - <% end %> - <% end %> - <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> - <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> + <%# if User.current.member_of?(@project) && @project.is_public? %> + <%# if quality_analysis(User.current.try(:login), @repository.id).nil? %> + <%#= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %> + <%# else %> + <%#= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %> + <%# end %> + <%# end %> <% end %> + <%# unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%#= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> + <%# end %>