aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-10-29 08:47:09 +0000
committerJessica Tallon <jessica@megworld.co.uk>2014-10-29 08:47:12 +0000
commitbc2c06a10d9c15ec161f51e8d942cb2e5028ce47 (patch)
treea885d6be4473957cb8d477e172c66d283b16e055 /mediagoblin/user_pages
parentc5f258fec07b9791b35d52298dd71954de81ef20 (diff)
downloadmediagoblin-bc2c06a10d9c15ec161f51e8d942cb2e5028ce47.tar.lz
mediagoblin-bc2c06a10d9c15ec161f51e8d942cb2e5028ce47.tar.xz
mediagoblin-bc2c06a10d9c15ec161f51e8d942cb2e5028ce47.zip
Fix #1017 - Exception caused by activity being set on incorrect foreign key
The .activity ForeignKey on several models such as MediaEntry expects a ActivityIntmediatory ID not an Activity ID however in submit code the activity attribute was being set the Activity, simply removing this assignment should fix the issue as everything is set correctly at this point. I have also moved the creation of the activity above the processing of media to avoid race conditions.
Diffstat (limited to 'mediagoblin/user_pages')
-rw-r--r--mediagoblin/user_pages/views.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index b6cbcabd..822f359a 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -195,15 +195,14 @@ def media_post_comment(request, media):
messages.ERROR,
_("Oops, your comment was empty."))
else:
+ create_activity("post", comment, comment.author, target=media)
+ add_comment_subscription(request.user, media)
comment.save()
messages.add_message(
request, messages.SUCCESS,
_('Your comment has been posted!'))
-
trigger_notification(comment, media, request)
- create_activity("post", comment, comment.author, target=media)
- add_comment_subscription(request.user, media)
return redirect_obj(request, media)
@@ -263,8 +262,8 @@ def media_collect(request, media):
collection.description = form.collection_description.data
collection.creator = request.user.id
collection.generate_slug()
- collection.save()
create_activity("create", collection, collection.creator)
+ collection.save()
# Otherwise, use the collection selected from the drop-down
else: