~edwargix/git.sr.ht

cbf11ba08205a1fcb9b0d421211cd57df30bbbbe — Drew DeVault 6 years ago becae56
Scope annotations to a repo ID
2 files changed, 3 insertions(+), 3 deletions(-)

M gitsrht/blueprints/api.py
M gitsrht/blueprints/repo.py
M gitsrht/blueprints/api.py => gitsrht/blueprints/api.py +2 -2
@@ 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}")


M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +1 -1
@@ 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(