Add very preliminary support for commits.

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

@ -77,15 +77,18 @@ def main():
print(data)
print
taskexists = True
exists = True
try:
tasksearch = phab.transaction.search(objectIdentifier=data["object"]["phid"])["data"]
search = phab.transaction.search(objectIdentifier=data["object"]["phid"])["data"]
except http.client.HTTPException:
taskexists = False
exists = False
if taskexists:
print("Task exists, checking to see if it's new.")
newtask = isnewtask(tasksearch)
if exists:
print("Object exists, checking to see if it's a task or a commit.")
if data["object"]["type"] == "TASK":
print("This is a task. Checking if it's new.")
newtask = isnewtask(search)
if newtask:
print("Yes, it's a new task.")
else:
@ -98,7 +101,7 @@ def main():
if not newtask:
commentid = None
edited = False
for task in tasksearch:
for task in search:
dataepoch = data["action"]["epoch"]
datemodified = task["dateModified"]
# All comments within ten seconds of the request are fair game
@ -118,7 +121,7 @@ def main():
if comment or edited or newtask:
# 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"]
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
print(message)
sendnotice(message)
elif data["object"]["type"] == "CMIT":
print("It's a commit!")
return "OK"

Loading…
Cancel
Save