Search code examples
apostrophe-cms

ApostropheCMS workflow ignore incoming commits


Is there any way to ignore commits from certain pieces or widgets ? Currently , I build a comment pieces and a comment will always appear in live mode of apostrophe workflow. But then , it keeps prompt the button for submit & commit . Is there any way to ignore ? Like .gitignore feature.

Example use case : A public user submitted comment and the piece is maintain published. The piece is always available in live mode and user keep submitting the comments without any problem. But in draft mode , the button to submit & commit is always there. So is there any disable/ignore live changes for not making it to commit/submit ?


Solution

  • Yes, you can use the excludeProperties option of the apostrophe-workflow module to ignore your comments property.

    'apostrophe-workflow': {
      excludeProperties: [ 'comments' ]
    }
    

    That property will then never be considered for purposes of whether a document needs to be committed, and also will never be committed.

    (As I have previously mentioned, the use of an array property for comments is eventually going to bite you, the document will get too big for MongoDB or just impractical to send and receive. You really should joinByArray with a comment piece type instead or something similar, or just use Disqus if the site is open to the public anyway.)