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
1c2eefef
Commit
1c2eefef
authored
Jul 28, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backend tweaks
parent
6d9715d8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
12 deletions
+23
-12
app/controllers/projects/discussions_controller.rb
app/controllers/projects/discussions_controller.rb
+2
-2
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+5
-5
app/models/diff_note.rb
app/models/diff_note.rb
+13
-2
app/views/discussions/_jump_to_next.html.haml
app/views/discussions/_jump_to_next.html.haml
+1
-1
app/views/discussions/_resolve_all.html.haml
app/views/discussions/_resolve_all.html.haml
+2
-2
No files found.
app/controllers/projects/discussions_controller.rb
View file @
1c2eefef
...
@@ -11,7 +11,7 @@ class Projects::DiscussionsController < Projects::ApplicationController
...
@@ -11,7 +11,7 @@ class Projects::DiscussionsController < Projects::ApplicationController
render
json:
{
render
json:
{
resolved_by:
discussion
.
resolved_by
.
try
(
:name
),
resolved_by:
discussion
.
resolved_by
.
try
(
:name
),
updated
_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
discussion_headline
_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
}
}
end
end
...
@@ -21,7 +21,7 @@ class Projects::DiscussionsController < Projects::ApplicationController
...
@@ -21,7 +21,7 @@ class Projects::DiscussionsController < Projects::ApplicationController
discussion
.
unresolve!
discussion
.
unresolve!
render
json:
{
render
json:
{
updated
_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
discussion_headline
_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
}
}
end
end
...
...
app/controllers/projects/notes_controller.rb
View file @
1c2eefef
...
@@ -72,11 +72,11 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -72,11 +72,11 @@ class Projects::NotesController < Projects::ApplicationController
note
.
resolve!
(
current_user
)
note
.
resolve!
(
current_user
)
discussion
=
note
.
noteable
.
discussions
.
find
{
|
d
|
d
.
id
==
note
.
discussion_id
}
||
render_404
discussion
=
note
.
discussion
render
json:
{
render
json:
{
resolved_by:
note
.
resolved_by
.
try
(
:name
),
resolved_by:
note
.
resolved_by
.
try
(
:name
),
updated_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
discussion_headline_html:
(
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
if
discussion
)
}
}
end
end
...
@@ -85,10 +85,10 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -85,10 +85,10 @@ class Projects::NotesController < Projects::ApplicationController
note
.
unresolve!
note
.
unresolve!
discussion
=
note
.
noteable
.
discussions
.
find
{
|
d
|
d
.
id
==
note
.
discussion_id
}
||
render_404
discussion
=
note
.
discussion
render
json:
{
render
json:
{
updated_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
discussion_headline_html:
(
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
if
discussion
)
}
}
end
end
...
@@ -164,7 +164,7 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -164,7 +164,7 @@ class Projects::NotesController < Projects::ApplicationController
}
}
if
note
.
diff_note?
if
note
.
diff_note?
discussion
=
Discussion
.
new
([
note
])
discussion
=
note
.
as_discussion
attrs
.
merge!
(
attrs
.
merge!
(
diff_discussion_html:
diff_discussion_html
(
discussion
),
diff_discussion_html:
diff_discussion_html
(
discussion
),
...
...
app/models/diff_note.rb
View file @
1c2eefef
...
@@ -76,7 +76,7 @@ class DiffNote < Note
...
@@ -76,7 +76,7 @@ class DiffNote < Note
end
end
def
resolvable?
def
resolvable?
!
system
?
&&
!
for_commi
t?
!
system
?
&&
for_merge_reques
t?
end
end
def
resolved?
def
resolved?
...
@@ -103,10 +103,21 @@ class DiffNote < Note
...
@@ -103,10 +103,21 @@ class DiffNote < Note
save!
save!
end
end
def
discussion
return
unless
resolvable?
discussion_notes
=
self
.
noteable
.
notes
.
fresh
.
select
{
|
n
|
n
.
discussion_id
==
self
.
discussion_id
}
Discussion
.
new
(
discussion_notes
)
end
def
as_discussion
Discussion
.
new
([
self
])
end
private
private
def
supported?
def
supported?
!
self
.
for_merge_reques
t?
||
self
.
noteable
.
support_new_diff_notes?
for_commi
t?
||
self
.
noteable
.
support_new_diff_notes?
end
end
def
set_original_position
def
set_original_position
...
...
app/views/discussions/_jump_to_next.html.haml
View file @
1c2eefef
-
discussion
=
local_assigns
.
fetch
(
:discussion
,
false
)
-
discussion
=
local_assigns
.
fetch
(
:discussion
,
nil
)
%jump-to-discussion
{
"inline-template"
=>
true
,
":discussion-id"
=>
"'#{discussion.try(:id)}'"
}
%jump-to-discussion
{
"inline-template"
=>
true
,
":discussion-id"
=>
"'#{discussion.try(:id)}'"
}
.btn-group
{
role:
"group"
,
.btn-group
{
role:
"group"
,
"v-show"
=>
"!allResolved"
}
"v-show"
=>
"!allResolved"
}
...
...
app/views/discussions/_resolve_all.html.haml
View file @
1c2eefef
-
if
discussion
.
can_resolve?
(
current_user
)
&&
discussion
.
resolvable?
-
if
discussion
.
can_resolve?
(
current_user
)
%resolve-all-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace.path}'"
,
%resolve-all-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace.path}'"
,
":project-path"
=>
"'#{discussion.project.path}'"
,
":project-path"
=>
"'#{discussion.project.path}'"
,
":discussion-id"
=>
"'#{discussion.id}'"
,
":discussion-id"
=>
"'#{discussion.id}'"
,
":merge-request-id"
=>
"#{discussion.
first_note.noteable.try(:iid)
}"
,
":merge-request-id"
=>
"#{discussion.
noteable.iid
}"
,
"inline-template"
=>
true
,
"inline-template"
=>
true
,
"v-cloak"
=>
true
}
"v-cloak"
=>
true
}
%button
.btn.btn-default
{
type:
"button"
,
"@click"
=>
"resolve"
,
":disabled"
=>
"loading"
}
%button
.btn.btn-default
{
type:
"button"
,
"@click"
=>
"resolve"
,
":disabled"
=>
"loading"
}
...
...
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