fix: Redirect to comment in the doc comment section (#17538)

This commit is contained in:
Shariq Ansari 2022-07-18 22:00:54 +05:30 committed by GitHub
parent f4a82e4b85
commit 04f4fd8cfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@
import re
import frappe
from frappe import _
from frappe import _, scrub
from frappe.rate_limiter import rate_limit
from frappe.utils.html_utils import clean_html
from frappe.website.doctype.blog_settings.blog_settings import get_comment_limit
@ -41,8 +41,13 @@ def add_comment(comment, comment_email, comment_by, reference_doctype, reference
if route:
clear_cache(route)
content = comment.content + "<p><a href='{}/{}#{}' style='font-size: 80%'>{}</a></p>".format(
frappe.utils.get_request_site_address(), doc.route, comment.name, _("View Comment")
if doc.get("route"):
url = f"{frappe.utils.get_request_site_address()}/{doc.route}#{comment.name}"
else:
url = f"{frappe.utils.get_request_site_address()}/app/{scrub(doc.doctype)}/{doc.name}#comment-{comment.name}"
content = comment.content + "<p><a href='{}' style='font-size: 80%'>{}</a></p>".format(
url, _("View Comment")
)
if doc.doctype == "Blog Post" and not doc.enable_email_notification: