创建,或关闭PullRequest时,发送消息(未完)
This commit is contained in:
parent
b2de81394e
commit
ea30873665
|
@ -98,15 +98,15 @@ class PullRequestsController < ApplicationController
|
||||||
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
|
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
|
||||||
@fork_pr_message = true if @fork_project_name
|
@fork_pr_message = true if @fork_project_name
|
||||||
# 发送消息
|
# 发送消息
|
||||||
#send_message(User.current.id, target_project_id, title)
|
send_message(User.current.id, target_project_id, request.id)
|
||||||
# 创建Trustie数据
|
# 创建Trustie数据
|
||||||
#PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id)
|
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id)
|
||||||
else
|
else
|
||||||
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
||||||
# 发送消息
|
# 发送消息
|
||||||
#send_message(User.current.id, @project.id, title)
|
send_message(User.current.id, @project.id, request.id)
|
||||||
# 创建Trustie数据
|
# 创建Trustie数据
|
||||||
#PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id)
|
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
||||||
end
|
end
|
||||||
|
@ -295,8 +295,9 @@ class PullRequestsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def send_message user_id, project_id, title
|
def send_message user_id, project_id, pull_request_id
|
||||||
self.forge_acts << ForgeMessage.new(:user_id => user_id, :project_id => project_id, :title => title)
|
self.forge_acts << ForgeMessage.new(:user_id => user_id, :project_id => project_id,
|
||||||
|
:forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorize_logged
|
def authorize_logged
|
||||||
|
|
|
@ -194,24 +194,31 @@
|
||||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--
|
|
||||||
<%# if ma.forge_message_type == "PullRequest" %>
|
<% if ma.forge_message_type == "PullRequest" && is_project_manager?( User.current.id, ma.forge_message.project_id) %>
|
||||||
<ul class="homepageNewsList fl">
|
<ul class="homepageNewsList fl">
|
||||||
<li class="homepageNewsPortrait fl">
|
<li class="homepageNewsPortrait fl">
|
||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<%#=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
|
<%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsPubType fl">
|
<li class="homepageNewsPubType fl">
|
||||||
<%#=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author),
|
<%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author),
|
||||||
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||||
<span class="<%#= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">创建了PullRequest:</span>
|
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
|
||||||
|
<% if ma.status == 1 %>
|
||||||
|
创建了PullRequest:
|
||||||
|
<% elsif ma.status == 3 %>
|
||||||
|
重新打开了PullRequest:
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsContent fl">
|
<li class="homepageNewsContent fl">
|
||||||
<%#= link_to "#{ma.forge_message.commented.title}",
|
<%= link_to "#{ma.forge_message.forge_message_id.title}",
|
||||||
{:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
|
{:controller => 'pull_requests', :action => 'show', :id => ma.forge_message.project_id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="homepageNewsTime fl"><%#= time_tag(ma.created_at).html_safe %> </li>
|
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
<%# end %>-->
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
Loading…
Reference in New Issue