Don't send more than 3 commits in one go

This commit is contained in:
jesopo 2018-11-16 20:23:34 +00:00
parent 756c543c32
commit 10c457f524

View file

@ -67,15 +67,13 @@ class Module(ModuleManager.BaseModule):
def push(self, event, full_name, data):
outputs = []
if len(data["commits"]) <= 3:
for commit in data["commits"]:
id = commit["id"]
message = commit["message"].split("\n")
message = [line.strip() for line in message]
message = " ".join(message)
author = "%s <%s>" % (commit["author"]["username"],
commit["author"]["email"])
message = "".join(line.strip() for line in message)
author = commit["author"]["name"] or commit["author"]["login"]
author = utils.irc.bold(author)
url = COMMIT_URL % (full_name, id[:8])
@ -92,7 +90,9 @@ class Module(ModuleManager.BaseModule):
utils.consts.PURPLE)
outputs.append("(%s) [%s/%s/%s files] commit by '%s': %s - %s"
% (full_name, added, removed, modified, author, message, url))
% (full_name, added, removed, modified, author, message,
url))
return outputs