{% if doctype and docname and not thread %} {% set thread_info = frappe.get_all("Discussion Thread", {"reference_doctype": doctype, "reference_docname": docname}, ["name"]) %} {% if thread_info | length %} {% set thread = thread_info[0].name %} {% endif %} {% endif %} {% if thread %} {% set messages = frappe.get_all("Discussion Message", {"thread": thread}, ["name", "message", "owner", "creation"], order_by="creation") %} {% endif %} {% if doctype %}
Discussions
{% endif %}
{% for message in messages %} {% include "community/templates/message_card.html" %} {% endfor %}
{% if frappe.session.user == "Guest" or (condition is defined and not condition) %}
Want to join the discussion? {% if frappe.session.user == "Guest" %}
Log In
{% elif not condition %}
{{ button_name }}
{% endif %}
{% else %} {{ widgets.DiscussionComment(doctype=doctype, docname=docname, title=title, thread=thread ) }} {% endif %}