From 6e97cd32bf9697b1835fca629a77d2d5f286a43c Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Wed, 9 Oct 2024 08:33:13 -0500 Subject: [PATCH] actually commit changes (git is weird) --- bridge/__init__.py | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/bridge/__init__.py b/bridge/__init__.py index 3045958..ceb01f6 100644 --- a/bridge/__init__.py +++ b/bridge/__init__.py @@ -139,9 +139,10 @@ def gitea_handle_issue_action(): print(e, type(e)) abort(400) # the data isn't formatted correctly - issue_sentinel_present = issue_sentinel in event_body + if issue_sentinel in event_body: + return '' - if event_type == "opened" and not issue_sentinel_present: + if event_type == "opened": issue_footer = create_signature( issue_user, issue_user_url, @@ -176,7 +177,7 @@ def gitea_handle_issue_action(): issue_comment_body, ) - elif event_type == "created" and not issue_sentinel_present: + elif event_type == "created": comment_user = data["comment"]["user"]["login"] comment_user_url = "https://{}/{}".format( app.config["GITEA_INSTANCE_DOMAIN"], @@ -247,9 +248,10 @@ def github_handle_issue_action(): print(e, type(e)) abort(400) # the data isn't formatted correctly - issue_sentinel_present = issue_sentinel in event_body + if issue_sentinel in event_body: + return '' - if event_type == "opened" and not issue_sentinel_present: + if event_type == "opened": issue_footer = create_signature( issue_user, issue_user_url, @@ -261,29 +263,14 @@ def github_handle_issue_action(): issue_footer ]) - new_issue = gitea.create_issue( + gitea.create_issue( repo_owner, repo_name, event_title, issue_body ) - - returned_data = new_issue.json() - issue_comment_body = create_signature( - "mirrored", - returned_data["html_url"], - app.config["GITEA_INSTANCE_DOMAIN"], - returned_data["url"], - ) - github.leave_comment_on_issue_by_number( - repo_owner, - repo_name, - issue_number, - issue_comment_body, - ) - - elif event_type == "created" and not issue_sentinel_present: + elif event_type == "created": comment_user = data["comment"]["user"]["login"] comment_user_url = "https://github.com/{}".format( comment_user,