Message
<% if participant_signed_in? && !current_participant.coach_assignment %>
You will be able use this tool once you have been assigned a coach
<% elsif current_user && can?(:create, SiteMessage) %>
<%= link_to "Messages", coach_group_messages_path(@group), class: "btn btn-default" %>
<%= link_to "Compose", new_coach_group_message_path(@group), class: "btn btn-default" %>
<% elsif current_participant && current_participant.active_membership.present? %>
<%= (link_to "Compose", compose_path, class: "btn btn-default") if current_user || current_participant.active_membership.group.arm.can_message_after_membership_complete? || current_participant.in_study? %>
<% end %>
<%= render "think_feel_do_engine/messages/message_info", message: message %>
<% user_id = current_user.try(:id) || current_participant.try(:id) %>
<% unless message.sender.id == user_id %>
<% if (current_participant && current_participant.in_study?) || current_user %>
<%= (link_to "Reply to this message", reply_path) if current_user || current_participant && current_participant.active_membership.group.arm.can_message_after_membership_complete? || current_participant.in_study? %>
<% end %>
<%= link_to "Cancel", :back, class: "btn btn-default" %>
<% end %>