summary refs log tree commit diff
path: root/synapse/rest/media/v1
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-01-15 11:53:04 +0000
committerErik Johnston <erik@matrix.org>2018-01-17 10:24:43 +0000
commit300edc23482fbc637a64a9e1cc1235a1fa7f9562 (patch)
tree1c62f46d0c35e3cbb46cc0af1f9ec6b4dfb0c670 /synapse/rest/media/v1
parentKeep track of last access time for local media (diff)
downloadsynapse-300edc23482fbc637a64a9e1cc1235a1fa7f9562.tar.xz
Update last access time when thumbnails are viewed
Diffstat (limited to 'synapse/rest/media/v1')
-rw-r--r--synapse/rest/media/v1/thumbnail_resource.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/rest/media/v1/thumbnail_resource.py b/synapse/rest/media/v1/thumbnail_resource.py
index 8c9653843b..c09f2dec41 100644
--- a/synapse/rest/media/v1/thumbnail_resource.py
+++ b/synapse/rest/media/v1/thumbnail_resource.py
@@ -67,6 +67,7 @@ class ThumbnailResource(Resource):
                 yield self._respond_local_thumbnail(
                     request, media_id, width, height, method, m_type
                 )
+            self.media_repo.mark_recently_accessed(server_name, media_id)
         else:
             if self.dynamic_thumbnails:
                 yield self._select_or_generate_remote_thumbnail(
@@ -78,6 +79,7 @@ class ThumbnailResource(Resource):
                     request, server_name, media_id,
                     width, height, method, m_type
                 )
+            self.media_repo.mark_recently_accessed(None, media_id)
 
     @defer.inlineCallbacks
     def _respond_local_thumbnail(self, request, media_id, width, height,