Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
a165a0b2
Commit
a165a0b2
authored
Jul 16, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create event on dashboard when branch removed via UI
parent
d207a31f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+5
-1
app/models/event.rb
app/models/event.rb
+13
-0
No files found.
app/controllers/projects/branches_controller.rb
View file @
a165a0b2
...
@@ -14,7 +14,11 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -14,7 +14,11 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
def
destroy
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
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
project_branches_path
}
format
.
html
{
redirect_to
project_branches_path
}
...
...
app/models/event.rb
View file @
a165a0b2
...
@@ -54,6 +54,19 @@ class Event < ActiveRecord::Base
...
@@ -54,6 +54,19 @@ class Event < ActiveRecord::Base
Event
::
COMMENTED
Event
::
COMMENTED
end
end
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
end
def
proper?
def
proper?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment