aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/api/views.py
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2015-09-17 13:47:56 +0200
committerJessica Tallon <tsyesika@tsyesika.se>2015-10-07 14:40:44 +0200
commit0f3bf8d4b180ffd1907d1578e087522aad7d9158 (patch)
tree22279f7ff895047d1ec3c68bedb69a081cc0871a /mediagoblin/api/views.py
parent80ba8ad1d1badb2f6330f25c540dc413e42e7d5c (diff)
downloadmediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.tar.lz
mediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.tar.xz
mediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.zip
Collection changes and migration for federation
- Adds a "type" column to the Collection object and allows the CollectionItem model to contain any object. - Changes "items" to "num_items" as per TODO - Renames "uploader", "creator" and "user" to a common "actor" in most places
Diffstat (limited to 'mediagoblin/api/views.py')
-rw-r--r--mediagoblin/api/views.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/mediagoblin/api/views.py b/mediagoblin/api/views.py
index 9c2876c2..d3eaacc9 100644
--- a/mediagoblin/api/views.py
+++ b/mediagoblin/api/views.py
@@ -268,7 +268,7 @@ def feed_endpoint(request, outbox=None):
status=403
)
- comment = MediaComment(author=request.user.id)
+ comment = MediaComment(actor=request.user.id)
comment.unserialize(data["object"], request)
comment.save()
@@ -299,7 +299,7 @@ def feed_endpoint(request, outbox=None):
status=404
)
- if media.uploader != request.user.id:
+ if media.actor != request.user.id:
return json_error(
"Privilege 'commenter' required to comment.",
status=403
@@ -366,7 +366,7 @@ def feed_endpoint(request, outbox=None):
# Check that the person trying to update the comment is
# the author of the comment.
- if comment.author != request.user.id:
+ if comment.actor != request.user.id:
return json_error(
"Only author of comment is able to update comment.",
status=403
@@ -399,7 +399,7 @@ def feed_endpoint(request, outbox=None):
# Check that the person trying to update the comment is
# the author of the comment.
- if image.uploader != request.user.id:
+ if image.actor != request.user.id:
return json_error(
"Only uploader of image is able to update image.",
status=403
@@ -463,7 +463,7 @@ def feed_endpoint(request, outbox=None):
# Find the comment asked for
comment = MediaComment.query.filter_by(
id=obj_id,
- author=request.user.id
+ actor=request.user.id
).first()
if comment is None:
@@ -492,7 +492,7 @@ def feed_endpoint(request, outbox=None):
# Find the image
entry = MediaEntry.query.filter_by(
id=obj_id,
- uploader=request.user.id
+ actor=request.user.id
).first()
if entry is None:
@@ -792,5 +792,3 @@ def whoami(request):
)
return redirect(request, location=profile)
-
-