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
This commit is contained in:
Jessica Tallon
2015-09-17 13:47:56 +02:00
parent 80ba8ad1d1
commit 0f3bf8d4b1
48 changed files with 437 additions and 250 deletions

View File

@@ -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)