Skip to content

Commit

Permalink
Merge pull request #228 from ConnectAI-E/freeziyou-022102
Browse files Browse the repository at this point in the history
修复 Pr Issue desc 太长
  • Loading branch information
lloydzhou authored Feb 22, 2024
2 parents bfe01c2 + b6fbaed commit 1daf4ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
5 changes: 4 additions & 1 deletion server/tasks/github/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,17 @@ def on_issue_opened(event_dict: dict | None) -> list:
app.logger.info(f"Issue already exists: {issue.id}")
return []

# 限制 body 长度
issue_info.body = issue_info.body[:1000] if issue_info.body else None

# 创建 issue
new_issue = Issue(
id=ObjID.new_id(),
repo_id=repo.id,
issue_number=issue_info.number,
title=issue_info.title,
# TODO 这里超过1024的长度了,暂时不想单纯的增加字段长度,因为飞书那边消息也是有限制的
description=issue_info.body[:1000] if issue_info.body else None,
description=issue_info.body,
extra=issue_info.model_dump(),
)
db.session.add(new_issue)
Expand Down
5 changes: 4 additions & 1 deletion server/tasks/github/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ def on_pull_request_opened(event_dict: dict | list | None) -> list:
app.logger.info(f"PullRequest already exists: {pr.id}")
return []

# 限制 body 长度
pr_info.body = pr_info.body[:1000] if pr_info.body else ""

# 创建 pullrequest
new_pr = PullRequest(
id=ObjID.new_id(),
repo_id=repo.id,
pull_request_number=pr_info.number,
title=pr_info.title,
description=pr_info.body[:1000] if pr_info.body else "",
description=pr_info.body,
base=pr_info.base.ref,
head=pr_info.head.ref,
state=pr_info.state,
Expand Down
12 changes: 0 additions & 12 deletions server/tasks/lark/lark.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,6 @@ def get_contact_by_lark_application(application_id):
db.session.add(bind_user)
db.session.commit()
user_ids.append(bind_user_id)
else:
# 如果已拉取过用户则更新 bind_user 信息
db.session.query(BindUser).filter(
BindUser.id == bind_user_id
).update(
dict(
name=item["name"],
avatar=item["avatar"]["avatar_origin"],
extra=item,
)
)
db.session.commit()
db.session.query(IMApplication).filter(
IMApplication.id == application.id,
).update(dict(status=1))
Expand Down

0 comments on commit 1daf4ce

Please sign in to comment.