Commit 2dff4d95 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '210335-fix-handling-of-numeric-emoji-names' into 'master'

Allow numeric emoji names in validation

Closes #210335

See merge request gitlab-org/gitlab!27101
parents d5a14dff c48418b8
......@@ -41,7 +41,7 @@ class AwardEmojisFinder
def validate_name_param
return unless params[:name]
raise ArgumentError, 'Invalid name param' unless params[:name].in?(Gitlab::Emoji.emojis_names)
raise ArgumentError, 'Invalid name param' unless params[:name].to_s.in?(Gitlab::Emoji.emojis_names)
end
def validate_awarded_by_param
......
---
title: Fix backend validation of numeric emoji names
merge_request: 27101
author:
type: fixed
......@@ -20,6 +20,11 @@ describe AwardEmojisFinder do
)
end
it 'does not raise an error if `name` is numeric' do
subject = described_class.new(issue_1, { name: 100 })
expect { subject.execute }.not_to raise_error
end
it 'raises an error if `awarded_by` is invalid' do
expectation = [ArgumentError, 'Invalid awarded_by param']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment