Add very preliminary support for commits.

pull/1/head
Simon Quigley 7 years ago
parent 8d888dea87
commit b7d3569bc7

@ -77,15 +77,18 @@ def main():
print(data) print(data)
print print
taskexists = True exists = True
try: try:
tasksearch = phab.transaction.search(objectIdentifier=data["object"]["phid"])["data"] search = phab.transaction.search(objectIdentifier=data["object"]["phid"])["data"]
except http.client.HTTPException: except http.client.HTTPException:
taskexists = False exists = False
if taskexists: if exists:
print("Task exists, checking to see if it's new.") print("Object exists, checking to see if it's a task or a commit.")
newtask = isnewtask(tasksearch)
if data["object"]["type"] == "TASK":
print("This is a task. Checking if it's new.")
newtask = isnewtask(search)
if newtask: if newtask:
print("Yes, it's a new task.") print("Yes, it's a new task.")
else: else:
@ -98,7 +101,7 @@ def main():
if not newtask: if not newtask:
commentid = None commentid = None
edited = False edited = False
for task in tasksearch: for task in search:
dataepoch = data["action"]["epoch"] dataepoch = data["action"]["epoch"]
datemodified = task["dateModified"] datemodified = task["dateModified"]
# All comments within ten seconds of the request are fair game # All comments within ten seconds of the request are fair game
@ -118,7 +121,7 @@ def main():
if comment or edited or newtask: if comment or edited or newtask:
# We should also know who did this thing # We should also know who did this thing
userlookup = tasksearch[0]["authorPHID"] userlookup = search[0]["authorPHID"]
who = dict(phab.phid.query(phids=[userlookup]))[userlookup]["fullName"] who = dict(phab.phid.query(phids=[userlookup]))[userlookup]["fullName"]
fulltaskname = phab.phid.query(phids=[data["object"]["phid"]])[data["object"]["phid"]]["fullName"] fulltaskname = phab.phid.query(phids=[data["object"]["phid"]])[data["object"]["phid"]]["fullName"]
@ -136,6 +139,8 @@ def main():
message = message + "just created this task: " + link message = message + "just created this task: " + link
print(message) print(message)
sendnotice(message) sendnotice(message)
elif data["object"]["type"] == "CMIT":
print("It's a commit!")
return "OK" return "OK"

Loading…
Cancel
Save