X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Finteraction.py;h=e68aa6f276a7754e60d38a1c73cafbbc70825ec2;hb=9a32366dc4ed1c9ea6e310ad23923b564691a8fa;hp=955fae5b776f15db7222e7a5e3a0cbe81ec4f0c0;hpb=c7213abc1b0c3fcb276284dbd9ba23bb44b5f67a;p=turbot diff --git a/turbot/interaction.py b/turbot/interaction.py index 955fae5..e68aa6f 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -179,6 +179,7 @@ def edit_puzzle_submission(turb, payload, metadata): puzzle['sheet_url'] = meta['sheet_url'] state = payload['view']['state']['values'] + user_id = payload['user']['id'] puzzle['name'] = state['name']['name']['value'] url = state['url']['url']['value'] @@ -238,6 +239,14 @@ def edit_puzzle_submission(turb, payload, metadata): # Update the puzzle in the database turb.table.put_item(Item=puzzle) + # Inform the puzzle channel about the edit + edit_message = "Puzzle edited by <@{}>".format(user_id) + blocks = ([section_block(text_block(edit_message+":\n"))] + + puzzle_blocks(puzzle, include_rounds=True)) + slack_send_message( + turb.slack_client, puzzle['channel_id'], + edit_message, blocks=blocks) + # We need to set the channel topic if any of puzzle name, url, # state, status, or solution, has changed. Let's just do that # unconditionally here.