mirror of
https://github.com/FAUSheppy/atlantis-event-dispatcher
synced 2025-12-07 15:01:36 +01:00
fix: correctly confirm all relevant dispatches
..and not just the first
This commit is contained in:
@@ -66,13 +66,16 @@ def get_dispatch():
|
|||||||
|
|
||||||
# accumulate messages by person #
|
# accumulate messages by person #
|
||||||
dispatch_by_person = dict()
|
dispatch_by_person = dict()
|
||||||
|
dispatch_secrets = []
|
||||||
for dobj in dispatch_objects:
|
for dobj in dispatch_objects:
|
||||||
if dobj.username not in dispatch_by_person:
|
if dobj.username not in dispatch_by_person:
|
||||||
dispatch_by_person.update({ dobj.username : dobj.message })
|
dispatch_by_person.update({ dobj.username : dobj.message })
|
||||||
|
dispatch_secrets.append(dobj.dispatch_secret)
|
||||||
else:
|
else:
|
||||||
dispatch_by_person[dobj.username] += "\n{}".format(dobj.message)
|
dispatch_by_person[dobj.username] += "\n{}".format(dobj.message)
|
||||||
|
dispatch_secrets.append(dobj.dispatch_secret)
|
||||||
|
|
||||||
response = [ { "person" : tupel[0], "message" : tupel[1], "method" : method, "uid" : dobj.dispatch_secret }
|
response = [ { "person" : tupel[0], "message" : tupel[1], "method" : method, "uids" : dispatch_secrets }
|
||||||
for tupel in dispatch_by_person.items() ]
|
for tupel in dispatch_by_person.items() ]
|
||||||
|
|
||||||
return flask.jsonify(response)
|
return flask.jsonify(response)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
user = entry["person"]
|
user = entry["person"]
|
||||||
message = entry["message"]
|
message = entry["message"]
|
||||||
uid = entry["uid"]
|
uid_list = entry["uids"]
|
||||||
|
|
||||||
# send message #
|
# send message #
|
||||||
if entry["method"] == "signal":
|
if entry["method"] == "signal":
|
||||||
@@ -60,6 +60,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# confirm dispatch
|
# confirm dispatch
|
||||||
if not args.no_confirm:
|
if not args.no_confirm:
|
||||||
|
for uid in uid_list:
|
||||||
confirm_dispatch(args.target, uid)
|
confirm_dispatch(args.target, uid)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user