issue与commit关联的更新操作
This commit is contained in:
parent
378427d070
commit
c256462170
|
@ -268,12 +268,7 @@ class IssuesController < ApplicationController
|
|||
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
|
||||
if @issue.save
|
||||
# 关联commmit
|
||||
commit_ids = params[:commit_ids]
|
||||
unless commit_ids.blank?
|
||||
commit_ids.split(",").each do |commit_id|
|
||||
CommitIssues.create(:commit_id => commit_id, :project_id => @issue.project_id, :issue_id => @issue.id)
|
||||
end
|
||||
end
|
||||
update_issue_commit params[:commit_ids]
|
||||
#params[:issue][:assigned_to_id] = nil if params[:issue][:assigned_to_id].to_i == 0
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
issue_id = @issue.id
|
||||
|
@ -345,9 +340,9 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if @saved
|
||||
# 更新commit关联情况
|
||||
update_issue_commit params[:commit_ids]
|
||||
#修改界面增加跟踪者
|
||||
watcherlist = @issue.watcher_users
|
||||
select_users = []
|
||||
|
@ -392,6 +387,26 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 保存issue的时候相关的commit操作
|
||||
# commit_ids => "9b9845ff,poor56el"
|
||||
def update_issue_commit commit_ids
|
||||
# 关联commmit
|
||||
commit_ids = params[:commit_ids]
|
||||
unless commit_ids.blank?
|
||||
commit_ids = commit_ids.split(",").uniq
|
||||
if params[:action] == "update"
|
||||
exist_commit_ids = CommitIssues.where(:issue_id => @issue, :project_id => @issue.project_id)
|
||||
unless exist_commit_ids.blank?
|
||||
exist_commit_ids = exist_commit_ids.map{|commit| commit.commit_id}
|
||||
commit_ids = commit_ids - exist_commit_ids
|
||||
end
|
||||
end
|
||||
commit_ids.each do |commit_id|
|
||||
CommitIssues.create(:commit_id => commit_id, :project_id => @issue.project_id, :issue_id => @issue.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_user_issue_detail(issue, params)
|
||||
case params[:type]
|
||||
when "status"
|
||||
|
|
Loading…
Reference in New Issue