mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
chore: fix some trivial problems and TODOs (#33473)
1. Fix incorrect `MentionCount` (actually it seems to be deadcode, affects nothing) 2. Remove fallback sha1 support for time limit token 3. Use route middleware `reqRepoActionsWriter` for `ArtifactsDeleteView` 4. Use clearer message "Failed to authenticate user" instead of "Verify" when auth fails 5. `tests/integration/benchmarks_test.go` is not quite right, actually it is never used, so delete it. 6. Remove or update TODO comments
This commit is contained in:
@@ -85,7 +85,7 @@ func TestComposeIssueCommentMessage(t *testing.T) {
|
||||
|
||||
recipients := []*user_model.User{{Name: "Test", Email: "test@gitea.com"}, {Name: "Test2", Email: "test2@gitea.com"}}
|
||||
msgs, err := composeIssueCommentMessages(&mailCommentContext{
|
||||
Context: context.TODO(), // TODO: use a correct context
|
||||
Context: context.TODO(),
|
||||
Issue: issue, Doer: doer, ActionType: activities_model.ActionCommentIssue,
|
||||
Content: fmt.Sprintf("test @%s %s#%d body", doer.Name, issue.Repo.FullName(), issue.Index),
|
||||
Comment: comment,
|
||||
@@ -131,7 +131,7 @@ func TestComposeIssueMessage(t *testing.T) {
|
||||
|
||||
recipients := []*user_model.User{{Name: "Test", Email: "test@gitea.com"}, {Name: "Test2", Email: "test2@gitea.com"}}
|
||||
msgs, err := composeIssueCommentMessages(&mailCommentContext{
|
||||
Context: context.TODO(), // TODO: use a correct context
|
||||
Context: context.TODO(),
|
||||
Issue: issue, Doer: doer, ActionType: activities_model.ActionCreateIssue,
|
||||
Content: "test body",
|
||||
}, "en-US", recipients, false, "issue create")
|
||||
@@ -178,14 +178,14 @@ func TestTemplateSelection(t *testing.T) {
|
||||
}
|
||||
|
||||
msg := testComposeIssueCommentMessage(t, &mailCommentContext{
|
||||
Context: context.TODO(), // TODO: use a correct context
|
||||
Context: context.TODO(),
|
||||
Issue: issue, Doer: doer, ActionType: activities_model.ActionCreateIssue,
|
||||
Content: "test body",
|
||||
}, recipients, false, "TestTemplateSelection")
|
||||
expect(t, msg, "issue/new/subject", "issue/new/body")
|
||||
|
||||
msg = testComposeIssueCommentMessage(t, &mailCommentContext{
|
||||
Context: context.TODO(), // TODO: use a correct context
|
||||
Context: context.TODO(),
|
||||
Issue: issue, Doer: doer, ActionType: activities_model.ActionCommentIssue,
|
||||
Content: "test body", Comment: comment,
|
||||
}, recipients, false, "TestTemplateSelection")
|
||||
@@ -194,14 +194,14 @@ func TestTemplateSelection(t *testing.T) {
|
||||
pull := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 2, Repo: repo, Poster: doer})
|
||||
comment = unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{ID: 4, Issue: pull})
|
||||
msg = testComposeIssueCommentMessage(t, &mailCommentContext{
|
||||
Context: context.TODO(), // TODO: use a correct context
|
||||
Context: context.TODO(),
|
||||
Issue: pull, Doer: doer, ActionType: activities_model.ActionCommentPull,
|
||||
Content: "test body", Comment: comment,
|
||||
}, recipients, false, "TestTemplateSelection")
|
||||
expect(t, msg, "pull/comment/subject", "pull/comment/body")
|
||||
|
||||
msg = testComposeIssueCommentMessage(t, &mailCommentContext{
|
||||
Context: context.TODO(), // TODO: use a correct context
|
||||
Context: context.TODO(),
|
||||
Issue: issue, Doer: doer, ActionType: activities_model.ActionCloseIssue,
|
||||
Content: "test body", Comment: comment,
|
||||
}, recipients, false, "TestTemplateSelection")
|
||||
@@ -220,7 +220,7 @@ func TestTemplateServices(t *testing.T) {
|
||||
|
||||
recipients := []*user_model.User{{Name: "Test", Email: "test@gitea.com"}}
|
||||
msg := testComposeIssueCommentMessage(t, &mailCommentContext{
|
||||
Context: context.TODO(), // TODO: use a correct context
|
||||
Context: context.TODO(),
|
||||
Issue: issue, Doer: doer, ActionType: actionType,
|
||||
Content: "test body", Comment: comment,
|
||||
}, recipients, fromMention, "TestTemplateServices")
|
||||
@@ -263,7 +263,7 @@ func testComposeIssueCommentMessage(t *testing.T, ctx *mailCommentContext, recip
|
||||
func TestGenerateAdditionalHeaders(t *testing.T) {
|
||||
doer, _, issue, _ := prepareMailerTest(t)
|
||||
|
||||
ctx := &mailCommentContext{Context: context.TODO() /* TODO: use a correct context */, Issue: issue, Doer: doer}
|
||||
ctx := &mailCommentContext{Context: context.TODO(), Issue: issue, Doer: doer}
|
||||
recipient := &user_model.User{Name: "test", Email: "test@gitea.com"}
|
||||
|
||||
headers := generateAdditionalHeaders(ctx, "dummy-reason", recipient)
|
||||
|
Reference in New Issue
Block a user