fix: correctly confirm all relevant dispatches

..and not just the first
This commit is contained in:
2023-07-15 14:08:10 +02:00
parent b2dfb4a1a7
commit 63469b013c
2 changed files with 7 additions and 3 deletions

View File

@@ -66,13 +66,16 @@ def get_dispatch():
# accumulate messages by person #
dispatch_by_person = dict()
dispatch_secrets = []
for dobj in dispatch_objects:
if dobj.username not in dispatch_by_person:
dispatch_by_person.update({ dobj.username : dobj.message })
dispatch_secrets.append(dobj.dispatch_secret)
else:
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() ]
return flask.jsonify(response)

View File

@@ -50,7 +50,7 @@ if __name__ == "__main__":
user = entry["person"]
message = entry["message"]
uid = entry["uid"]
uid_list = entry["uids"]
# send message #
if entry["method"] == "signal":
@@ -60,6 +60,7 @@ if __name__ == "__main__":
# confirm dispatch
if not args.no_confirm:
for uid in uid_list:
confirm_dispatch(args.target, uid)
sys.exit(0)