Compare commits

...

3 commits

Author SHA1 Message Date
David Baker 179ad67289 Changelog entry 2018-06-28 15:20:21 +01:00
David Baker 94a14b4182 Merge remote-tracking branch 'origin/develop' into dbkr/media_erasure 2018-06-28 15:16:04 +01:00
David Baker e6819c348b Media repo support for content erasure
Don't serve up content from users who have erased their content
2018-06-12 11:09:55 +01:00
4 changed files with 17 additions and 1 deletions

1
changelog.d/3459.feature Normal file
View file

@ -0,0 +1 @@
Refuse to serve content from users who have erased their content

View file

@ -188,6 +188,11 @@ class MediaRepository(object):
respond_404(request)
return
user_erased = yield self.store.is_user_erased(media_info['user_id'])
if user_erased:
respond_404(request)
return
self.mark_recently_accessed(None, media_id)
media_type = media_info["media_type"]

View file

@ -96,6 +96,11 @@ class ThumbnailResource(Resource):
respond_404(request)
return
user_erased = yield self.store.is_user_erased(media_info['user_id'])
if user_erased:
respond_404(request)
return
thumbnail_infos = yield self.store.get_local_media_thumbnails(media_id)
if thumbnail_infos:
@ -136,6 +141,11 @@ class ThumbnailResource(Resource):
respond_404(request)
return
user_erased = yield self.store.is_user_erased(media_info['user_id'])
if user_erased:
respond_404(request)
return
thumbnail_infos = yield self.store.get_local_media_thumbnails(media_id)
for info in thumbnail_infos:
t_w = info["thumbnail_width"] == desired_width

View file

@ -39,7 +39,7 @@ class MediaRepositoryStore(BackgroundUpdateStore):
{"media_id": media_id},
(
"media_type", "media_length", "upload_name", "created_ts",
"quarantined_by", "url_cache",
"quarantined_by", "url_cache", "user_id",
),
allow_none=True,
desc="get_local_media",