[Rt-commit] rt branch, 5.0/require-article-name, created. rt-5.0.0-11-gfea9729192
Aaron Trevena
ast at bestpractical.com
Thu Sep 10 07:18:26 EDT 2020
The branch, 5.0/require-article-name has been created
at fea97291925e116d291540e31c2da19cde979b8e (commit)
- Log -----------------------------------------------------------------
commit 5e37a8b03772a88038ac1614426c9867a9932b99
Author: Aaron Trevena <ast at bestpractical.com>
Date: Thu Sep 3 15:57:37 2020 +0100
Require Name field when creating or editing Article
Articles with empty name fields cause a problem with re-submission
and duplicate content when creating a ticket with that article.
diff --git a/lib/RT/Article.pm b/lib/RT/Article.pm
index af1e628784..443e44dbf0 100644
--- a/lib/RT/Article.pm
+++ b/lib/RT/Article.pm
@@ -114,6 +114,9 @@ sub Create {
return ( 0, $self->loc("Permission Denied") );
}
+ return ( undef, $self->loc('Name is required') )
+ unless ($args{Name} =~ /\S/);
+
return ( undef, $self->loc('Name in use') )
unless $self->ValidateName( $args{'Name'} );
commit fea97291925e116d291540e31c2da19cde979b8e
Author: Aaron Trevena <ast at bestpractical.com>
Date: Thu Sep 10 12:17:40 2020 +0100
Update tests to provide required name field for articles
diff --git a/t/web/search_linkdisplay.t b/t/web/search_linkdisplay.t
index 8d18f547ad..794369e38d 100644
--- a/t/web/search_linkdisplay.t
+++ b/t/web/search_linkdisplay.t
@@ -31,7 +31,7 @@ my $class = RT::Class->new( RT->SystemUser );
ok ($id, $msg);
my $article = RT::Article->new( RT->SystemUser );
-($id, $msg) = $article->Create( Class => $class->Name, Summary => 'Test Article' );
+($id, $msg) = $article->Create( Class => $class->Name, Summary => 'Test Article', Name => 'Test' );
ok ($id, $msg);
$article->Load($id);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list