mirror of
https://github.com/langgenius/dify.git
synced 2026-02-24 18:05:11 +00:00
feat: mentioned user email can directly open app
This commit is contained in:
@@ -5,6 +5,7 @@ from sqlalchemy import desc, select
|
||||
from sqlalchemy.orm import Session, selectinload
|
||||
from werkzeug.exceptions import Forbidden, NotFound
|
||||
|
||||
from configs import dify_config
|
||||
from extensions.ext_database import db
|
||||
from libs.datetime_utils import naive_utc_now
|
||||
from libs.helper import uuid_value
|
||||
@@ -61,7 +62,7 @@ class WorkflowCommentService:
|
||||
mentioned_user_ids: Sequence[str],
|
||||
content: str,
|
||||
) -> list[dict[str, str]]:
|
||||
"""Prepare email payloads for mentioned users."""
|
||||
"""Prepare email payloads for mentioned users, including the workflow app link."""
|
||||
if not mentioned_user_ids:
|
||||
return []
|
||||
|
||||
@@ -72,6 +73,8 @@ class WorkflowCommentService:
|
||||
app_name = session.scalar(select(App.name).where(App.id == app_id, App.tenant_id == tenant_id)) or "Dify app"
|
||||
commenter_name = session.scalar(select(Account.name).where(Account.id == mentioner_id)) or "Dify user"
|
||||
comment_excerpt = WorkflowCommentService._format_comment_excerpt(content)
|
||||
base_url = dify_config.CONSOLE_WEB_URL.rstrip("/")
|
||||
app_url = f"{base_url}/app/{app_id}/workflow"
|
||||
|
||||
accounts = session.scalars(
|
||||
select(Account)
|
||||
@@ -89,6 +92,7 @@ class WorkflowCommentService:
|
||||
"commenter_name": commenter_name,
|
||||
"app_name": app_name,
|
||||
"comment_content": comment_excerpt,
|
||||
"app_url": app_url,
|
||||
}
|
||||
)
|
||||
return payloads
|
||||
|
||||
@@ -18,6 +18,7 @@ def send_workflow_comment_mention_email_task(
|
||||
commenter_name: str,
|
||||
app_name: str,
|
||||
comment_content: str,
|
||||
app_url: str,
|
||||
):
|
||||
"""
|
||||
Send workflow comment mention email with internationalization support.
|
||||
@@ -29,6 +30,7 @@ def send_workflow_comment_mention_email_task(
|
||||
commenter_name: Name of the comment author
|
||||
app_name: Name of the app where the comment was made
|
||||
comment_content: Comment content excerpt
|
||||
app_url: Link to the app workflow page
|
||||
"""
|
||||
if not mail.is_inited():
|
||||
return
|
||||
@@ -48,6 +50,7 @@ def send_workflow_comment_mention_email_task(
|
||||
"commenter_name": commenter_name,
|
||||
"app_name": app_name,
|
||||
"comment_content": comment_content,
|
||||
"app_url": app_url,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
<div class="comment-box">
|
||||
<p class="comment-text">{{ comment_content }}</p>
|
||||
</div>
|
||||
<p class="tips">Open {{ application_title }} to reply to the comment.</p>
|
||||
<p class="tips"><a href="{{ app_url }}" style="color: #155AEF; text-decoration: none;">Open {{ application_title }}</a> to reply to the comment.</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
<div class="comment-box">
|
||||
<p class="comment-text">{{ comment_content }}</p>
|
||||
</div>
|
||||
<p class="tips">请在 {{ application_title }} 中查看并回复此评论。</p>
|
||||
<p class="tips">请在 <a href="{{ app_url }}" style="color: #155AEF; text-decoration: none;">{{ application_title }}</a> 中查看并回复此评论。</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
<div class="comment-box">
|
||||
<p class="comment-text">{{ comment_content }}</p>
|
||||
</div>
|
||||
<p class="tips">Open {{ application_title }} to reply to the comment.</p>
|
||||
<p class="tips"><a href="{{ app_url }}" style="color: #155AEF; text-decoration: none;">Open {{ application_title }}</a> to reply to the comment.</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
<div class="comment-box">
|
||||
<p class="comment-text">{{ comment_content }}</p>
|
||||
</div>
|
||||
<p class="tips">请在 {{ application_title }} 中查看并回复此评论。</p>
|
||||
<p class="tips">请在 <a href="{{ app_url }}" style="color: #155AEF; text-decoration: none;">{{ application_title }}</a> 中查看并回复此评论。</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user