pullrequest发送消息
This commit is contained in:
parent
ef86b6da2a
commit
b48fc7ba3b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -27,17 +27,17 @@
|
|||
<!--quality_analysis-->
|
||||
<% unless @entries.nil? %>
|
||||
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
|
||||
<% 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 %>
|
||||
|
||||
<div class="fl mt5 ml15">
|
||||
<%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %>
|
||||
|
|
|
@ -200,12 +200,12 @@
|
|||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);">
|
||||
<% send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
|
||||
<% author = User.find(send_message_user[0].user_id) %>
|
||||
<% author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
|
||||
<%= link_to image_tag(url_to_avatar(author), :width => "30", :height => "30"), user_path(author), :target => '_blank' %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%= link_to User.find(send_message_user[0].user_id).show_name, user_path(send_message_user[0].user_id),
|
||||
<%= link_to User.find(author.id).show_name, user_path(author),
|
||||
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
|
||||
<%= pull_request_message_status(ma) %>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddAperateIdtoForgeMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :forge_messages, :operate_user_id, :integer
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue