@@ -8,7 +8,7 @@ use std::collections::HashSet;
88use anyhow:: ensure;
99use catalyst_signed_doc_spec:: {
1010 is_required:: IsRequired ,
11- signers:: update:: { Collaborators , Update } ,
11+ signers:: update:: { Update , UpdatersType } ,
1212 DocSpec ,
1313} ;
1414use catalyst_types:: catalyst_id:: CatalystId ;
@@ -26,7 +26,7 @@ pub(crate) enum DocumentOwnershipRule {
2626 /// Collaborators are allowed, based on the 'ref' metadata field.
2727 RefFieldBased ,
2828 /// Collaborators are not allowed, only original author.
29- WitoutCollaborators ,
29+ OriginalAuthor ,
3030}
3131
3232impl DocumentOwnershipRule {
@@ -35,17 +35,15 @@ impl DocumentOwnershipRule {
3535 spec : & Update ,
3636 doc_spec : & DocSpec ,
3737 ) -> anyhow:: Result < Self > {
38- ensure ! ( spec. author, "'author' field must always be equal to `true`" ) ;
39-
40- match spec. collaborators {
41- Collaborators :: Collaborators => {
38+ match spec. r#type {
39+ UpdatersType :: Collaborators => {
4240 ensure ! (
4341 doc_spec. metadata. collaborators. required != IsRequired :: Excluded ,
4442 "'collaborators' metadata field cannot be 'excluded' if 'update'->'collaborators' is 'collaborators' based"
4543 ) ;
4644 Ok ( Self :: CollaboratorsFieldBased )
4745 } ,
48- Collaborators :: Ref => {
46+ UpdatersType :: Ref => {
4947 ensure ! (
5048 doc_spec. metadata. doc_ref. required == IsRequired :: Yes ,
5149 "'ref' metadata field cannot be 'excluded' or 'optional' if 'update'->'collaborators' is 'ref' based"
@@ -56,7 +54,7 @@ impl DocumentOwnershipRule {
5654 ) ;
5755 Ok ( Self :: RefFieldBased )
5856 } ,
59- Collaborators :: Excluded => Ok ( Self :: WitoutCollaborators ) ,
57+ UpdatersType :: Author => Ok ( Self :: OriginalAuthor ) ,
6058 }
6159 }
6260
0 commit comments