From cbf11ba08205a1fcb9b0d421211cd57df30bbbbe Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 6 Jul 2019 15:45:29 -0400 Subject: Scope annotations to a repo ID --- gitsrht/blueprints/api.py | 4 ++-- gitsrht/blueprints/repo.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gitsrht/blueprints/api.py b/gitsrht/blueprints/api.py index 0bc8fc9..e40ad4f 100644 --- a/gitsrht/blueprints/api.py +++ b/gitsrht/blueprints/api.py @@ -157,8 +157,8 @@ def repo_annotate_PUT(username, reponame): validate_annotation(valid, anno) if not valid.ok: return valid.response - # TODO: more validation on annotation structure - redis.set(f"git.sr.ht:git:annotations:{oid}", json.dumps(annotations)) + redis.set(f"git.sr.ht:git:annotations:{repo.id}:{oid}", + json.dumps(annotations)) # Invalidate rendered markup cache redis.delete(f"git.sr.ht:git:highlight:{oid}") diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index a12bf8e..abd156e 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -48,7 +48,7 @@ def get_readme(repo, tip, link_prefix=None): link_prefix=link_prefix) def _highlight_file(repo, ref, name, data, blob_id): - annotations = redis.get(f"git.sr.ht:git:annotations:{blob_id}") + annotations = redis.get(f"git.sr.ht:git:annotations:{repo.id}:{blob_id}") if annotations: annotations = json.loads(annotations.decode()) link_prefix = url_for( -- cgit v1.2.3