<%= content_for :breadcrumbs do %> <%= breadcrumbs_for_discussion @discussion, @debatable %> <% end %>
<%= render partial: 'exercises/read_only', locals: {exercise: @debatable} %>
<% if @discussion.has_messages? || @discussion.commentable_by?(current_user) %>

<%= t :messages %>

<% if current_user && @discussion.persisted? %> <% if @discussion.can_toggle_responsible?(current_user) %>
<%= btn_toggle responsible_icon, not_responsible_icon, @discussion.any_responsible?, class: 'btn-sm', onclick: "mumuki.Forum.discussionResponsible('#{responsible_discussion_url(@discussion)}')" %>
<% end %> <% if @discussion.subscribable? %>
<%= btn_toggle subscription_icon, unsubscription_icon, current_user.subscribed_to?(@discussion), class: 'btn-sm', onclick: "mumuki.Forum.discussionSubscription('#{subscription_discussion_url(@discussion)}')" %>
<% end %> <% if @discussion.solved? %>
<%= btn_toggle upvote_icon, undo_upvote_icon, current_user.upvoted?(@discussion), class: 'btn-sm', onclick: "mumuki.Forum.discussionUpvote('#{upvote_discussion_url(@discussion)}')" %>
<% end %>
<% end %>
<% if @discussion.has_messages? %>
<% if @discussion.description.present? %> <%= render partial: 'discussions/description_message', locals: {discussion: @discussion} %> <% end %> <% @discussion.visible_messages.each do |message| %> <%= render partial: 'discussions/message', locals: {user: message.sender_user, message: message} %> <% end %> <% if @discussion.commentable_by?(current_user) %>
<% end %>
<% end %> <%= render partial: 'discussions/new_message', locals: {user: current_user} if @discussion.commentable_by?(current_user) %> <% end %> <% if current_user&.moderator_here? %>
<% @discussion.reachable_statuses_for(current_user).each do |status| %> <%= discussion_update_status_button(status) %> <% end %>
<% end %>