WIP add sourcegraph
This commit is contained in:
@@ -281,4 +281,14 @@ func renderBlame(ctx *context.Context, blameParts []*gitrepo.BlamePart, commitNa
|
||||
ctx.Data["EscapeStatus"] = escapeStatus
|
||||
ctx.Data["BlameRows"] = rows
|
||||
ctx.Data["LexerName"] = lexerName
|
||||
|
||||
// Sourcegraph code intelligence configuration
|
||||
if setting.Sourcegraph.Enabled {
|
||||
ctx.Data["SourcegraphEnabled"] = true
|
||||
ctx.Data["SourcegraphConfig"] = map[string]any{
|
||||
"enabled": true,
|
||||
"repoFullName": ctx.Repo.Repository.FullName(),
|
||||
"commitID": ctx.Repo.CommitID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,16 @@ func setCompareContext(ctx *context.Context, before, head *git.Commit, headOwner
|
||||
setPathsCompareContext(ctx, before, head, headOwner, headName)
|
||||
setImageCompareContext(ctx)
|
||||
setCsvCompareContext(ctx)
|
||||
|
||||
// Sourcegraph code intelligence configuration
|
||||
if setting.Sourcegraph.Enabled {
|
||||
ctx.Data["SourcegraphEnabled"] = true
|
||||
ctx.Data["SourcegraphConfig"] = map[string]any{
|
||||
"enabled": true,
|
||||
"repoFullName": headOwner + "/" + headName,
|
||||
"commitID": head.ID.String(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SourceCommitURL creates a relative URL for a commit in the given repository
|
||||
|
||||
@@ -256,6 +256,16 @@ func prepareFileView(ctx *context.Context, entry *git.TreeEntry) {
|
||||
default:
|
||||
// unable to render anything, show the "view raw" or let frontend handle it
|
||||
}
|
||||
|
||||
// Sourcegraph code intelligence configuration
|
||||
if setting.Sourcegraph.Enabled {
|
||||
ctx.Data["SourcegraphEnabled"] = true
|
||||
ctx.Data["SourcegraphConfig"] = map[string]any{
|
||||
"enabled": true,
|
||||
"repoFullName": ctx.Repo.Repository.FullName(),
|
||||
"commitID": ctx.Repo.CommitID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func prepareFileViewEditorButtons(ctx *context.Context) bool {
|
||||
|
||||
Reference in New Issue
Block a user