Fix comment ID links on media comment report page
authorAndrew Browning <ayleph@thisshitistemp.com>
Wed, 2 Mar 2016 18:37:36 +0000 (13:37 -0500)
committerAndrew Browning <ayleph@thisshitistemp.com>
Sat, 5 Mar 2016 16:39:57 +0000 (11:39 -0500)
Change the comment ID behaviour and source of user_pages/report.html
to match user_pages/media.html as of #5376.

mediagoblin/templates/mediagoblin/user_pages/report.html
mediagoblin/user_pages/views.py

index 09502fcf39dd4c430820a0e0e1a16472f00a0de7..4a88f4b7accf2cb2aee29609df694a64a9fe96e4 100644 (file)
 <form action="" method=POST >
     {% if comment is defined %}
         <h3>{% trans %}Reporting this Comment{% endtrans %}</h3>
-        {%- set comment_author = comment.get_actor %}
-        {%- set comment_author_url = request.urlgen(
-                                      'mediagoblin.user_pages.user_home',
-                                      user=comment_author.username) %}
-        {%- set comment_url = request.urlgen(
-                            'mediagoblin.user_pages.media_home.view_comment',
-                            comment=comment.id,
-                            user=media.get_actor.username,
-                            media=media.slug_or_id) %}
+        {% set comment_object = comment.comment() %}
+        {% set comment_author = comment_object.get_actor %}
         <div id="comment-{{ comment.id }}"
             class="comment_wrapper">
           <div class="comment_author">
-            <img
-              src="{{ request.staticdirect('/images/icon_comment.png') }}" />
-            <a href="{{ comment_author_url }}"
+            <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="{{ comment_url }}"
+            <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
+                            comment=comment.id,
+                            user=media.get_actor.username,
+                            media=media.slug_or_id) }}#comment"
                class="comment_whenlink">
-              <span
-                title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
-
-                {%- trans formatted_time=timesince(comment.created) -%}
+              <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.content_html }}
+              {{ comment_object.content_html }}
             {%- endautoescape %}
           </div>
         </div>
index ad03e0114684bf2b4504f88f5f715c7664761a10..6949aaf617d5680aafd4a739355f5bc467a12c60 100644 (file)
@@ -693,7 +693,7 @@ def file_a_report(request, media, comment):
 
         form = user_forms.CommentReportForm(request.form)
         context = {'media': comment.target(),
-                   'comment':comment.comment(),
+                   'comment':comment,
                    'form':form}
     else:
         form = user_forms.MediaReportForm(request.form)