summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-07-06 15:45:29 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-06 15:45:29 -0400
commitcbf11ba08205a1fcb9b0d421211cd57df30bbbbe (patch)
tree3f85968ba50b26e9d4798e978cfb29670866a84f
parentbecae56162a9474e11a4002b561f23649f1a01d4 (diff)
Scope annotations to a repo ID
-rw-r--r--gitsrht/blueprints/api.py4
-rw-r--r--gitsrht/blueprints/repo.py2
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(