Fix Comment permission checking
parent
379b9a7dce
commit
f9d9019720
|
@ -27,7 +27,7 @@ func Comment(ctx context.Context, note *ap.Note) error {
|
|||
contextSplit := strings.Split(context.String(), "/")
|
||||
username := contextSplit[3]
|
||||
reponame := contextSplit[4]
|
||||
repo, _ := repo_model.GetRepositoryByOwnerAndName(username, reponame)
|
||||
repo, _ := repo_model.GetRepositoryByOwnerAndNameCtx(ctx, username, reponame)
|
||||
|
||||
idx, _ := strconv.ParseInt(contextSplit[len(contextSplit)-1], 10, 64)
|
||||
issue, _ := issues.GetIssueByIndex(repo.ID, idx)
|
||||
|
|
|
@ -50,17 +50,17 @@ func Ticket(ctx *context.APIContext) {
|
|||
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndNameCtx(ctx, ctx.ContextUser.Name, ctx.Repo.Repository.Name)
|
||||
if err != nil {
|
||||
ctx.ServerError("Couldn't get repo", err)
|
||||
ctx.ServerError("GetRepositoryByOwnerAndNameCtx", err)
|
||||
return
|
||||
}
|
||||
index, err := strconv.ParseInt(ctx.Params("id"), 10, 64)
|
||||
if err != nil {
|
||||
ctx.ServerError("ID must be an integer", err)
|
||||
ctx.ServerError("ParseInt", err)
|
||||
return
|
||||
}
|
||||
issue, err := issues_model.GetIssueByIndex(repo.ID, index)
|
||||
if err != nil {
|
||||
ctx.ServerError("Couldn't get issue", err)
|
||||
ctx.ServerError("GetIssueByIndex", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue