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
8a480473
Commit
8a480473
authored
Mar 24, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish status page on note update
parent
fc00774e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
0 deletions
+74
-0
app/services/notes/update_service.rb
app/services/notes/update_service.rb
+2
-0
ee/app/services/ee/notes/update_service.rb
ee/app/services/ee/notes/update_service.rb
+20
-0
ee/spec/services/ee/notes/update_service_spec.rb
ee/spec/services/ee/notes/update_service_spec.rb
+52
-0
No files found.
app/services/notes/update_service.rb
View file @
8a480473
...
...
@@ -81,3 +81,5 @@ module Notes
end
end
end
Notes
::
UpdateService
.
prepend_if_ee
(
'EE::Notes::UpdateService'
)
ee/app/services/ee/notes/update_service.rb
0 → 100644
View file @
8a480473
# frozen_string_literal: true
module
EE
module
Notes
module
UpdateService
extend
::
Gitlab
::
Utils
::
Override
override
:execute
def
execute
(
note
)
updated_note
=
super
if
updated_note
&
.
errors
&
.
empty?
StatusPage
.
trigger_publish
(
project
,
current_user
,
updated_note
)
end
updated_note
end
end
end
end
ee/spec/services/ee/notes/update_service_spec.rb
0 → 100644
View file @
8a480473
# frozen_string_literal: true
require
'spec_helper'
describe
Notes
::
UpdateService
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:note
,
refind:
true
)
do
create
(
:note_on_issue
,
project:
project
,
author:
user
)
end
subject
(
:service
)
{
described_class
.
new
(
project
,
user
,
opts
)
}
describe
'#execute'
do
let
(
:opts
)
{
{
note:
note_text
}
}
describe
'publish to status page'
do
let
(
:execute
)
{
service
.
execute
(
note
)
}
let
(
:issue_id
)
{
note
.
noteable_id
}
let
(
:emoji_name
)
{
StatusPage
::
AWARD_EMOJI
}
before
do
create
(
:award_emoji
,
user:
user
,
name:
emoji_name
,
awardable:
note
)
end
context
'for text-only update'
do
let
(
:note_text
)
{
'text'
}
include_examples
'trigger status page publish'
context
'without recognized emoji'
do
let
(
:emoji_name
)
{
'thumbsup'
}
include_examples
'no trigger status page publish'
end
end
context
'for quick action only update'
do
let
(
:note_text
)
{
"/todo
\n
"
}
include_examples
'trigger status page publish'
end
context
'when update fails'
do
let
(
:note_text
)
{
''
}
include_examples
'no trigger status page publish'
end
end
end
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