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
iv
gitlab-ce
Commits
01520d5d
Commit
01520d5d
authored
10 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dont allow edit or remove of system notes
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
36361f4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+8
-4
app/models/note.rb
app/models/note.rb
+4
-0
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+1
-1
No files found.
app/controllers/projects/notes_controller.rb
View file @
01520d5d
...
...
@@ -30,8 +30,10 @@ class Projects::NotesController < Projects::ApplicationController
end
def
update
note
.
update_attributes
(
note_params
)
note
.
reset_events_cache
if
note
.
editable?
note
.
update_attributes
(
note_params
)
note
.
reset_events_cache
end
respond_to
do
|
format
|
format
.
json
{
render_note_json
(
note
)
}
...
...
@@ -40,8 +42,10 @@ class Projects::NotesController < Projects::ApplicationController
end
def
destroy
note
.
destroy
note
.
reset_events_cache
if
note
.
editable?
note
.
destroy
note
.
reset_events_cache
end
respond_to
do
|
format
|
format
.
js
{
render
nothing:
true
}
...
...
This diff is collapsed.
Click to expand it.
app/models/note.rb
View file @
01520d5d
...
...
@@ -337,4 +337,8 @@ class Note < ActiveRecord::Base
def
set_references
notice_added_references
(
project
,
author
)
end
def
editable?
!
system
end
end
This diff is collapsed.
Click to expand it.
app/views/projects/notes/_note.html.haml
View file @
01520d5d
...
...
@@ -9,7 +9,7 @@
%i
.icon-link
Link here
-
if
(
note
.
author_id
==
current_user
.
try
(
:id
))
||
can?
(
current_user
,
:admin_note
,
@project
)
-
if
can?
(
current_user
,
:admin_note
,
note
)
&&
note
.
editable?
=
link_to
"#"
,
title:
"Edit comment"
,
class:
"js-note-edit"
do
%i
.icon-edit
Edit
...
...
This diff is collapsed.
Click to expand it.
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