Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LA-1358: Add validation for names ending with dot in workspace, workgroup, and folder for creation/editing #966

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/presentation/util/extensions/linshare_node_type_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ extension LinShareNodeTypeExtension on LinShareNodeType {
return AppLocalizations.of(context).node_name_already_exists(AppLocalizations.of(context).workgroup);
} else if (exception is SpecialCharacterException) {
return AppLocalizations.of(context).node_name_contain_special_character(AppLocalizations.of(context).workgroup);
} else if (exception is LastDotException) {
return AppLocalizations.of(context).node_name_contain_last_dot(
AppLocalizations.of(context).workgroup);

} else {
return null;
}
Expand All @@ -67,6 +71,9 @@ extension LinShareNodeTypeExtension on LinShareNodeType {
return AppLocalizations.of(context).node_name_already_exists(AppLocalizations.of(context).workspace);
} else if (exception is SpecialCharacterException) {
return AppLocalizations.of(context).node_name_contain_special_character(AppLocalizations.of(context).workspace);
} else if (exception is LastDotException) {
return AppLocalizations.of(context).node_name_contain_last_dot(
AppLocalizations.of(context).workspace);
} else {
return null;
}
Expand All @@ -86,12 +93,14 @@ extension LinShareNodeTypeExtension on LinShareNodeType {
return [
EmptyNameValidator(),
DuplicateNameValidator(sharedSpaceNodes.map((node) => node.name).toList()),
SpecialCharacterValidator()
SpecialCharacterValidator(),
LastDotValidator()
];
case LinShareNodeType.WORK_SPACE:
return [
EmptyNameValidator(),
SpecialCharacterValidator()
SpecialCharacterValidator(),
LastDotValidator()
];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ class SharedSpaceDocumentNodeViewModel extends BaseViewModel {
EmptyNameValidator(),
DuplicateNameValidator(listName),
SpecialCharacterValidator(),
if (workGroupNode is WorkGroupDocument) LastDotValidator()
LastDotValidator()
]).fold((failure) {
if (failure is VerifyNameFailure) {
final nodeName = workGroupNode is WorkGroupDocument
Expand Down
Loading