{% set canReply = not ctx.topic.isLocked and currentUser is not null and currentUser.hasPermission(permission("CREATE_OWN_POST")) %} {% set canEdit = currentUser is not null and ( ( ctx.topicAuthor is not null and currentUser.id == ctx.topicAuthor.id and ctx.topicAuthor.hasPermission(permission("EDIT_OWN_TOPIC")) ) or currentUser.hasPermission(permission("EDIT_OTHER_TOPIC")) ) %} {% set canDelete = currentUser is not null and ( ( ctx.topicAuthor is not null and currentUser.id == ctx.topicAuthor.id and ctx.topicAuthor.hasPermission(permission("DELETE_OWN_TOPIC")) ) or currentUser.hasPermission(permission("DELETE_OTHER_TOPIC")) ) %} {% set title = ctx.topic.title %} {% extends "base.twig" %} {% block content %} {% if canEdit %} {% endif %} {% if currentUser is null %} {% else %} {% endif %} {% set formError = getAndClearFormError("updateTopic") %} {% if formError %} {% include "components/alert_error.twig" with { message: formError } %} {% endif %} {% set formError = getAndClearFormError("lockTopic") %} {% if formError %} {% include "components/alert_error.twig" with { message: formError } %} {% endif %} {% set formError = null %} {% for item in ctx.allItems %} {% if item.type == "post" %} {% include "components/post.twig" with { post: item.post, postAuthor: item.postAuthor, topic: item.topic, attachments: item.attachments, hide_actions: false, hide_pfp: false, } %} {% elseif item.type == "logMessage" %} {% include "components/topic_log.twig" with { type: item.type, logMessage: item.logMessage, postAuthor: item.postAuthor, topicAuthor: item.topicAuthor, topic: item.topic, hide_actions: false, hide_pfp: false, } %} {% endif %} {% endfor %} {% if ctx.topic.isLocked %}
{{ __("This topic has been locked") }}
{% elseif currentUser is not null %} {% set formId = "addpost" %}

{{ __("Reply to this topic") }}

{% set formError = getAndClearFormError(formId) %} {% if formError %} {% include "components/alert_error.twig" with { message: formError } %} {% endif %}
{% else %}
{{ __("Log in to reply to this topic") }}
{{ __("Log in") }}
{% endif %} {% endblock %}