Commit 006c163b authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'repository-name-emojis' into 'master'

Added ability to put emojis into repository name

## Are there points in the code the reviewer needs to double check?

Ensure that regexp used is correct, I used the following list: http://www.unicode.org/Public/emoji/1.0/emoji-data.txt

See merge request !7420
parents b44237f5 af941732
---
title: Added ability to put emojis into repository name
merge_request: 7420
author: Vincent Composieux
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
# #
production: production:
adapter: mysql2 adapter: mysql2
encoding: utf8 encoding: utf8mb4
collation: utf8_general_ci collation: utf8mb4_general_ci
reconnect: false reconnect: false
database: gitlabhq_production database: gitlabhq_production
pool: 10 pool: 10
...@@ -18,8 +18,8 @@ production: ...@@ -18,8 +18,8 @@ production:
# #
development: development:
adapter: mysql2 adapter: mysql2
encoding: utf8 encoding: utf8mb4
collation: utf8_general_ci collation: utf8mb4_general_ci
reconnect: false reconnect: false
database: gitlabhq_development database: gitlabhq_development
pool: 5 pool: 5
...@@ -32,8 +32,8 @@ development: ...@@ -32,8 +32,8 @@ development:
# Do not set this db to the same as development or production. # Do not set this db to the same as development or production.
test: &test test: &test
adapter: mysql2 adapter: mysql2
encoding: utf8 encoding: utf8mb4
collation: utf8_general_ci collation: utf8mb4_general_ci
reconnect: false reconnect: false
database: gitlabhq_test database: gitlabhq_test
pool: 5 pool: 5
......
...@@ -14,8 +14,8 @@ There are two ways to create a new project in GitLab. ...@@ -14,8 +14,8 @@ There are two ways to create a new project in GitLab.
1. Fill out the information: 1. Fill out the information:
1. "Project name" is the name of your project (you can't use spaces, but you 1. "Project name" is the name of your project (you can't use special characters,
can use hyphens or underscores). but you can use spaces, hyphens, underscores or even emojis).
1. The "Project description" is optional and will be shown in your project's 1. The "Project description" is optional and will be shown in your project's
dashboard so others can briefly understand what your project is about. dashboard so others can briefly understand what your project is about.
1. Select a [visibility level](../public_access/public_access.md). 1. Select a [visibility level](../public_access/public_access.md).
......
...@@ -26,12 +26,12 @@ module Gitlab ...@@ -26,12 +26,12 @@ module Gitlab
end end
def project_name_regex def project_name_regex
@project_name_regex ||= /\A[\p{Alnum}_][\p{Alnum}\p{Pd}_\. ]*\z/.freeze @project_name_regex ||= /\A[\p{Alnum}\u{00A9}-\u{1f9c0}_][\p{Alnum}\p{Pd}\u{00A9}-\u{1f9c0}_\. ]*\z/.freeze
end end
def project_name_regex_message def project_name_regex_message
"can contain only letters, digits, '_', '.', dash and space. " \ "can contain only letters, digits, emojis, '_', '.', dash, space. " \
"It must start with letter, digit or '_'." "It must start with letter, digit, emoji or '_'."
end end
def project_path_regex def project_path_regex
......
...@@ -18,7 +18,7 @@ describe 'Edit Project Settings', feature: true do ...@@ -18,7 +18,7 @@ describe 'Edit Project Settings', feature: true do
click_button 'Save changes' click_button 'Save changes'
expect(page).to have_field 'project_name_edit', with: 'foo&bar' expect(page).to have_field 'project_name_edit', with: 'foo&bar'
expect(page).to have_content "Name can contain only letters, digits, '_', '.', dash and space. It must start with letter, digit or '_'." expect(page).to have_content "Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'."
expect(page).to have_button 'Save changes' expect(page).to have_button 'Save changes'
end end
end end
...@@ -34,8 +34,21 @@ describe 'Edit Project Settings', feature: true do ...@@ -34,8 +34,21 @@ describe 'Edit Project Settings', feature: true do
expect(page).to have_field 'Project name', with: 'foo&bar' expect(page).to have_field 'Project name', with: 'foo&bar'
expect(page).to have_field 'Path', with: 'foo&bar' expect(page).to have_field 'Path', with: 'foo&bar'
expect(page).to have_content "Name can contain only letters, digits, '_', '.', dash and space. It must start with letter, digit or '_'." expect(page).to have_content "Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'."
expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'" expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'"
end end
end end
describe 'Rename repository name with emojis' do
it 'shows error for invalid project name' do
visit edit_namespace_project_path(project.namespace, project)
fill_in 'Project name', with: '🚀 foo bar ☁️'
click_button 'Rename project'
expect(page).to have_field 'Project name', with: '🚀 foo bar ☁️'
expect(page).not_to have_content "Name can contain only letters, digits, emojis '_', '.', dash and space. It must start with letter, digit, emoji or '_'."
end
end
end end
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