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
3194b956
Commit
3194b956
authored
Jul 05, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE-specific lines from SystemNoteService
parent
88e5699f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
106 deletions
+105
-106
app/services/system_note_service.rb
app/services/system_note_service.rb
+0
-105
ee/app/services/ee/system_note_service.rb
ee/app/services/ee/system_note_service.rb
+105
-1
No files found.
app/services/system_note_service.rb
View file @
3194b956
...
...
@@ -527,111 +527,6 @@ module SystemNoteService
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'moved'
))
end
#
# noteable - Noteable object
# noteable_ref - Referenced noteable object
# user - User performing reference
#
# Example Note text:
#
# "marked this issue as related to gitlab-ce#9001"
#
# Returns the created Note object
def
relate_issue
(
noteable
,
noteable_ref
,
user
)
body
=
"marked this issue as related to
#{
noteable_ref
.
to_reference
(
noteable
.
project
)
}
"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'relate'
))
end
#
# noteable - Noteable object
# noteable_ref - Referenced noteable object
# user - User performing reference
#
# Example Note text:
#
# "removed the relation with gitlab-ce#9001"
#
# Returns the created Note object
def
unrelate_issue
(
noteable
,
noteable_ref
,
user
)
body
=
"removed the relation with
#{
noteable_ref
.
to_reference
(
noteable
.
project
)
}
"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'unrelate'
))
end
def
epic_issue
(
epic
,
issue
,
user
,
type
)
return
unless
validate_epic_issue_action_type
(
type
)
action
=
type
==
:added
?
'epic_issue_added'
:
'epic_issue_removed'
body
=
"
#{
type
}
issue
#{
issue
.
to_reference
(
epic
.
group
)
}
"
create_note
(
NoteSummary
.
new
(
epic
,
nil
,
user
,
body
,
action:
action
))
end
def
epic_issue_moved
(
from_epic
,
issue
,
to_epic
,
user
)
epic_issue_moved_act
(
from_epic
,
issue
,
to_epic
,
user
,
verb:
'added'
,
direction:
'from'
)
epic_issue_moved_act
(
to_epic
,
issue
,
from_epic
,
user
,
verb:
'moved'
,
direction:
'to'
)
end
def
epic_issue_moved_act
(
subject_epic
,
issue
,
object_epic
,
user
,
verb
:,
direction
:)
action
=
'epic_issue_moved'
body
=
"
#{
verb
}
issue
#{
issue
.
to_reference
(
subject_epic
.
group
)
}
#{
direction
}
"
\
" epic
#{
subject_epic
.
to_reference
(
object_epic
.
group
)
}
"
create_note
(
NoteSummary
.
new
(
object_epic
,
nil
,
user
,
body
,
action:
action
))
end
def
issue_on_epic
(
issue
,
epic
,
user
,
type
)
return
unless
validate_epic_issue_action_type
(
type
)
if
type
==
:added
direction
=
'to'
action
=
'issue_added_to_epic'
else
direction
=
'from'
action
=
'issue_removed_from_epic'
end
body
=
"
#{
type
}
#{
direction
}
epic
#{
epic
.
to_reference
(
issue
.
project
)
}
"
create_note
(
NoteSummary
.
new
(
issue
,
issue
.
project
,
user
,
body
,
action:
action
))
end
def
issue_epic_change
(
issue
,
epic
,
user
)
body
=
"changed epic to
#{
epic
.
to_reference
(
issue
.
project
)
}
"
action
=
'issue_changed_epic'
create_note
(
NoteSummary
.
new
(
issue
,
issue
.
project
,
user
,
body
,
action:
action
))
end
def
validate_epic_issue_action_type
(
type
)
[
:added
,
:removed
].
include?
(
type
)
end
# Called when the merge request is approved by user
#
# noteable - Noteable object
# user - User performing approve
#
# Example Note text:
#
# "approved this merge request"
#
# Returns the created Note object
def
approve_mr
(
noteable
,
user
)
body
=
"approved this merge request"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'approved'
))
end
def
unapprove_mr
(
noteable
,
user
)
body
=
"unapproved this merge request"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'unapproved'
))
end
# Called when a Noteable has been marked as a duplicate of another Issue
#
# noteable - Noteable object
...
...
ee/app/services/ee/system_note_service.rb
View file @
3194b956
...
...
@@ -6,6 +6,111 @@ module EE
module
SystemNoteService
extend
self
#
# noteable - Noteable object
# noteable_ref - Referenced noteable object
# user - User performing reference
#
# Example Note text:
#
# "marked this issue as related to gitlab-ce#9001"
#
# Returns the created Note object
def
relate_issue
(
noteable
,
noteable_ref
,
user
)
body
=
"marked this issue as related to
#{
noteable_ref
.
to_reference
(
noteable
.
project
)
}
"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'relate'
))
end
#
# noteable - Noteable object
# noteable_ref - Referenced noteable object
# user - User performing reference
#
# Example Note text:
#
# "removed the relation with gitlab-ce#9001"
#
# Returns the created Note object
def
unrelate_issue
(
noteable
,
noteable_ref
,
user
)
body
=
"removed the relation with
#{
noteable_ref
.
to_reference
(
noteable
.
project
)
}
"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'unrelate'
))
end
def
epic_issue
(
epic
,
issue
,
user
,
type
)
return
unless
validate_epic_issue_action_type
(
type
)
action
=
type
==
:added
?
'epic_issue_added'
:
'epic_issue_removed'
body
=
"
#{
type
}
issue
#{
issue
.
to_reference
(
epic
.
group
)
}
"
create_note
(
NoteSummary
.
new
(
epic
,
nil
,
user
,
body
,
action:
action
))
end
def
epic_issue_moved
(
from_epic
,
issue
,
to_epic
,
user
)
epic_issue_moved_act
(
from_epic
,
issue
,
to_epic
,
user
,
verb:
'added'
,
direction:
'from'
)
epic_issue_moved_act
(
to_epic
,
issue
,
from_epic
,
user
,
verb:
'moved'
,
direction:
'to'
)
end
def
epic_issue_moved_act
(
subject_epic
,
issue
,
object_epic
,
user
,
verb
:,
direction
:)
action
=
'epic_issue_moved'
body
=
"
#{
verb
}
issue
#{
issue
.
to_reference
(
subject_epic
.
group
)
}
#{
direction
}
"
\
" epic
#{
subject_epic
.
to_reference
(
object_epic
.
group
)
}
"
create_note
(
NoteSummary
.
new
(
object_epic
,
nil
,
user
,
body
,
action:
action
))
end
def
issue_on_epic
(
issue
,
epic
,
user
,
type
)
return
unless
validate_epic_issue_action_type
(
type
)
if
type
==
:added
direction
=
'to'
action
=
'issue_added_to_epic'
else
direction
=
'from'
action
=
'issue_removed_from_epic'
end
body
=
"
#{
type
}
#{
direction
}
epic
#{
epic
.
to_reference
(
issue
.
project
)
}
"
create_note
(
NoteSummary
.
new
(
issue
,
issue
.
project
,
user
,
body
,
action:
action
))
end
def
issue_epic_change
(
issue
,
epic
,
user
)
body
=
"changed epic to
#{
epic
.
to_reference
(
issue
.
project
)
}
"
action
=
'issue_changed_epic'
create_note
(
NoteSummary
.
new
(
issue
,
issue
.
project
,
user
,
body
,
action:
action
))
end
def
validate_epic_issue_action_type
(
type
)
[
:added
,
:removed
].
include?
(
type
)
end
# Called when the merge request is approved by user
#
# noteable - Noteable object
# user - User performing approve
#
# Example Note text:
#
# "approved this merge request"
#
# Returns the created Note object
def
approve_mr
(
noteable
,
user
)
body
=
"approved this merge request"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'approved'
))
end
def
unapprove_mr
(
noteable
,
user
)
body
=
"unapproved this merge request"
create_note
(
NoteSummary
.
new
(
noteable
,
noteable
.
project
,
user
,
body
,
action:
'unapproved'
))
end
# Called when the weight of a Noteable is changed
#
# noteable - Noteable object
...
...
@@ -19,7 +124,6 @@ module EE
# "changed weight to 4"
#
# Returns the created Note object
def
change_weight_note
(
noteable
,
project
,
author
)
body
=
noteable
.
weight
?
"changed weight to **
#{
noteable
.
weight
}
**"
:
'removed the weight'
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'weight'
))
...
...
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