~patchwork-devs/patchwork/patchwork

« back to all changes in this revision

Viewing changes to patchwork/parser.py

  • Committer: Stephen Finucane
  • Date: 2021-10-28 10:43:35 UTC
  • Revision ID: git-v1:f5cd52144cd4cbd0dd2c9cbcecdb90e6d25cbc17
parser: Add 'X-Patchwork-Action-Required' header

Allow submitters to indicate that their comment is something that needs
to be addressed.

Some minors issues are addressed in the docs while we're here.

Signed-off-by: Stephen Finucane <stephen@that.guru>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1019
1019
    return None
1020
1020
 
1021
1021
 
 
1022
def find_comment_addressed_by_header(mail):
 
1023
    """Determine whether a comment is actionable or not."""
 
1024
    # we dispose of the value - it's irrelevant
 
1025
    return False if 'X-Patchwork-Action-Required' in mail else None
 
1026
 
 
1027
 
1022
1028
def parse_mail(mail, list_id=None):
1023
1029
    """Parse a mail and add to the database.
1024
1030
 
1278
1284
    patch = find_patch_for_comment(project, refs)
1279
1285
    if patch:
1280
1286
        author = get_or_create_author(mail, project)
 
1287
        addressed = find_comment_addressed_by_header(mail)
1281
1288
 
1282
1289
        with transaction.atomic():
1283
1290
            if PatchComment.objects.filter(patch=patch, msgid=msgid):
1288
1295
                date=date,
1289
1296
                headers=headers,
1290
1297
                submitter=author,
1291
 
                content=message)
 
1298
                content=message,
 
1299
                addressed=addressed)
1292
1300
 
1293
1301
        logger.debug('Comment saved')
1294
1302