- note = discussion_notes.first
- expanded = !note.diff_note? || note.active?
%li.note.note-discussion.timeline-entry
  .timeline-entry-inner
    .timeline-icon
      = link_to user_path(note.author) do
        = image_tag avatar_icon(note.author), class: "avatar s40"
    .timeline-content
      .discussion.js-toggle-container{ class: note.discussion_id }
        .discussion-header
          = link_to_member(@project, note.author, avatar: false)

          .inline.discussion-headline-light
            = note.author.to_reference
            started a discussion on

            - if note.for_commit?
              - commit = note.noteable
              - if commit
                commit
                = link_to commit.short_id, namespace_project_commit_path(note.project.namespace, note.project, note.noteable, anchor: note.line_code), class: 'monospace'
              - else
                a deleted commit
            - else
              - if note.active?
                = link_to diffs_namespace_project_merge_request_path(note.project.namespace, note.project, note.noteable, anchor: note.line_code) do
                  the diff
              - else
                an outdated diff

            = time_ago_with_tooltip(note.created_at, placement: "bottom", html_class: "note-created-ago")

          .discussion-actions
            = link_to "#", class: "note-action-button discussion-toggle-button js-toggle-button" do
              - if expanded
                = icon("chevron-up")
              - else
                = icon("chevron-down")

              Toggle discussion

        .discussion-body.js-toggle-content{ class: ("hide" unless expanded) }
          - if note.diff_note?
            = render "projects/notes/discussions/diff_with_notes", discussion_notes: discussion_notes
          - else
            = render "projects/notes/discussions/notes", discussion_notes: discussion_notes
