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
6fba4972
Commit
6fba4972
authored
Mar 26, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish status page on emoji add
parent
81fd784b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
1 deletion
+64
-1
app/services/award_emojis/add_service.rb
app/services/award_emojis/add_service.rb
+7
-1
ee/app/services/ee/award_emojis/add_service.rb
ee/app/services/ee/award_emojis/add_service.rb
+18
-0
ee/spec/services/award_emojis/add_service_spec.rb
ee/spec/services/award_emojis/add_service_spec.rb
+39
-0
No files found.
app/services/award_emojis/add_service.rb
View file @
6fba4972
...
...
@@ -16,7 +16,7 @@ module AwardEmojis
award
=
awardable
.
award_emoji
.
create
(
name:
name
,
user:
current_user
)
if
award
.
persisted?
TodoService
.
new
.
new_award_emoji
(
todoable
,
current_user
)
if
todoable
after_create
(
award
)
success
(
award:
award
)
else
error
(
award
.
errors
.
full_messages
,
award:
award
)
...
...
@@ -25,6 +25,10 @@ module AwardEmojis
private
def
after_create
(
award
)
TodoService
.
new
.
new_award_emoji
(
todoable
,
current_user
)
if
todoable
end
def
todoable
strong_memoize
(
:todoable
)
do
case
awardable
...
...
@@ -40,3 +44,5 @@ module AwardEmojis
end
end
end
AwardEmojis
::
AddService
.
prepend_if_ee
(
'EE::AwardEmojis::AddService'
)
ee/app/services/ee/award_emojis/add_service.rb
0 → 100644
View file @
6fba4972
# frozen_string_literal: true
module
EE
module
AwardEmojis
module
AddService
extend
::
Gitlab
::
Utils
::
Override
private
override
:after_create
def
after_create
(
award
)
super
StatusPage
.
trigger_publish
(
project
,
current_user
,
award
)
end
end
end
end
ee/spec/services/award_emojis/add_service_spec.rb
0 → 100644
View file @
6fba4972
# frozen_string_literal: true
require
'spec_helper'
describe
AwardEmojis
::
AddService
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:awardable
)
{
create
(
:note_on_issue
,
project:
project
)
}
let
(
:name
)
{
'thumbsup'
}
subject
(
:service
)
{
described_class
.
new
(
awardable
,
name
,
user
)
}
describe
'#execute'
do
describe
'publish to status page'
do
let
(
:execute
)
{
service
.
execute
}
let
(
:issue_id
)
{
awardable
.
noteable_id
}
context
'when adding succeeds'
do
context
'with recognized emoji'
do
let
(
:name
)
{
StatusPage
::
AWARD_EMOJI
}
include_examples
'trigger status page publish'
end
context
'with unrecognized emoji'
do
let
(
:name
)
{
'x'
}
include_examples
'no trigger status page publish'
end
end
context
'when adding fails'
do
let
(
:name
)
{
''
}
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