From 868fd98898e811a2b60b82bc0c304fff9a04c913 Mon Sep 17 00:00:00 2001
From: ayleph <ayleph@thisshitistemp.com>
Date: Sun, 6 Dec 2015 14:48:45 -0500
Subject: [PATCH] Fix issue 5366 Update blog views
This commit updates blog views to be compatible with recent database
migrations.
---
.../templates/mediagoblin/blog/blog_admin_dashboard.html | 2 +-
.../blog/templates/mediagoblin/blog/blog_post_listing.html | 2 +-
.../blog/templates/mediagoblin/blog/blogpost_draft_view.html | 2 +-
mediagoblin/media_types/blog/views.py | 10 +++++-----
mediagoblin/templates/mediagoblin/user_pages/blog_media.html | 12 ++++++------
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/mediagoblin/media_types/blog/templates/mediagoblin/blog/blog_admin_dashboard.html b/mediagoblin/media_types/blog/templates/mediagoblin/blog/blog_admin_dashboard.html
index 1316083..3b88146 100644
a
|
b
|
|
86 | 86 | blog_slug=blog.slug, user=request.user.username, |
87 | 87 | blog_post_slug=blog_post.slug) %} |
88 | 88 | {% set blogpost_delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', |
89 | | user= blog_post.get_uploader.username, |
| 89 | user= blog_post.get_actor.username, |
90 | 90 | media_id=blog_post.id) %} |
91 | 91 | <td> |
92 | 92 | <a class="button_action" href="{{ blogpost_edit_url }}">{% trans %}Edit{% endtrans %}</a> |
diff --git a/mediagoblin/media_types/blog/templates/mediagoblin/blog/blog_post_listing.html b/mediagoblin/media_types/blog/templates/mediagoblin/blog/blog_post_listing.html
index 0013f1a..3a0fd23 100644
a
|
b
|
|
48 | 48 | <a href="{{ request.urlgen( |
49 | 49 | 'mediagoblin.user_pages.user_tag_gallery', |
50 | 50 | tag=tag['slug'], |
51 | | user=post.get_uploader.username) }}">{{ tag['name'] }} |</a> |
| 51 | user=post.get_actor.username) }}">{{ tag['name'] }} |</a> |
52 | 52 | {% endfor %} |
53 | 53 | {% endif %} |
54 | 54 | <div class="b_list_des"> <p>{{ post.description|safe }} </p></div> |
diff --git a/mediagoblin/media_types/blog/templates/mediagoblin/blog/blogpost_draft_view.html b/mediagoblin/media_types/blog/templates/mediagoblin/blog/blogpost_draft_view.html
index 7c63487..6d82055 100644
a
|
b
|
|
30 | 30 | blog_slug=blog.slug, user=request.user.username, |
31 | 31 | blog_post_slug=blogpost.slug) %} |
32 | 32 | {% set blogpost_delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', |
33 | | user= blogpost.get_uploader.username, |
| 33 | user= blogpost.get_actor.username, |
34 | 34 | media_id=blogpost.id) %} |
35 | 35 | <a class="button_action" href="{{ blogpost_edit_url }}">{% trans %}Edit{% endtrans %}</a> |
36 | 36 | <a class="button_action" href="{{ blogpost_delete_url }}">{% trans %}Delete{% endtrans %}</a> |
diff --git a/mediagoblin/media_types/blog/views.py b/mediagoblin/media_types/blog/views.py
index 40b1cec..80a7d59 100644
a
|
b
|
def blogpost_create(request):
|
142 | 142 | blogpost.description = six.text_type(cleaned_markdown_conversion((form.description.data))) |
143 | 143 | blogpost.tags = convert_to_tag_list_of_dicts(form.tags.data) |
144 | 144 | blogpost.license = six.text_type(form.license.data) or None |
145 | | blogpost.uploader = request.user.id |
| 145 | blogpost.actor = request.user.id |
146 | 146 | blogpost.generate_slug() |
147 | 147 | |
148 | 148 | set_blogpost_state(request, blogpost) |
… |
… |
def blogpost_edit(request):
|
174 | 174 | blog_slug = request.matchdict.get('blog_slug', None) |
175 | 175 | blog_post_slug = request.matchdict.get('blog_post_slug', None) |
176 | 176 | |
177 | | blogpost = request.db.MediaEntry.query.filter_by(slug=blog_post_slug, uploader=request.user.id).first() |
| 177 | blogpost = request.db.MediaEntry.query.filter_by(slug=blog_post_slug, actor=request.user.id).first() |
178 | 178 | blog = get_blog_by_slug(request, blog_slug, author=request.user.id) |
179 | 179 | |
180 | 180 | if not blogpost or not blog: |
… |
… |
def draft_view(request):
|
286 | 286 | blog_post_slug = request.matchdict.get('blog_post_slug', None) |
287 | 287 | user = request.matchdict.get('user') |
288 | 288 | blog = get_blog_by_slug(request, blog_slug, author=request.user.id) |
289 | | blogpost = request.db.MediaEntry.query.filter_by(state = u'failed', uploader=request.user.id, slug=blog_post_slug).first() |
| 289 | blogpost = request.db.MediaEntry.query.filter_by(state = u'failed', actor=request.user.id, slug=blog_post_slug).first() |
290 | 290 | |
291 | 291 | if not blog or not blogpost: |
292 | 292 | return render_404(request) |
… |
… |
def blog_about_view(request):
|
356 | 356 | blog_slug = request.matchdict.get('blog_slug', None) |
357 | 357 | url_user = request.matchdict.get('user', None) |
358 | 358 | |
359 | | user = request.db.User.query.filter( |
360 | | LocalUser.username=url_user |
| 359 | user = request.db.LocalUser.query.filter( |
| 360 | LocalUser.username==url_user |
361 | 361 | ).first() |
362 | 362 | blog = get_blog_by_slug(request, blog_slug, author=user.id) |
363 | 363 | |
diff --git a/mediagoblin/templates/mediagoblin/user_pages/blog_media.html b/mediagoblin/templates/mediagoblin/user_pages/blog_media.html
index ece47fe..ec63e69 100644
a
|
b
|
|
37 | 37 | <p class="context"> |
38 | 38 | {%- trans user_url=request.urlgen( |
39 | 39 | 'mediagoblin.user_pages.user_home', |
40 | | user=media.get_uploader.username), |
41 | | username=media.get_uploader.username -%} |
| 40 | user=media.get_actor.username), |
| 41 | username=media.get_actor.username -%} |
42 | 42 | â Blog post by <a href="{{user_url}}">{{username}}</a> |
43 | 43 | {%- endtrans -%} |
44 | 44 | </p> |
… |
… |
|
68 | 68 | {% endblock %} |
69 | 69 | </div> |
70 | 70 | {% if request.user and |
71 | | (media.uploader == request.user.id or |
| 71 | (media.actor == request.user.id or |
72 | 72 | request.user.has_privilege('admin')) %} |
73 | 73 | {% set edit_url = request.urlgen('mediagoblin.media_types.blog.blogpost.edit', |
74 | 74 | blog_slug=media.media_manager.get_blog_by_blogpost().slug, |
75 | 75 | user=request.user.username, blog_post_slug=media.slug) %} |
76 | 76 | <a class="button_action" href="{{ edit_url }}">{% trans %}Edit{% endtrans %}</a> |
77 | 77 | {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', |
78 | | user= media.get_uploader.username, |
| 78 | user= media.get_actor.username, |
79 | 79 | media_id=media.id) %} |
80 | 80 | <a class="button_action" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a> |
81 | 81 | |
… |
… |
|
96 | 96 | {% endif %} |
97 | 97 | {% if request.user %} |
98 | 98 | <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment', |
99 | | user= media.get_uploader.username, |
| 99 | user= media.get_actor.username, |
100 | 100 | media_id=media.id) }}" method="POST" id="form_comment"> |
101 | 101 | {{ wtforms_util.render_divs(comment_form) }} |
102 | 102 | <div class="form_submit_buttons"> |
… |
… |
|
124 | 124 | </a> |
125 | 125 | <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment', |
126 | 126 | comment=comment.id, |
127 | | user=media.get_uploader.username, |
| 127 | user=media.get_actor.username, |
128 | 128 | media=media.slug_or_id) }}#comment" |
129 | 129 | class="comment_whenlink"> |
130 | 130 | <span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'> |