Skip to content
Snippets Groups Projects
Commit a165a0b2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Create event on dashboard when branch removed via UI

parent d207a31f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -14,7 +14,11 @@ class Projects::BranchesController < Projects::ApplicationController
end
 
def destroy
@project.repository.rm_branch(params[:id])
branch = @project.repository.branches.find { |branch| branch.name == params[:id] }
if branch && @project.repository.rm_branch(branch.name)
Event.create_rm_branch(@project, current_user, branch)
end
 
respond_to do |format|
format.html { redirect_to project_branches_path }
Loading
Loading
Loading
Loading
@@ -54,6 +54,19 @@ class Event < ActiveRecord::Base
Event::COMMENTED
end
end
def create_rm_branch(project, user, branch)
Event.create(
project: project,
action: Event::PUSHED,
data: {
ref: branch.name,
before: branch.commit.id,
after: '00000000'
},
author_id: user.id
)
end
end
 
def proper?
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment