aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/federation/views.py
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-10-09 19:20:13 +0100
committerJessica Tallon <jessica@megworld.co.uk>2014-10-09 19:20:13 +0100
commited48454558a91961b6e03fc51b8a4bf785d48d1e (patch)
tree792294c842fe5643a2d8f66be366805f621d4ece /mediagoblin/federation/views.py
parent9a1fc423ac298c2ddf078d91ea1302c135285781 (diff)
parentc0434db46910e891313495b5ae94cbbe1dd08058 (diff)
downloadmediagoblin-ed48454558a91961b6e03fc51b8a4bf785d48d1e.tar.lz
mediagoblin-ed48454558a91961b6e03fc51b8a4bf785d48d1e.tar.xz
mediagoblin-ed48454558a91961b6e03fc51b8a4bf785d48d1e.zip
Merge branch 'location'
Add Location model which holds textual, geolocation coordiantes or postal addresses. This migrates data off Image model metadata onto the general Location model. It also adds the ability for location to be set on MediaEntry, User, MediaComment and Collection models. The geolocation plugin has been updated so that the location can be displayed in more general places rather than explicitely on the MediaEntry view. If GPS coordiantes are set for the User the profile page will also have the OSM provided by the geolocation plugin.
Diffstat (limited to 'mediagoblin/federation/views.py')
-rw-r--r--mediagoblin/federation/views.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/mediagoblin/federation/views.py b/mediagoblin/federation/views.py
index 370ec8c3..4c0593fc 100644
--- a/mediagoblin/federation/views.py
+++ b/mediagoblin/federation/views.py
@@ -208,6 +208,11 @@ def feed_endpoint(request):
"Invalid 'image' with id '{0}'".format(media_id)
)
+
+ # Add location if one exists
+ if "location" in data:
+ Location.create(data["location"], self)
+
media.save()
api_add_to_feed(request, media)
@@ -303,6 +308,15 @@ def feed_endpoint(request):
"object": image.serialize(request),
}
return json_response(activity)
+ elif obj["objectType"] == "person":
+ # check this is the same user
+ if "id" not in obj or obj["id"] != requested_user.id:
+ return json_error(
+ "Incorrect user id, unable to update"
+ )
+
+ requested_user.unserialize(obj)
+ requested_user.save()
elif request.method != "GET":
return json_error(