Ticket #5376: 0001-Fix-comment-ID-links-on-media-comment-report-page.patch

File 0001-Fix-comment-ID-links-on-media-comment-report-page.patch, 3.8 KB (added by ayleph, 8 years ago)
  • mediagoblin/templates/mediagoblin/user_pages/report.html

    From ff819c296f491a621c76a37e2ca257a8fcc0dbd6 Mon Sep 17 00:00:00 2001
    From: Andrew Browning <ayleph@thisshitistemp.com>
    Date: Wed, 2 Mar 2016 13:37:36 -0500
    Subject: [PATCH] Fix comment ID links on media comment report page
    
    Change the comment ID behaviour and source of user_pages/report.html
    to match user_pages/media.html as of #5376.
    ---
     .../templates/mediagoblin/user_pages/report.html   | 30 +++++++++-------------
     mediagoblin/user_pages/views.py                    |  2 +-
     2 files changed, 13 insertions(+), 19 deletions(-)
    
    diff --git a/mediagoblin/templates/mediagoblin/user_pages/report.html b/mediagoblin/templates/mediagoblin/user_pages/report.html
    index 09502fc..4a88f4b 100644
    a b  
    2222<form action="" method=POST >
    2323    {% if comment is defined %}
    2424        <h3>{% trans %}Reporting this Comment{% endtrans %}</h3>
    25         {%- set comment_author = comment.get_actor %}
    26         {%- set comment_author_url = request.urlgen(
    27                                       'mediagoblin.user_pages.user_home',
    28                                       user=comment_author.username) %}
    29         {%- set comment_url = request.urlgen(
    30                             'mediagoblin.user_pages.media_home.view_comment',
    31                             comment=comment.id,
    32                             user=media.get_actor.username,
    33                             media=media.slug_or_id) %}
     25        {% set comment_object = comment.comment() %}
     26        {% set comment_author = comment_object.get_actor %}
    3427        <div id="comment-{{ comment.id }}"
    3528            class="comment_wrapper">
    3629          <div class="comment_author">
    37             <img
    38               src="{{ request.staticdirect('/images/icon_comment.png') }}" />
    39             <a href="{{ comment_author_url }}"
     30            <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
     31            <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
     32                            user=comment_author.username) }}"
    4033               class="comment_authorlink">
    4134              {{- comment_author.username -}}
    4235            </a>
    43             <a href="{{ comment_url }}"
     36            <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
     37                            comment=comment.id,
     38                            user=media.get_actor.username,
     39                            media=media.slug_or_id) }}#comment"
    4440               class="comment_whenlink">
    45               <span
    46                 title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
    47 
    48                 {%- trans formatted_time=timesince(comment.created) -%}
     41              <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
     42                {%- trans formatted_time=timesince(comment_object.created) -%}
    4943                  {{ formatted_time }} ago
    5044                {%- endtrans -%}
    5145              </span></a>:
    5246          </div>
    5347          <div class="comment_content">
    5448            {% autoescape False -%}
    55               {{ comment.content_html }}
     49              {{ comment_object.content_html }}
    5650            {%- endautoescape %}
    5751          </div>
    5852        </div>
  • mediagoblin/user_pages/views.py

    diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
    index ad03e01..6949aaf 100644
    a b def file_a_report(request, media, comment):  
    693693
    694694        form = user_forms.CommentReportForm(request.form)
    695695        context = {'media': comment.target(),
    696                    'comment':comment.comment(),
     696                   'comment':comment,
    697697                   'form':form}
    698698    else:
    699699        form = user_forms.MediaReportForm(request.form)