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
Boxiang Sun
gitlab-ce
Commits
2acde87e
Commit
2acde87e
authored
Jun 26, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project hook, milestone, snippet strong params
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e382c8df
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
14 deletions
+24
-14
app/controllers/admin/hooks_controller.rb
app/controllers/admin/hooks_controller.rb
+5
-1
app/controllers/projects/hooks_controller.rb
app/controllers/projects/hooks_controller.rb
+1
-1
app/controllers/projects/milestones_controller.rb
app/controllers/projects/milestones_controller.rb
+6
-2
app/controllers/projects/snippets_controller.rb
app/controllers/projects/snippets_controller.rb
+6
-2
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+6
-2
app/models/milestone.rb
app/models/milestone.rb
+0
-2
app/models/project_hook.rb
app/models/project_hook.rb
+0
-2
app/models/snippet.rb
app/models/snippet.rb
+0
-2
No files found.
app/controllers/admin/hooks_controller.rb
View file @
2acde87e
...
...
@@ -5,7 +5,7 @@ class Admin::HooksController < Admin::ApplicationController
end
def
create
@hook
=
SystemHook
.
new
(
params
[
:hook
]
)
@hook
=
SystemHook
.
new
(
hook_params
)
if
@hook
.
save
redirect_to
admin_hooks_path
,
notice:
'Hook was successfully created.'
...
...
@@ -37,4 +37,8 @@ class Admin::HooksController < Admin::ApplicationController
redirect_to
:back
end
def
hook_params
params
.
require
(
:hook
).
permit
(
:url
)
end
end
app/controllers/projects/hooks_controller.rb
View file @
2acde87e
...
...
@@ -42,6 +42,6 @@ class Projects::HooksController < Projects::ApplicationController
end
def
hook_params
params
.
require
(
:hook
).
permit
(
:url
)
params
.
require
(
:hook
).
permit
(
:url
,
:push_events
,
:issues_events
,
:merge_requests_events
,
:tag_push_events
)
end
end
app/controllers/projects/milestones_controller.rb
View file @
2acde87e
...
...
@@ -37,7 +37,7 @@ class Projects::MilestonesController < Projects::ApplicationController
end
def
create
@milestone
=
Milestones
::
CreateService
.
new
(
project
,
current_user
,
params
[
:milestone
]
).
execute
@milestone
=
Milestones
::
CreateService
.
new
(
project
,
current_user
,
milestone_params
).
execute
if
@milestone
.
save
redirect_to
project_milestone_path
(
@project
,
@milestone
)
...
...
@@ -47,7 +47,7 @@ class Projects::MilestonesController < Projects::ApplicationController
end
def
update
@milestone
=
Milestones
::
UpdateService
.
new
(
project
,
current_user
,
params
[
:milestone
]
).
execute
(
milestone
)
@milestone
=
Milestones
::
UpdateService
.
new
(
project
,
current_user
,
milestone_params
).
execute
(
milestone
)
respond_to
do
|
format
|
format
.
js
...
...
@@ -105,4 +105,8 @@ class Projects::MilestonesController < Projects::ApplicationController
def
module_enabled
return
render_404
unless
@project
.
issues_enabled
end
def
milestone_params
params
.
require
(
:milestone
).
permit
(
:title
,
:description
,
:due_date
,
:state_event
)
end
end
app/controllers/projects/snippets_controller.rb
View file @
2acde87e
...
...
@@ -25,7 +25,7 @@ class Projects::SnippetsController < Projects::ApplicationController
end
def
create
@snippet
=
@project
.
snippets
.
build
(
params
[
:project_snippet
]
)
@snippet
=
@project
.
snippets
.
build
(
snippet_params
)
@snippet
.
author
=
current_user
if
@snippet
.
save
...
...
@@ -39,7 +39,7 @@ class Projects::SnippetsController < Projects::ApplicationController
end
def
update
if
@snippet
.
update_attributes
(
params
[
:project_snippet
]
)
if
@snippet
.
update_attributes
(
snippet_params
)
redirect_to
project_snippet_path
(
@project
,
@snippet
)
else
respond_with
(
@snippet
)
...
...
@@ -86,4 +86,8 @@ class Projects::SnippetsController < Projects::ApplicationController
def
module_enabled
return
render_404
unless
@project
.
snippets_enabled
end
def
snippet_params
params
.
require
(
:project_snippet
).
permit
(
:title
,
:content
,
:file_name
,
:private
)
end
end
app/controllers/snippets_controller.rb
View file @
2acde87e
...
...
@@ -51,7 +51,7 @@ class SnippetsController < ApplicationController
end
def
create
@snippet
=
PersonalSnippet
.
new
(
params
[
:personal_snippet
]
)
@snippet
=
PersonalSnippet
.
new
(
snippet_params
)
@snippet
.
author
=
current_user
if
@snippet
.
save
...
...
@@ -65,7 +65,7 @@ class SnippetsController < ApplicationController
end
def
update
if
@snippet
.
update_attributes
(
params
[
:personal_snippet
]
)
if
@snippet
.
update_attributes
(
snippet_params
)
redirect_to
snippet_path
(
@snippet
)
else
respond_with
@snippet
...
...
@@ -109,4 +109,8 @@ class SnippetsController < ApplicationController
def
set_title
@title
=
'Snippets'
end
def
snippet_params
params
.
require
(
:personal_snippet
).
permit
(
:title
,
:content
,
:file_name
,
:private
)
end
end
app/models/milestone.rb
View file @
2acde87e
...
...
@@ -16,8 +16,6 @@
class
Milestone
<
ActiveRecord
::
Base
include
InternalId
#attr_accessible :title, :description, :due_date, :state_event
belongs_to
:project
has_many
:issues
has_many
:merge_requests
...
...
app/models/project_hook.rb
View file @
2acde87e
...
...
@@ -18,8 +18,6 @@
class
ProjectHook
<
WebHook
belongs_to
:project
#attr_accessible :push_events, :issues_events, :merge_requests_events, :tag_push_events
scope
:push_hooks
,
->
{
where
(
push_events:
true
)
}
scope
:tag_push_hooks
,
->
{
where
(
tag_push_events:
true
)
}
scope
:issue_hooks
,
->
{
where
(
issues_events:
true
)
}
...
...
app/models/snippet.rb
View file @
2acde87e
...
...
@@ -18,8 +18,6 @@
class
Snippet
<
ActiveRecord
::
Base
include
Linguist
::
BlobHelper
#attr_accessible :title, :content, :file_name, :expires_at, :private
default_value_for
:private
,
true
belongs_to
:author
,
class_name:
"User"
...
...
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