{% set notifications = get_notifications(request.user.id) %}
{% if notifications %}
    <div class="header_notifications">
    <h3>{% trans %}New comments{% endtrans %}</h3>
    <ul>
        {% for notification in  notifications %}
        {% set comment_wrapper = notification.obj() %}
        {% set comment_object = comment_wrapper.comment() %}
        {% set comment_author = comment_object.get_actor %}
        {% set comment_target = comment_wrapper.target() %}
        <li class="comment_wrapper">
            <div class="comment_author">
                <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
                <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
                            user=comment_author.username) }}"
                    class="comment_authorlink">
                    {{- comment_author.username -}}
                </a>
                <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
                            comment=comment_wrapper.id,
                            user=comment_target.get_actor.username,
                            media=comment_target.slug_or_id) }}#comment"
                    class="comment_whenlink">
                    <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
                    {%- trans formatted_time=timesince(comment_object.created) -%}
                        {{ formatted_time }} ago
                    {%- endtrans -%}
                    </span>
                </a>:
            </div>
            <div class="comment_content">
                {% autoescape False -%}
                {{ comment_object.content_html }}
                {%- endautoescape %}
            </div>

        </li>
        {% endfor %}
    </ul>
    <a href="{{ request.urlgen('mediagoblin.notifications.mark_all_comment_notifications_seen') }}?next={{
      request.base_url|urlencode }}" id="mark_all_comments_seen">
      {% trans %}Mark all read{% endtrans %}
    </a>
    </div>
{% endif %}
