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:
commit
819da53793
@ -215,7 +215,7 @@ class ReviewBot(object):
|
|||||||
# Only duplicate when allow_duplicate and state != new.
|
# Only duplicate when allow_duplicate and state != new.
|
||||||
(not allow_duplicate or r.state == 'new')):
|
(not allow_duplicate or r.state == 'new')):
|
||||||
del query['cmd']
|
del query['cmd']
|
||||||
self.logger.info('skipped adding duplicate review for {}'.format(
|
self.logger.debug('skipped adding duplicate review for {}'.format(
|
||||||
'/'.join(query.values())))
|
'/'.join(query.values())))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -445,8 +445,12 @@ class ReviewBot(object):
|
|||||||
if request is None:
|
if request is None:
|
||||||
request = self.request
|
request = self.request
|
||||||
kwargs = {'request_id': request.reqid}
|
kwargs = {'request_id': request.reqid}
|
||||||
|
debug_key = '/'.join(kwargs.values())
|
||||||
|
|
||||||
if message is None:
|
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)
|
message = '\n\n'.join(self.comment_handler.lines)
|
||||||
|
|
||||||
info = {'state': state, 'result': result}
|
info = {'state': state, 'result': result}
|
||||||
@ -454,7 +458,6 @@ class ReviewBot(object):
|
|||||||
|
|
||||||
comments = self.comment_api.get_comments(**kwargs)
|
comments = self.comment_api.get_comments(**kwargs)
|
||||||
comment, _ = self.comment_api.comment_find(comments, self.bot_name, info)
|
comment, _ = self.comment_api.comment_find(comments, self.bot_name, info)
|
||||||
debug_key = '/'.join(kwargs.values())
|
|
||||||
if (comment is not None and
|
if (comment is not None and
|
||||||
((identical and comment['comment'] == message) or
|
((identical and comment['comment'] == message) or
|
||||||
(not identical and comment['comment'].count('\n') == message.count('\n')))
|
(not identical and comment['comment'].count('\n') == message.count('\n')))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user