()
| 65 | } |
| 66 | |
| 67 | func (op *CreateOperation) Validate() error { |
| 68 | if err := op.OpBase.Validate(op, CreateOp); err != nil { |
| 69 | return err |
| 70 | } |
| 71 | |
| 72 | if text.Empty(op.Title) { |
| 73 | return fmt.Errorf("title is empty") |
| 74 | } |
| 75 | if !text.SafeOneLine(op.Title) { |
| 76 | return fmt.Errorf("title has unsafe characters") |
| 77 | } |
| 78 | |
| 79 | if !text.Safe(op.Message) { |
| 80 | return fmt.Errorf("message is not fully printable") |
| 81 | } |
| 82 | |
| 83 | return nil |
| 84 | } |
| 85 | |
| 86 | func NewCreateOp(author identity.Interface, unixTime int64, title, message string, files []repository.Hash) *CreateOperation { |
| 87 | return &CreateOperation{ |
nothing calls this directly
no test coverage detected