@@ -9,15 +9,18 @@ use catalyst_types::catalyst_id::CatalystId;
99
1010use crate :: { providers:: CatalystSignedDocumentProvider , CatalystSignedDocument } ;
1111
12+ /// Context for the validation problem report.
13+ const REPORT_CONTEXT : & str = "Document ownership validation" ;
14+
1215/// Returns `true` if the document has a single author.
1316///
1417/// If not, it adds to the document's problem report.
1518fn single_author_check ( doc : & CatalystSignedDocument ) -> bool {
1619 let is_valid = doc. authors ( ) . len ( ) == 1 ;
1720 if !is_valid {
1821 doc. report ( ) . functional_validation (
19- "New document must only be signed by a single author" ,
20- "Valid documents must only be signed by the original author" ,
22+ "Document must only be signed by one author" ,
23+ REPORT_CONTEXT ,
2124 ) ;
2225 }
2326 is_valid
@@ -80,8 +83,8 @@ impl DocumentOwnershipRule {
8083
8184 if !is_valid {
8285 doc. report ( ) . functional_validation (
83- "New document must only be signed by a single author or collaborators defined in the previous version" ,
84- "Valid documents must only be signed by the original author or known collaborators" ,
86+ "Document must only be signed by original author and/or by collaborators defined in the previous version" ,
87+ REPORT_CONTEXT ,
8588 ) ;
8689 }
8790 return Ok ( is_valid) ;
@@ -97,8 +100,8 @@ impl DocumentOwnershipRule {
97100 let is_valid = first_doc. authors ( ) == doc. authors ( ) ;
98101 if !is_valid {
99102 doc. report ( ) . functional_validation (
100- & format ! ( "New document authors must match the authors from the first version for Document ID {doc_id}" ) ,
101- "Valid documents must only be signed by the original author" ,
103+ "Document authors must match the author from the first version" ,
104+ REPORT_CONTEXT ,
102105 ) ;
103106 }
104107 return Ok ( is_valid) ;
0 commit comments