Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Memri
Flutter App for Memri
Commits
6f82060b
Commit
6f82060b
authored
2 years ago
by
Eelco van der Wel
Browse files
Options
Download
Plain Diff
Merge branch 'release-2.1.13' into 'dev'
Release 2.1.13 See merge request
!395
parents
c7952318
23d10b36
Pipeline
#9768
failed with stages
in 6 minutes and 22 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/core/services/gitlab_service.dart
+13
-0
lib/core/services/gitlab_service.dart
lib/providers/project_provider.dart
+5
-0
lib/providers/project_provider.dart
with
18 additions
and
0 deletions
+18
-0
lib/core/services/gitlab_service.dart
+
13
-
0
View file @
6f82060b
...
...
@@ -95,4 +95,17 @@ class GitlabService extends ApiService<GitlabAPI> {
}
return
jobs
;
}
String
stringToGitlabSlug
(
String
s
)
{
// Copied from gitlab 'sluggify' function
// Source: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/utils.rb#L92
String
slug
=
s
.
toLowerCase
();
slug
=
slug
.
replaceAllMapped
(
RegExp
(
'[^a-z0-9]'
),
(
match
)
=
>
'-'
);
slug
=
slug
.
replaceAllMapped
(
RegExp
(
'(
\
A-+|-+
\
z)'
),
(
match
)
=
>
''
);
return
slug
;
}
bool
isValidGitlabSlug
(
String
s
)
{
return
(
s
==
stringToGitlabSlug
(
s
));
}
}
This diff is collapsed.
Click to expand it.
lib/providers/project_provider.dart
+
5
-
0
View file @
6f82060b
...
...
@@ -192,6 +192,11 @@ class ProjectProvider with ChangeNotifier {
if
(
projectName
.
isEmpty
)
{
errorMessage
=
'Enter a project name'
;
notifyListeners
();
}
else
if
(
!
_gitlabService
.
isValidGitlabSlug
(
projectName
))
{
// TODO have a separate field for gitlab projectname and displayname
errorMessage
=
'Your project name should only contain lowercase letters, numbers, or dashes'
;
notifyListeners
();
}
else
if
(
!
await
projectNameExists
(
projectName
))
{
errorMessage
=
'Project name already exists'
;
notifyListeners
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets