Skip to content

Commit 2123195

Browse files
Migration failure during reaction migration from gitea (#13344) (#13346)
* Migration failure during reaction migration from gitea (#13344) * Migrating reactions is just not that important A failure during migrating reactions should not cause failure of migration. Signed-off-by: Andrew Thornton <[email protected]> * When checking issue reactions check the correct permission Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: techknowlogick <[email protected]> * Delete gitea_downloader.go * Backport #13349 Unfortunately my final push to #13344 didn't register - or I failed to push it properly. GetIssueCommentReactions in routers/api/v1/repo/issue_reaction.go also makes the same mistake. Co-authored-by: zeripath <[email protected]>
1 parent 5a02180 commit 2123195

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

modules/migrations/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func MigrateRepository(ctx context.Context, doer *models.User, ownerName string,
8484
}
8585

8686
if err2 := models.CreateRepositoryNotice(fmt.Sprintf("Migrate repository from %s failed: %v", opts.OriginalURL, err)); err2 != nil {
87-
log.Error("create respotiry notice failed: ", err2)
87+
log.Error("create repository notice failed: ", err2)
8888
}
8989
return nil, err
9090
}

routers/api/v1/repo/issue_reaction.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
5656
return
5757
}
5858

59-
if !ctx.Repo.CanRead(models.UnitTypeIssues) {
59+
if err := comment.LoadIssue(); err != nil {
60+
ctx.Error(http.StatusInternalServerError, "comment.LoadIssue", err)
61+
}
62+
63+
if !ctx.Repo.CanReadIssuesOrPulls(comment.Issue.IsPull) {
6064
ctx.Error(http.StatusForbidden, "GetIssueCommentReactions", errors.New("no permission to get reactions"))
6165
return
6266
}
@@ -270,7 +274,7 @@ func GetIssueReactions(ctx *context.APIContext) {
270274
return
271275
}
272276

273-
if !ctx.Repo.CanRead(models.UnitTypeIssues) {
277+
if !ctx.Repo.CanReadIssuesOrPulls(issue.IsPull) {
274278
ctx.Error(http.StatusForbidden, "GetIssueReactions", errors.New("no permission to get reactions"))
275279
return
276280
}

0 commit comments

Comments
 (0)