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
6f466acc
Commit
6f466acc
authored
Apr 01, 2020
by
George Koltsov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow award emoji to have same name and user_id when Importing
parent
adb7969e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
app/models/award_emoji.rb
app/models/award_emoji.rb
+1
-1
changelogs/unreleased/georgekoltsov-fix-award-emojis-import-export.yml
...released/georgekoltsov-fix-award-emojis-import-export.yml
+5
-0
spec/models/award_emoji_spec.rb
spec/models/award_emoji_spec.rb
+16
-0
No files found.
app/models/award_emoji.rb
View file @
6f466acc
...
...
@@ -15,7 +15,7 @@ class AwardEmoji < ApplicationRecord
validates
:awardable
,
presence:
true
,
unless: :importing?
validates
:name
,
presence:
true
,
inclusion:
{
in:
Gitlab
::
Emoji
.
emojis_names
}
validates
:name
,
uniqueness:
{
scope:
[
:user
,
:awardable_type
,
:awardable_id
]
},
unless:
:ghost_user?
validates
:name
,
uniqueness:
{
scope:
[
:user
,
:awardable_type
,
:awardable_id
]
},
unless:
->
{
ghost_user?
||
importing?
}
participant
:user
...
...
changelogs/unreleased/georgekoltsov-fix-award-emojis-import-export.yml
0 → 100644
View file @
6f466acc
---
title
:
Allow award emoji same name & user duplicates when Importing
merge_request
:
28588
author
:
type
:
fixed
spec/models/award_emoji_spec.rb
View file @
6f466acc
...
...
@@ -41,6 +41,22 @@ describe AwardEmoji do
expect
(
new_award
).
to
be_valid
end
# Similar to allowing duplicate award emojis for ghost users,
# when Importing a project that has duplicate award emoji placed by
# ghost user we change the author to be importer user and allow
# duplicates, otherwise relation containing such duplicates
# fails to be created
context
'when importing'
do
it
'allows duplicate award emoji'
do
user
=
create
(
:user
)
issue
=
create
(
:issue
)
create
(
:award_emoji
,
user:
user
,
awardable:
issue
)
new_award
=
build
(
:award_emoji
,
user:
user
,
awardable:
issue
,
importing:
true
)
expect
(
new_award
).
to
be_valid
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