<% # Copyright (C) 2011 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see . %> <% entry ||= nil entry_exists = entry && entry ? true : false out_of_context ||= false entry_context ||= entry && entry.context ? entry.context : @context entry_id = entry ? entry.id : "{{ id }}" user_id = entry.try_rescue(:user_id) || "{{ user_id }}" topic ||= nil discussion_topic_id = entry.try_rescue(:discussion_topic_id) || (topic && topic.id) || "{{ discussion_topic_id }}" entry_key = entry.new_record? ? entry.try_rescue(:discussion_topic).try_rescue(:cache_key) : entry.try_rescue(:cache_key) if entry entry_key ||= entry_context.try_rescue(:asset_string) || 'blank' skip_sub_entries ||= false read_state = entry ? entry.read_state(@current_user) : "read" link_to_headless ||= false headless_param = {:headless => 1, :embed => true, :hide_student_names => hide_student_names, :student_id => user_id} if link_to_headless hide_student_names = hide_student_names %> <% cache([ 'entry_message_render_2_', entry_key, out_of_context, skip_sub_entries, @topic_agglomerated, Time.zone.utc_offset, read_state, link_to_headless ].join('/')) do %>
id="entry_<%= entry_exists ? entry.id : "blank" %>" data-mark-read-url="<%= entry_exists && entry_id && context_url(entry_context, :api_v1_context_discussion_topic_discussion_entry_mark_read_url, discussion_topic_id, entry_id) %>">
<% if entry && entry.new_record? && entry.new_record_header %> <%= entry.new_record_header %> <% else %>
<% if out_of_context %> from <% if assignment_visible_to_user %> <%= entry.discussion_topic.title %> <% else %> <%= entry.discussion_topic.title %> <% end %> <% else %> <% if @topic_agglomerated && entry %> <%= entry.context.name %> <% end %> " href="<%= context_url(entry_context, :context_user_url, user_id) %>" class="user_name"><%= context_user_name(@context, entry && entry.user_id) %> <% end %>
<% unless out_of_context %> <% end %>
<% end %>
<% unless hide_student_names %>
<%= avatar((entry.try_rescue(:user_id)), context_code: entry_context.asset_string) %>
<% end %>
<%= user_content(entry.try_rescue(:message)) || nbsp %>
<% entries ||= []; @grouped_entries ||= {} %> <% if entry && !skip_sub_entries %> <% entries = @grouped_entries[entry.id] %> <% entries ||= [] #entry.discussion_subentries.active %> <% if entries.length > 3 %> <% end %> <% entries.each_with_index do |entry, idx| %> <%= render :partial => "discussion_topics/sub_entry", :locals => {:entry => entry, :hide_entry => entries.length > 3 && idx < entries.length - 2} %> <% end %> <% end %> <% if entry && entry.editor_id && entry.editor_id != entry.user_id %>
<%= t :edited_comment, "This comment was edited by %{user}.", :user => link_to(context_user_name(entry_context, entry.editor_id), context_url(entry_context, :context_user_url, entry.editor_id)) %>
<% end %> <%= render :partial => 'discussion_topics/sub_entry', :locals => {:entry => nil, :parent_entry => entry || topic} %>
<% if !@topic_agglomerated && (!entry || !entry.new_record?) %>   <% end %> <%= entry.parent_id rescue nbsp %> <%= entry ? entry.id : nbsp %>
" style="display: none;">
<% end %>