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
051cfe45
Commit
051cfe45
authored
Apr 12, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add-approval-system-note-icons' into 'master'
Add icon for approvals in MR See merge request !1641
parents
cb716716
0b4bcb52
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
5 deletions
+24
-5
app/helpers/system_note_helper.rb
app/helpers/system_note_helper.rb
+3
-1
app/models/system_note_metadata.rb
app/models/system_note_metadata.rb
+1
-1
app/services/system_note_service.rb
app/services/system_note_service.rb
+2
-2
app/views/shared/icons/_icon_check.svg
app/views/shared/icons/_icon_check.svg
+1
-0
app/views/shared/icons/_icon_fa_close.svg
app/views/shared/icons/_icon_fa_close.svg
+1
-0
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+16
-1
No files found.
app/helpers/system_note_helper.rb
View file @
051cfe45
...
@@ -16,7 +16,9 @@ module SystemNoteHelper
...
@@ -16,7 +16,9 @@ module SystemNoteHelper
'visible'
=>
'icon_eye'
,
'visible'
=>
'icon_eye'
,
'milestone'
=>
'icon_clock_o'
,
'milestone'
=>
'icon_clock_o'
,
'discussion'
=>
'icon_comment_o'
,
'discussion'
=>
'icon_comment_o'
,
'moved'
=>
'icon_arrow_circle_o_right'
'moved'
=>
'icon_arrow_circle_o_right'
,
'approved'
=>
'icon_check'
,
'unapproved'
=>
'icon_fa_close'
}.
freeze
}.
freeze
def
icon_for_system_note
(
note
)
def
icon_for_system_note
(
note
)
...
...
app/models/system_note_metadata.rb
View file @
051cfe45
...
@@ -2,7 +2,7 @@ class SystemNoteMetadata < ActiveRecord::Base
...
@@ -2,7 +2,7 @@ class SystemNoteMetadata < ActiveRecord::Base
ICON_TYPES
=
%w[
ICON_TYPES
=
%w[
commit merge confidential visible label assignee cross_reference
commit merge confidential visible label assignee cross_reference
title time_tracking branch milestone discussion task moved opened closed merged
title time_tracking branch milestone discussion task moved opened closed merged
approv
als
approv
ed unapproved
]
.
freeze
]
.
freeze
validates
:note
,
presence:
true
validates
:note
,
presence:
true
...
...
app/services/system_note_service.rb
View file @
051cfe45
...
@@ -488,13 +488,13 @@ module SystemNoteService
...
@@ -488,13 +488,13 @@ module SystemNoteService
def
approve_mr
(
noteable
,
user
)
def
approve_mr
(
noteable
,
user
)
body
=
"approved this merge request"
body
=
"approved this merge request"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'approv
als
'
))
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'approv
ed
'
))
end
end
def
unapprove_mr
(
noteable
,
user
)
def
unapprove_mr
(
noteable
,
user
)
body
=
"unapproved this merge request"
body
=
"unapproved this merge request"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'
approvals
'
))
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'
unapproved
'
))
end
end
private
private
...
...
app/views/shared/icons/_icon_check.svg
0 → 100644
View file @
051cfe45
<svg
width=
"1792"
height=
"1792"
viewBox=
"0 0 1792 1792"
xmlns=
"http://www.w3.org/2000/svg"
><path
d=
"M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z"
/></svg>
app/views/shared/icons/_icon_fa_close.svg
0 → 100644
View file @
051cfe45
<svg
width=
"1792"
height=
"1792"
viewBox=
"0 0 1792 1792"
xmlns=
"http://www.w3.org/2000/svg"
><path
d=
"M1490 1322q0 40-28 68l-136 136q-28 28-68 28t-68-28l-294-294-294 294q-28 28-68 28t-68-28l-136-136q-28-28-28-68t28-68l294-294-294-294q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 294 294-294q28-28 68-28t68 28l136 136q28 28 28 68t-28 68l-294 294 294 294q28 28 28 68z"
/></svg>
spec/services/system_note_service_spec.rb
View file @
051cfe45
...
@@ -807,7 +807,7 @@ describe SystemNoteService, services: true do
...
@@ -807,7 +807,7 @@ describe SystemNoteService, services: true do
subject
{
described_class
.
approve_mr
(
noteable
,
author
)
}
subject
{
described_class
.
approve_mr
(
noteable
,
author
)
}
it_behaves_like
'a system note'
do
it_behaves_like
'a system note'
do
let
(
:action
)
{
'approv
als
'
}
let
(
:action
)
{
'approv
ed
'
}
end
end
context
'when merge request approved'
do
context
'when merge request approved'
do
...
@@ -817,6 +817,21 @@ describe SystemNoteService, services: true do
...
@@ -817,6 +817,21 @@ describe SystemNoteService, services: true do
end
end
end
end
describe
'.unapprove_mr'
do
let
(
:noteable
)
{
create
(
:merge_request
,
source_project:
project
)
}
subject
{
described_class
.
unapprove_mr
(
noteable
,
author
)
}
it_behaves_like
'a system note'
do
let
(
:action
)
{
'unapproved'
}
end
context
'when merge request approved'
do
it
'sets the note text'
do
expect
(
subject
.
note
).
to
eq
"unapproved this merge request"
end
end
end
describe
'.change_time_estimate'
do
describe
'.change_time_estimate'
do
subject
{
described_class
.
change_time_estimate
(
noteable
,
project
,
author
)
}
subject
{
described_class
.
change_time_estimate
(
noteable
,
project
,
author
)
}
...
...
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