Skip to content

Commit

Permalink
add private image
Browse files Browse the repository at this point in the history
  • Loading branch information
freeziyou committed Feb 27, 2024
1 parent d085336 commit b821c87
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/tasks/lark/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def replace_images_with_keys(text, bot, is_private=False):
replaced_text = re.sub(
markdown_pattern,
lambda match: (
f"图片({match.group(1)})"
f"图片: {match.group(1)}"
if is_private
else f"![]({process_image(match.group(1), bot)})"
),
Expand All @@ -173,7 +173,7 @@ def replace_images_with_keys(text, bot, is_private=False):
replaced_text = re.sub(
html_pattern,
lambda match: (
f"图片({match.group(1)})"
f"图片: {match.group(1)}"
if is_private
else f"![]({process_image(match.group(1), bot)})"
),
Expand Down Expand Up @@ -418,8 +418,9 @@ def send_issue_comment(issue_id, comment, user_name: str):
)
if chat_group and issue.message_id:
bot, _ = get_bot_by_application_id(chat_group.im_application_id)
is_private = repo.extra.get("private", False)
# 替换 comment 中的图片 url 为 image_key
comment = replace_images_with_keys(comment, bot)
comment = replace_images_with_keys(comment, bot, is_private=is_private)
# 统一用富文本回答, 支持图片、at
content = gen_comment_post_message(user_name, comment)
result = bot.reply(
Expand Down

0 comments on commit b821c87

Please sign in to comment.