{% include "package/snippets/flag-comment_asset.html" %} {% set content_type = content_type or 'dataset' %} {% set thread = h.get_comment_thread(pkg_name, content_type) %} {% set depth = 0 %} {% set notification_actions_enabled = userobj and h.ytp_comments_notification_recipients_enabled() %} {%- if h.user_can_manage_comments(content_type, pkg_id) -%} {% set unreplied_comments_x_days = h.ytp_comments_unreplied_comments_x_days(thread.url) %} {%- endif -%} {% if notification_actions_enabled %} {% include "package/snippets/follow-or-mute-comment_asset.html" %} {% set following_content_item, comments_following, comments_muted = h.user_comment_follow_mute_status(userobj.id, thread.id) %} {% endif %} {% macro comment_form(values={}, empty=False, hidden=True, prefix="", action="add", depth=0) %} {% endmacro %} {% macro comment_thread(thread, content_type, depth=0) %} {% if thread.comments | length > 0 and notification_actions_enabled %} {% snippet "snippets/content_item_notification_actions.html", following=following_content_item, content_type=content_type, thread_id=thread.id %} {% endif %} {% for comment in thread.comments %}
{% set user_can_manage = h.user_can_manage_comments(content_type, pkg_id) %}
{% if comment.state != 'deleted' %} {% if user_can_manage %}
{% endif %} {% if h.user_can_edit_comment(comment.user_id) or user_can_manage %}
{% endif %}
Reported {% if userobj and comment.flagged != True %} Report {% elif comment.flagged == True %} {% if user_can_manage %} Un-flag {% endif %} {% endif %}
{% if notification_actions_enabled and h.threaded_comments_enabled() == true and depth < 1 %} {% snippet "snippets/comment_thread_notification_actions.html", following_content=following_content_item, following=(comment.id in comments_following), muted=(comment.id in comments_muted), comment_id=comment.id %} {% endif %} {% endif %}
{% set commented_on = 'commented on ' + h.render_datetime(comment.creation_date, "%d %b %Y, %-I:%M%p") %} {% if 'user_state' in comment and comment.user_state == 'deleted' %} {{ comment.username }} {{ commented_on }} {% else %} {% link_for _(comment.username), named_route='user.read', id=comment.user_id %} {{ commented_on }} {% endif %} {% if comment.modified_date %} — ({{ _('Modified') }} {{ h.render_datetime(comment.modified_date, "%d %b %Y, %-I:%M%p") }}) {% endif %}
{% if comment.state != 'deleted' %} {% if comment.subject|lower not in ['none', 'no subject'] %}

{{ comment.subject }}

{% endif %} {% else %} {% snippet "snippets/comment_deleted.html", comment=comment, show_deleter=user_can_manage %} {% endif %} {% if comment.state != 'deleted' %}
{{ comment.content|safe }} {% if comment.state == 'active' %} {% if h.user_can_edit_comment(comment.user_id) or user_can_manage %}
{{ comment_form(comment, prefix='edit_', action='edit', depth=depth) }}
{% endif %} {% if h.threaded_comments_enabled() == true and depth < 1 and userobj %}
{{ comment_form(comment, empty=True, prefix='reply_', action='reply') }}
{% endif %} {% endif %}
{% elif user_can_manage %}
{{ comment.content|safe }}
{% endif %}
{% if comment.comments | length != 0 %} {{ comment_thread(comment, content_type, (depth + 1)) }} {% endif %}
{% endfor %} {% endmacro %}

{{ _('Comments') }}

{{ comment_thread(thread, content_type) }}
{% if userobj %}

Add a comment{% if content_type == 'dataset' %} or ask a question about this dataset{% endif %}

{{ _('Please enter a Comment.') }}
{{ _('Comment blocked due to profanity.') }}
{% if g.recaptcha_publickey %} {% snippet "user/snippets/recaptcha.html", public_key=g.recaptcha_publickey %} {% endif %}
{% else %} {% link_for _('Login to comment'), named_route='user.login', class_='btn btn-primary', came_from=h.full_current_url() %} {% endif %}