Merge pull request #1114 from jberry-suse/ReviewBot-comment_write-skip-empty

ReviewBot: comment_write(): skip posting empty comments extracted from handler.
This commit is contained in:
Jimmy Berry 2017-08-31 11:51:38 -05:00 committed by GitHub
commit 819da53793

View File

@ -215,7 +215,7 @@ class ReviewBot(object):
# Only duplicate when allow_duplicate and state != new.
(not allow_duplicate or r.state == 'new')):
del query['cmd']
self.logger.info('skipped adding duplicate review for {}'.format(
self.logger.debug('skipped adding duplicate review for {}'.format(
'/'.join(query.values())))
return
@ -445,8 +445,12 @@ class ReviewBot(object):
if request is None:
request = self.request
kwargs = {'request_id': request.reqid}
debug_key = '/'.join(kwargs.values())
if message is None:
if not len(self.comment_handler.lines):
self.logger.debug('skipping empty comment for {}'.format(debug_key))
return
message = '\n\n'.join(self.comment_handler.lines)
info = {'state': state, 'result': result}
@ -454,7 +458,6 @@ class ReviewBot(object):
comments = self.comment_api.get_comments(**kwargs)
comment, _ = self.comment_api.comment_find(comments, self.bot_name, info)
debug_key = '/'.join(kwargs.values())
if (comment is not None and
((identical and comment['comment'] == message) or
(not identical and comment['comment'].count('\n') == message.count('\n')))