Fix Comment permission checking
This commit is contained in:
parent
379b9a7dce
commit
f9d9019720
2 changed files with 4 additions and 4 deletions
|
@ -27,7 +27,7 @@ func Comment(ctx context.Context, note *ap.Note) error {
|
||||||
contextSplit := strings.Split(context.String(), "/")
|
contextSplit := strings.Split(context.String(), "/")
|
||||||
username := contextSplit[3]
|
username := contextSplit[3]
|
||||||
reponame := contextSplit[4]
|
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)
|
idx, _ := strconv.ParseInt(contextSplit[len(contextSplit)-1], 10, 64)
|
||||||
issue, _ := issues.GetIssueByIndex(repo.ID, idx)
|
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)
|
repo, err := repo_model.GetRepositoryByOwnerAndNameCtx(ctx, ctx.ContextUser.Name, ctx.Repo.Repository.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("Couldn't get repo", err)
|
ctx.ServerError("GetRepositoryByOwnerAndNameCtx", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
index, err := strconv.ParseInt(ctx.Params("id"), 10, 64)
|
index, err := strconv.ParseInt(ctx.Params("id"), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("ID must be an integer", err)
|
ctx.ServerError("ParseInt", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
issue, err := issues_model.GetIssueByIndex(repo.ID, index)
|
issue, err := issues_model.GetIssueByIndex(repo.ID, index)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("Couldn't get issue", err)
|
ctx.ServerError("GetIssueByIndex", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue