Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "hotfix os import" #240

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions server/tasks/lark/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@
from urllib.parse import urlparse

from celery_app import app, celery
from model.schema import ChatGroup, CodeApplication, Repo, Team, db
from model.schema import (
ChatGroup,
CodeApplication,
CodeUser,
IMUser,
Repo,
Team,
TeamMember,
db,
)
from model.team import get_code_users_by_openid
from tasks.github.issue import on_issue_opened
from tasks.github.pull_request import on_pull_request_opened
from sqlalchemy.orm import aliased
from tasks.lark.issue import replace_im_name_to_github_name
from tasks.lark.manage import send_manage_fail_message
from utils.github.repo import GitHubAppRepo
from utils.lark.chat_manual import ChatManual, ChatView
from utils.lark.chat_tip_failed import ChatTipFailed
from utils.lark.issue_card import IssueCard
from utils.lark.post_message import post_content_to_markdown

from .base import (
Expand Down Expand Up @@ -284,10 +292,12 @@ def create_issue(
# 这里连三个表查询,所以一次性都查出来
code_users = get_code_users_by_openid([openid] + users)

import tasks

if openid not in code_users:
host = os.environ.get("DOMAIN")

return send_manage_fail_message(
return tasks.send_manage_fail_message(
f"[请点击绑定 GitHub 账号后重试]({host}/api/github/oauth)",
app_id,
message_id,
Expand Down Expand Up @@ -445,10 +455,12 @@ def sync_issue(
# 这里连三个表查询,所以一次性都查出来
code_users = get_code_users_by_openid([openid])

import tasks

if openid not in code_users:
host = os.environ.get("DOMAIN")

return send_manage_fail_message(
return tasks.send_manage_fail_message(
f"[请点击绑定 GitHub 账号后重试]({host}/api/github/oauth)",
app_id,
message_id,
Expand All @@ -470,7 +482,7 @@ def sync_issue(
if is_pr:
pull_request = github_app.get_one_pull_request(team.name, repo.name, issue_id)
logging.debug("get_one_pull_requrst %r", pull_request)
return on_pull_request_opened(
return tasks.on_pull_request_opened(
{
"action": "opened",
"sender": pull_request["user"],
Expand All @@ -481,7 +493,7 @@ def sync_issue(
else:
issue = github_app.get_one_issue(team.name, repo.name, issue_id)
logging.debug("get_one_issue %r", issue)
return on_issue_opened(
return tasks.on_issue_opened(
{
"action": "opened",
"sender": issue["user"],
Expand Down
Loading