[refs #90] fixed lost data after merge
This commit is contained in:
parent
b833d7c167
commit
ae4c8a6a5e
|
@ -62,7 +62,6 @@ class Ability
|
|||
can(:destroy, Project) {|project| owner? project}
|
||||
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin')}
|
||||
can :remove_user, Project
|
||||
can :pull, Project #FIXME!
|
||||
can [:autocomplete_base_project_name, :autocomplete_head_project_name], Project
|
||||
|
||||
can [:read, :owned], BuildList, :user_id => user.id
|
||||
|
@ -121,7 +120,6 @@ class Ability
|
|||
can(:update, Comment) {|comment| comment.user_id == user.id or local_admin?(comment.project || comment.commentable.project)}
|
||||
cannot :manage, Comment, :commentable_type => 'Issue', :commentable => {:project => {:has_issues => false}} # switch off issues
|
||||
|
||||
can :merge, PullRequest, :status => 'ready'
|
||||
end
|
||||
|
||||
# Shared cannot rights for all users (registered, admin)
|
||||
|
@ -141,6 +139,8 @@ class Ability
|
|||
can :destroy, Subscribe do |subscribe|
|
||||
subscribe.subscribeable.subscribes.exists?(:user_id => user.id) && user.id == subscribe.user_id
|
||||
end
|
||||
|
||||
can :merge, PullRequest, :status => 'ready'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@ class Issue < ActiveRecord::Base
|
|||
closed_by && closed_at && status == 'closed'
|
||||
end
|
||||
|
||||
def set_close(closed_by, status = 'closed')
|
||||
def set_close(closed_by)
|
||||
self.closed_at = Time.now.utc
|
||||
self.closer = closed_by
|
||||
self.status = status
|
||||
self.status = 'closed'
|
||||
end
|
||||
|
||||
def set_open
|
||||
|
|
|
@ -92,10 +92,10 @@ class PullRequest < ActiveRecord::Base
|
|||
Dir.chdir(path) do
|
||||
system "git config user.name \"#{who.uname}\" && git config user.email \"#{who.email}\""
|
||||
if merge
|
||||
merging
|
||||
system("git push origin HEAD")
|
||||
system("git reset --hard HEAD^") # for diff maybe FIXME
|
||||
issue.set_close who, 'merged'
|
||||
set_user_and_time who
|
||||
merging
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -215,4 +215,9 @@ class PullRequest < ActiveRecord::Base
|
|||
def clean_dir
|
||||
FileUtils.rm_rf path
|
||||
end
|
||||
|
||||
def set_user_and_time user
|
||||
issue.closed_at = Time.now.utc
|
||||
issue.closer = user
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue