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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a540f55c
Commit
a540f55c
authored
Aug 30, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
b181d312
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
9 deletions
+16
-9
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+1
-1
app/models/note.rb
app/models/note.rb
+1
-1
app/serializers/note_entity.rb
app/serializers/note_entity.rb
+2
-2
spec/controllers/projects/notes_controller_spec.rb
spec/controllers/projects/notes_controller_spec.rb
+12
-5
No files found.
app/controllers/concerns/notes_actions.rb
View file @
a540f55c
...
...
@@ -89,7 +89,7 @@ module NotesActions
if
note
.
persisted?
attrs
[
:valid
]
=
true
if
noteable
.
discussions_rendered_on_frontend?
if
noteable
.
nil?
||
noteable
.
discussions_rendered_on_frontend?
attrs
.
merge!
(
note_serializer
.
represent
(
note
))
else
attrs
.
merge!
(
...
...
app/models/note.rb
View file @
a540f55c
...
...
@@ -300,7 +300,7 @@ class Note < ActiveRecord::Base
end
def
expire_etag_cache
return
unless
noteable
.
discussions_rendered_on_frontend?
return
unless
noteable
&
.
discussions_rendered_on_frontend?
key
=
Gitlab
::
Routing
.
url_helpers
.
project_noteable_notes_path
(
project
,
...
...
app/serializers/note_entity.rb
View file @
a540f55c
...
...
@@ -14,8 +14,8 @@ class NoteEntity < API::Entities::Note
expose
:redacted_note_html
,
as: :note_html
expose
:last_edited_at
,
if:
->
(
note
,
_
)
{
note
.
is_
edited?
}
expose
:last_edited_by
,
using:
NoteUserEntity
,
if:
->
(
note
,
_
)
{
note
.
is_
edited?
}
expose
:last_edited_at
,
if:
->
(
note
,
_
)
{
note
.
edited?
}
expose
:last_edited_by
,
using:
NoteUserEntity
,
if:
->
(
note
,
_
)
{
note
.
edited?
}
expose
:current_user
do
expose
:can_edit
do
|
note
|
...
...
spec/controllers/projects/notes_controller_spec.rb
View file @
a540f55c
...
...
@@ -46,10 +46,13 @@ describe Projects::NotesController do
end
context
'for a discussion note'
do
let!
(
:note
)
{
create
(
:discussion_note_on_issue
,
noteable:
issue
,
project:
project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let!
(
:note
)
{
create
(
:discussion_note_on_merge_request
,
project:
project
)
}
let
(
:params
)
{
request_params
.
merge
(
target_type:
'merge_request'
,
target_id:
note
.
noteable_id
)
}
it
'responds with the expected attributes'
do
get
:index
,
request_
params
get
:index
,
params
expect
(
note_json
[
:id
]).
to
eq
(
note
.
id
)
expect
(
note_json
[
:discussion_html
]).
not_to
be_nil
...
...
@@ -104,10 +107,12 @@ describe Projects::NotesController do
end
context
'for a regular note'
do
let!
(
:note
)
{
create
(
:note
,
noteable:
issue
,
project:
project
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
project:
project
)
}
let
(
:params
)
{
request_params
.
merge
(
target_type:
'merge_request'
,
target_id:
note
.
noteable_id
)
}
it
'responds with the expected attributes'
do
get
:index
,
request_
params
get
:index
,
params
expect
(
note_json
[
:id
]).
to
eq
(
note
.
id
)
expect
(
note_json
[
:html
]).
not_to
be_nil
...
...
@@ -125,7 +130,9 @@ describe Projects::NotesController do
note:
{
note:
'some note'
,
noteable_id:
merge_request
.
id
,
noteable_type:
'MergeRequest'
},
namespace_id:
project
.
namespace
,
project_id:
project
,
merge_request_diff_head_sha:
'sha'
merge_request_diff_head_sha:
'sha'
,
target_type:
'merge_request'
,
target_id:
merge_request
.
id
}
end
...
...
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