Merge branch 'dev_newproject' into 'develop'

Pull Request冲突提醒及处理、Issue编辑跳详情问题、Issue编辑返回空白问题



See merge request !57
This commit is contained in:
黄井泉 2016-12-15 09:28:05 +08:00
commit bf6bdc8c9e
13 changed files with 112 additions and 22 deletions

View File

@ -0,0 +1,3 @@
class DataException < ActiveRecord::Base
attr_accessible :container_id, :container_type, :message
end

View File

@ -59,7 +59,7 @@
<% if params[:action] == "new" %>
<a href="<%= project_issues_path(@project, :remote => true) %>" class="sy_btn_grey mr5 fr"> 取消</a>
<% else %>
<a href="javascript:void(0);" onclick="issueDetailShow();" class="sy_btn_grey mr5 fr" > 取消 </a>
<%= link_to "取消", issue_path(@issue), :class => "sy_btn_grey mr5 fr" %>
<% end %>
<!--<a href="javascript:void(0);" class="sy_btn_blue mr5 fr"> 保存并继续</a>-->
<!--<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue mr5 fr" id="issue_confirm"> 保存</a>-->

View File

@ -1,6 +1,6 @@
<% if @issue_commit_ids %>
<% unless @issue_commit_ids.blank? %>
<% @issue_commit_ids.each do |commit_id| %>
<div class="btn btn-blue mb5">
<div class="btn-commit-issue btn-blue mb5 mr5">
<%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %>
<% if @issue %>
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %>
@ -13,6 +13,4 @@
<% end %>
</div>
<% end %>
<% else %>
<div class="c_grey">暂无</div>
<% end %>

View File

@ -0,0 +1,20 @@
<% if !@issue_commit_ids.blank? %>
<span class="pro_new_conbox_leftspan mb5">关联Commit</span>
<% @issue_commit_ids.each do |commit_id| %>
<div class="btn-commit-issue btn-blue mb5 mr5">
<%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %>
<% if @issue %>
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %>
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
<% end %>
<% else %>
<% if User.current.member_of?(@project) %>
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
<% end %>
<% end %>
</div>
<% end %>
<% else %>
<span class="pro_new_conbox_leftspan mb5 fl">关联Commit</span>
<span class="pro_new_conbox_rightspan fl ml10">无</span>
<% end %>

View File

@ -73,7 +73,7 @@
<span class="fl mr5"><%= activity.journals.count %></span>
<% end %>
<div class="undis" style="position: absolute; <%= activity.journals.count > 0 ? 'top:25px;' : 'top:7px' %>">
<%= link_to "", issue_path(activity.id, :edit => 'true'), :class => 'sy_icons_edit fl mt15', :style => "margin-top:25px;", :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
<%= link_to "", edit_issue_path(activity.id), :class => 'sy_icons_edit fl mt15', :style => "margin-top:25px;", :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
<% if !defined?(project_id) && !defined?(user_id) %>
<%= link_to "", issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15', :style => "margin-top:25px;" if User.current.allowed_to?(:delete_issues, activity.project) %>
<% elsif defined?(project_id) %>

View File

@ -37,7 +37,7 @@
</div>
</div>
<ul class="fr pro_new_conbox_right" id="project_issue_info_show">
<ul class="fr pro_new_conbox_right mt10" id="project_issue_info_show">
<li class="clear">
<span class="pro_new_conbox_leftspan fl">当前状态</span>
<span class="pro_new_conbox_rightspan fl ml10"><%= @issue.status.name %></span>
@ -74,10 +74,8 @@
<span class="pro_new_conbox_rightspan fl ml10"><%= @issue.done_ratio %>%</span>
</li>
<% end %>
<li class="clear"><span class="pro_new_conbox_leftspan mb5">关联Commit</span>
<div id="issue_commit_ids">
<%= render :partial => "issues/issue_commit_ids" %>
</div>
<li class="clear">
<%= render :partial => "issues/issue_commit_ids_show" %>
</li>
</ul>
<div class="cl"></div>

View File

@ -17,7 +17,7 @@
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
<%= link_to l(:button_edit), edit_issue_path(activity.id), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
</li>
<li>
<% if !defined?(project_id) && !defined?(user_id) %>

View File

@ -6,10 +6,15 @@
<div class="alert alert-orange mb15 ">
项目分支 <%= @request.source_branch %> 和 <%= @request.target_branch %> 似乎没有差异,请将新改动提交至源分支或者切换到其它目标分支
</div>
<% elsif !@request.merge_when_build_succeeds %>
<div class="alert alert-orange mb15 ">
Pull Request中存在冲突请先解决冲突或者手动进行合并。
</div>
<% else %>
<% if is_project_manager?(User.current.id, @project.id) %>
<div class="alert alert-orange mb15 ">
在管理员接受后,将由系统自动合并。<%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %></a>
在管理员接受后,将由系统自动合并。
<%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %></a>
</div>
<% end %>
<% end %>

View File

@ -20,7 +20,7 @@
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
<%= link_to l(:button_edit), edit_issue_path(activity.id), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
</li>
<li>
<% if !defined?(project_id) && !defined?(user_id) %>

View File

@ -0,0 +1,11 @@
class CreateDataExceptions < ActiveRecord::Migration
def change
create_table :data_exceptions do |t|
t.string :message
t.integer :container_id
t.string :container_type
t.timestamps
end
end
end

View File

@ -0,0 +1,50 @@
namespace :gitlab do
desc "make sure trustie'data consistent with gitlab's data"
task :sync_data => :environment do
s = Trustie::Gitlab::Sync.new
g = Gitlab.client
projects = Project.where("gpid is not null and status=?", 1)
projects.each do |project|
# sync members and roles
begin
if project.members.count != g.team_members(project.gpid).count
project.members.each do |m|
begin
gid = m.user.gid
if gid.nil?
gid = s.sync_user(m.user).id
end
access_level = m.roles[0].position == 3 ? 40 : (m.roles[0].position == 4 ? 30 : 20)
# sync project's members
g.add_team_member(project.gpid, gid, access_level)
# sync members' roles
g.edit_team_member(project.gpid, gid, access_level)
rescue Exception => e
DataException.create(:message => e.message, :container_id => project.id, :container_type => "Project")
puts e
end
end
end
rescue Exception => e
puts e
end
end
users = User.where("gid is not null and status =?", 1)
users.each do |user|
begin
# sync username
g.edit_user(user.gid, :username => user.login) if user.login != g.user(user.gid).try(:username)
# sync email
g.edit_user(user.gid, :email => user.mail) if user.mail != g.user(user.gid).try(:email)
# sync password
options = {:encrypted_password=> user.hashed_password, :password_salt=> user.salt}
g.put("/users/ext/#{user.gid}", :body => options)
rescue Exception => e
puts e
end
end
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe DataException, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end