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
17d67a98
Commit
17d67a98
authored
Jun 29, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Implement close/reopen issue actions.
parent
d24e47a9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
30 deletions
+52
-30
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+45
-24
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+2
-1
app/assets/javascripts/notes/components/issue_note_awards_list.vue
...s/javascripts/notes/components/issue_note_awards_list.vue
+1
-1
app/assets/javascripts/notes/services/issue_notes_service.js
app/assets/javascripts/notes/services/issue_notes_service.js
+1
-1
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+1
-1
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+2
-2
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
17d67a98
...
@@ -28,43 +28,63 @@ export default {
...
@@ -28,43 +28,63 @@ export default {
commentButtonTitle
()
{
commentButtonTitle
()
{
return
this
.
noteType
===
'
comment
'
?
'
Comment
'
:
'
Start discussion
'
;
return
this
.
noteType
===
'
comment
'
?
'
Comment
'
:
'
Start discussion
'
;
},
},
isIssueOpen
()
{
return
this
.
issueState
===
'
opened
'
||
this
.
issueState
===
'
reopened
'
;
},
issueActionButtonTitle
()
{
issueActionButtonTitle
()
{
if
(
this
.
note
.
length
)
{
if
(
this
.
note
.
length
)
{
const
actionText
=
this
.
is
sueState
===
'
open
'
?
'
close
'
:
'
reopen
'
;
const
actionText
=
this
.
is
IssueOpen
?
'
close
'
:
'
reopen
'
;
return
this
.
noteType
===
'
comment
'
?
`Comment &
${
actionText
}
issue`
:
`Start discussion &
${
actionText
}
issue`
;
return
this
.
noteType
===
'
comment
'
?
`Comment &
${
actionText
}
issue`
:
`Start discussion &
${
actionText
}
issue`
;
}
}
return
this
.
is
sueState
===
'
open
'
?
'
Close issue
'
:
'
Reopen issue
'
;
return
this
.
is
IssueOpen
?
'
Close issue
'
:
'
Reopen issue
'
;
},
},
},
},
methods
:
{
methods
:
{
handleSave
()
{
handleSave
(
withIssueAction
)
{
const
data
=
{
if
(
this
.
note
.
length
)
{
endpoint
:
this
.
endpoint
,
const
data
=
{
noteData
:
{
endpoint
:
this
.
endpoint
,
full_data
:
true
,
noteData
:
{
note
:
{
full_data
:
true
,
noteable_type
:
'
Issue
'
,
note
:
{
noteable_id
:
window
.
gl
.
issueData
.
id
,
noteable_type
:
'
Issue
'
,
note
:
this
.
note
,
noteable_id
:
window
.
gl
.
issueData
.
id
,
}
note
:
this
.
note
,
},
},
};
},
};
if
(
this
.
noteType
===
'
discussion
'
)
{
if
(
this
.
noteType
===
'
discussion
'
)
{
data
.
noteData
.
note
.
type
=
'
DiscussionNote
'
;
data
.
noteData
.
note
.
type
=
'
DiscussionNote
'
;
}
this
.
$store
.
dispatch
(
'
createNewNote
'
,
data
)
.
then
((
res
)
=>
{
if
(
res
.
errors
)
{
this
.
handleError
();
}
else
{
this
.
discard
();
}
})
.
catch
(
this
.
handleError
);
}
}
this
.
$store
.
dispatch
(
'
createNewNote
'
,
data
)
if
(
withIssueAction
)
{
.
then
((
res
)
=>
{
if
(
this
.
isIssueOpen
)
{
if
(
res
.
errors
)
{
gl
.
issueData
.
state
=
'
closed
'
;
return
this
.
handleError
();
this
.
issueState
=
'
closed
'
;
}
}
else
{
gl
.
issueData
.
state
=
'
reopened
'
;
this
.
issueState
=
'
reopened
'
;
}
this
.
isIssueOpen
=
!
this
.
isIssueOpen
;
this
.
discard
();
// This is out of scope for the Notes Vue component.
})
// It was the shortest path to update the issue state and relevant places.
.
catch
(
this
.
handleError
);
$
(
'
.js-btn-issue-action:visible
'
).
trigger
(
'
click
'
);
}
},
},
discard
()
{
discard
()
{
this
.
note
=
''
;
this
.
note
=
''
;
...
@@ -171,6 +191,7 @@ export default {
...
@@ -171,6 +191,7 @@ export default {
</ul>
</ul>
</div>
</div>
<a
<a
@
click=
"handleSave(true)"
:class=
"
{'btn-reopen': issueState === 'closed', 'btn-close': issueState === 'open'}"
:class=
"
{'btn-reopen': issueState === 'closed', 'btn-close': issueState === 'open'}"
class="btn btn-nr btn-comment">
class="btn btn-nr btn-comment">
{{
issueActionButtonTitle
}}
{{
issueActionButtonTitle
}}
...
...
app/assets/javascripts/notes/components/issue_note.vue
View file @
17d67a98
...
@@ -59,8 +59,9 @@ export default {
...
@@ -59,8 +59,9 @@ export default {
},
},
formUpdateHandler
(
note
)
{
formUpdateHandler
(
note
)
{
const
data
=
{
const
data
=
{
endpoint
:
`
${
this
.
note
.
path
}
?full_data=1`
,
endpoint
:
this
.
note
.
path
,
note
:
{
note
:
{
full_data
:
true
,
target_type
:
'
issue
'
,
target_type
:
'
issue
'
,
target_id
:
this
.
note
.
noteable_id
,
target_id
:
this
.
note
.
noteable_id
,
note
,
note
,
...
...
app/assets/javascripts/notes/components/issue_note_awards_list.vue
View file @
17d67a98
<
script
>
<
script
>
import
*
as
Emoji
from
'
../../emoji
'
;
import
emojiSmiling
from
'
icons/_emoji_slightly_smiling_face.svg
'
;
import
emojiSmiling
from
'
icons/_emoji_slightly_smiling_face.svg
'
;
import
emojiSmile
from
'
icons/_emoji_smile.svg
'
;
import
emojiSmile
from
'
icons/_emoji_smile.svg
'
;
import
emojiSmiley
from
'
icons/_emoji_smiley.svg
'
;
import
emojiSmiley
from
'
icons/_emoji_smiley.svg
'
;
import
*
as
Emoji
from
'
../../emoji
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
...
app/assets/javascripts/notes/services/issue_notes_service.js
View file @
17d67a98
...
@@ -18,5 +18,5 @@ export default {
...
@@ -18,5 +18,5 @@ export default {
},
},
createNewNote
(
endpoint
,
data
)
{
createNewNote
(
endpoint
,
data
)
{
return
Vue
.
http
.
post
(
endpoint
,
data
,
{
emulateJSON
:
true
});
return
Vue
.
http
.
post
(
endpoint
,
data
,
{
emulateJSON
:
true
});
}
}
,
};
};
app/assets/javascripts/notes/stores/issue_notes_store.js
View file @
17d67a98
...
@@ -58,7 +58,7 @@ const mutations = {
...
@@ -58,7 +58,7 @@ const mutations = {
expanded
:
true
,
expanded
:
true
,
id
:
discussion_id
,
id
:
discussion_id
,
individual_note
:
!
(
type
===
'
DiscussionNote
'
),
individual_note
:
!
(
type
===
'
DiscussionNote
'
),
notes
:
[
note
],
notes
:
[
note
],
reply_id
:
discussion_id
,
reply_id
:
discussion_id
,
};
};
...
...
app/views/projects/issues/show.html.haml
View file @
17d67a98
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
-
unless
current_user
==
@issue
.
author
-
unless
current_user
==
@issue
.
author
%li
=
link_to
'Report abuse'
,
new_abuse_report_path
(
user_id:
@issue
.
author
.
id
,
ref_url:
issue_url
(
@issue
))
%li
=
link_to
'Report abuse'
,
new_abuse_report_path
(
user_id:
@issue
.
author
.
id
,
ref_url:
issue_url
(
@issue
))
-
if
can_update_issue
-
if
can_update_issue
%li
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
class:
"btn-close
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
%li
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
class:
"btn-close
js-btn-issue-action
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
%li
=
link_to
'Reopen issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
format:
'json'
),
class:
"btn-reopen
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen issue'
%li
=
link_to
'Reopen issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
format:
'json'
),
class:
"btn-reopen
js-btn-issue-action
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen issue'
-
if
can_report_spam
-
if
can_report_spam
%li
=
link_to
'Submit as spam'
,
mark_as_spam_project_issue_path
(
@project
,
@issue
),
method: :post
,
class:
'btn-spam'
,
title:
'Submit as spam'
%li
=
link_to
'Submit as spam'
,
mark_as_spam_project_issue_path
(
@project
,
@issue
),
method: :post
,
class:
'btn-spam'
,
title:
'Submit as spam'
-
if
can_update_issue
||
can_report_spam
-
if
can_update_issue
||
can_report_spam
...
...
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