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,