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
|
|
22 | 22 | <form action="" method=POST > |
23 | 23 | {% if comment is defined %} |
24 | 24 | <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 %} |
34 | 27 | <div id="comment-{{ comment.id }}" |
35 | 28 | class="comment_wrapper"> |
36 | 29 | <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) }}" |
40 | 33 | class="comment_authorlink"> |
41 | 34 | {{- comment_author.username -}} |
42 | 35 | </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" |
44 | 40 | 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) -%} |
49 | 43 | {{ formatted_time }} ago |
50 | 44 | {%- endtrans -%} |
51 | 45 | </span></a>: |
52 | 46 | </div> |
53 | 47 | <div class="comment_content"> |
54 | 48 | {% autoescape False -%} |
55 | | {{ comment.content_html }} |
| 49 | {{ comment_object.content_html }} |
56 | 50 | {%- endautoescape %} |
57 | 51 | </div> |
58 | 52 | </div> |
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):
|
693 | 693 | |
694 | 694 | form = user_forms.CommentReportForm(request.form) |
695 | 695 | context = {'media': comment.target(), |
696 | | 'comment':comment.comment(), |
| 696 | 'comment':comment, |
697 | 697 | 'form':form} |
698 | 698 | else: |
699 | 699 | form = user_forms.MediaReportForm(request.form) |