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
d5cfc015
Commit
d5cfc015
authored
Jul 03, 2019
by
Timothy Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle all approval messages in merge chat message
parent
b4f8e281
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
3 deletions
+56
-3
ee/app/models/project_services/ee/chat_message/merge_message.rb
.../models/project_services/ee/chat_message/merge_message.rb
+10
-1
ee/changelogs/unreleased/11495-chat-mr-approval-messages.yml
ee/changelogs/unreleased/11495-chat-mr-approval-messages.yml
+5
-0
ee/spec/models/project_services/chat_message/merge_message_spec.rb
...odels/project_services/chat_message/merge_message_spec.rb
+41
-2
No files found.
ee/app/models/project_services/ee/chat_message/merge_message.rb
View file @
d5cfc015
...
...
@@ -18,7 +18,16 @@ module EE
override
:state_or_action_text
def
state_or_action_text
action
==
'approved'
?
action
:
super
case
action
when
'approved'
,
'unapproved'
action
when
'approval'
'added their approval to'
when
'unapproval'
'removed their approval from'
else
super
end
end
end
end
...
...
ee/changelogs/unreleased/11495-chat-mr-approval-messages.yml
0 → 100644
View file @
d5cfc015
---
title
:
Add support for partial approval in chat message merge request event handler
merge_request
:
author
:
type
:
fixed
ee/spec/models/project_services/chat_message/merge_message_spec.rb
View file @
d5cfc015
...
...
@@ -27,16 +27,55 @@ RSpec.describe ChatMessage::MergeMessage do
}
end
context
'approv
al
'
do
context
'approv
ed
'
do
before
do
args
[
:object_attributes
][
:action
]
=
'approved'
end
it
'returns a message regarding approval of merge requests'
do
it
'returns a message regarding
completed
approval of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
'Test User (test.user) approved <http://somewhere.com/merge_requests/100|!100 *Merge Request title*> '
\
'in <http://somewhere.com|project_name>'
)
expect
(
subject
.
attachments
).
to
be_empty
end
end
context
'unapproved'
do
before
do
args
[
:object_attributes
][
:action
]
=
'unapproved'
end
it
'returns a message regarding revocation of completed approval of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
'Test User (test.user) unapproved <http://somewhere.com/merge_requests/100|!100 *Merge Request title*> '
\
'in <http://somewhere.com|project_name>'
)
expect
(
subject
.
attachments
).
to
be_empty
end
end
context
'approval'
do
before
do
args
[
:object_attributes
][
:action
]
=
'approval'
end
it
'returns a message regarding added approval of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
'Test User (test.user) added their approval to <http://somewhere.com/merge_requests/100|!100 *Merge Request title*> '
\
'in <http://somewhere.com|project_name>'
)
expect
(
subject
.
attachments
).
to
be_empty
end
end
context
'unapproval'
do
before
do
args
[
:object_attributes
][
:action
]
=
'unapproval'
end
it
'returns a message regarding revoking approval of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
'Test User (test.user) removed their approval from <http://somewhere.com/merge_requests/100|!100 *Merge Request title*> '
\
'in <http://somewhere.com|project_name>'
)
expect
(
subject
.
attachments
).
to
be_empty
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