{{ $state := . }}
  {{ range $i, $activity := .Activities}}
      <div class="activity">
    {{ if $activity.Comment }}
    <div class="title{{ if eq $activity.Comment.Op "unread"}} orangered{{end}}">
      {{ if and (not $state.User) (not $state.Query) }}
      <b>comment</b> on
      {{ end }}
      <a href="/{{$state.Host}}/post/{{ $activity.Comment.P.Post.ID}}">{{ $activity.Comment.P.Post.Name}}</a>
      <span class="meta">
      in
      <a href="/{{$state.Host}}/c/{{ fullcname $activity.Comment.P.Community }}">
        c/{{ if $state.HideInstanceNames -}}
        {{ $activity.Comment.P.Community.Name }}</a>
        {{ else -}}
        {{ fullcname $activity.Comment.P.Community }}
        {{ end }}
      </span>
    </div>
        {{ template "comment.html" $activity.Comment }}
    {{ else if $activity.Post }}
        {{ template "post.html" $activity.Post }}
    {{ else if $activity.Message }}
    <div class="message">
    {{ if eq $activity.Message.Creator.ID $state.Session.UserID }}
      <span class="meta">
        <b>message</b>
        to
        <a href="/{{$state.Host}}/u/{{fullname $activity.Message.Recipient}}">
          {{- if $state.HideInstanceNames -}}
          {{ $activity.Message.Recipient.Name }}
          {{- else -}}
          {{ fullname $activity.Message.Recipient }}
          {{- end -}}
        </a>
    {{ else }}
      <span class="meta{{ if not $activity.Message.PrivateMessage.Read }} orangered{{end}}">
        <b>message</b>
        from
        <a href="/{{$state.Host}}/u/{{fullname $activity.Message.Creator}}">
          {{- if $state.HideInstanceNames -}}
          {{ $activity.Message.Creator.Name }}
          {{- else -}}
          {{ fullname $activity.Message.Creator }}
          {{- end -}}
        </a>
    {{end}}
      sent {{ humanize $activity.Message.PrivateMessage.Published.Time }}
      </span>
    <div>{{ markdown "" $activity.Message.PrivateMessage.Content }}</div>
    </div>
    {{ end }}
      </div>
  {{ end }}