Skip to content

Commit 0f8c04d

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: modules/setting/actions.go: fixed typo: ì->i (go-gitea#35253) Reload issue when sending webhook to make num comments is right. (go-gitea#35243) Update chroma to v2.20.0 (go-gitea#35220)
2 parents 424577a + 3450458 commit 0f8c04d

File tree

7 files changed

+18
-26
lines changed

7 files changed

+18
-26
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/ProtonMail/go-crypto v1.2.0
2828
github.com/PuerkitoBio/goquery v1.10.3
2929
github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.7.3
30-
github.com/alecthomas/chroma/v2 v2.17.0
30+
github.com/alecthomas/chroma/v2 v2.20.0
3131
github.com/aws/aws-sdk-go-v2/credentials v1.17.67
3232
github.com/aws/aws-sdk-go-v2/service/codecommit v1.28.2
3333
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.7.3/go.mod h1:hMNtySovKkn2
7878
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
7979
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
8080
github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs=
81-
github.com/alecthomas/chroma/v2 v2.17.0 h1:3r2Cgk+nXNICMBxIFGnTRTbQFUwMiLisW+9uos0TtUI=
82-
github.com/alecthomas/chroma/v2 v2.17.0/go.mod h1:RVX6AvYm4VfYe/zsk7mjHueLDZor3aWCNE14TFlepBk=
81+
github.com/alecthomas/chroma/v2 v2.20.0 h1:sfIHpxPyR07/Oylvmcai3X/exDlE8+FA820NTz+9sGw=
82+
github.com/alecthomas/chroma/v2 v2.20.0/go.mod h1:e7tViK0xh/Nf4BYHl00ycY6rV7b8iXBksI9E359yNmA=
8383
github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
84-
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
85-
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
84+
github.com/alecthomas/repr v0.5.1 h1:E3G4t2QbHTSNpPKBgMTln5KLkZHLOcU7r37J4pXBuIg=
85+
github.com/alecthomas/repr v0.5.1/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
8686
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7VVbI0o4wBRNQIgn917usHWOd6VAffYI=
8787
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
8888
github.com/anchore/archiver/v3 v3.5.2 h1:Bjemm2NzuRhmHy3m0lRe5tNoClB9A4zYyDV58PaB6aA=

modules/markup/orgmode/orgmode_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,10 @@ func TestRender_Source(t *testing.T) {
9797
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
9898
}
9999

100-
test(`#+begin_src go
101-
// HelloWorld prints "Hello World"
102-
func HelloWorld() {
103-
fmt.Println("Hello World")
104-
}
100+
test(`#+begin_src c
101+
int a;
105102
#+end_src
106-
`, `<div class="src src-go">
107-
<pre><code class="chroma language-go"><span class="c1">// HelloWorld prints &#34;Hello World&#34;</span>
108-
<span class="kd">func</span> <span class="nf">HelloWorld</span><span class="p">()</span> <span class="p">{</span>
109-
<span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="s">&#34;Hello World&#34;</span><span class="p">)</span>
110-
<span class="p">}</span></code></pre>
103+
`, `<div class="src src-c">
104+
<pre><code class="chroma language-c"><span class="kt">int</span> <span class="n">a</span><span class="p">;</span></code></pre>
111105
</div>`)
112106
}

modules/setting/actions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var (
2424
ZombieTaskTimeout time.Duration `ini:"ZOMBIE_TASK_TIMEOUT"`
2525
EndlessTaskTimeout time.Duration `ini:"ENDLESS_TASK_TIMEOUT"`
2626
AbandonedJobTimeout time.Duration `ini:"ABANDONED_JOB_TIMEOUT"`
27-
SkipWorkflowStrings []string `ìni:"SKIP_WORKFLOW_STRINGS"`
27+
SkipWorkflowStrings []string `ini:"SKIP_WORKFLOW_STRINGS"`
2828
}{
2929
Enabled: true,
3030
DefaultActionsURL: defaultActionsURLGitHub,

services/actions/notifier.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,6 @@ func (n *actionsNotifier) CreateIssueComment(ctx context.Context, doer *user_mod
263263
func (n *actionsNotifier) UpdateComment(ctx context.Context, doer *user_model.User, c *issues_model.Comment, oldContent string) {
264264
ctx = withMethod(ctx, "UpdateComment")
265265

266-
if err := c.LoadIssue(ctx); err != nil {
267-
log.Error("LoadIssue: %v", err)
268-
return
269-
}
270-
271266
if c.Issue.IsPull {
272267
notifyIssueCommentChange(ctx, doer, c, oldContent, webhook_module.HookEventPullRequestComment, api.HookIssueCommentEdited)
273268
return
@@ -278,11 +273,6 @@ func (n *actionsNotifier) UpdateComment(ctx context.Context, doer *user_model.Us
278273
func (n *actionsNotifier) DeleteComment(ctx context.Context, doer *user_model.User, comment *issues_model.Comment) {
279274
ctx = withMethod(ctx, "DeleteComment")
280275

281-
if err := comment.LoadIssue(ctx); err != nil {
282-
log.Error("LoadIssue: %v", err)
283-
return
284-
}
285-
286276
if comment.Issue.IsPull {
287277
notifyIssueCommentChange(ctx, doer, comment, "", webhook_module.HookEventPullRequestComment, api.HookIssueCommentDeleted)
288278
return
@@ -291,6 +281,7 @@ func (n *actionsNotifier) DeleteComment(ctx context.Context, doer *user_model.Us
291281
}
292282

293283
func notifyIssueCommentChange(ctx context.Context, doer *user_model.User, comment *issues_model.Comment, oldContent string, event webhook_module.HookEventType, action api.HookIssueCommentAction) {
284+
comment.Issue = nil // force issue to be loaded
294285
if err := comment.LoadIssue(ctx); err != nil {
295286
log.Error("LoadIssue: %v", err)
296287
return

services/issue/comments.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ func CreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_m
8080
return nil, err
8181
}
8282

83+
// reload issue to ensure it has the latest data, especially the number of comments
84+
issue, err = issues_model.GetIssueByID(ctx, issue.ID)
85+
if err != nil {
86+
return nil, err
87+
}
88+
8389
notify_service.CreateIssueComment(ctx, doer, repo, issue, comment, mentions)
8490

8591
return comment, nil

services/webhook/notifier.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ func (m *webhookNotifier) DeleteComment(ctx context.Context, doer *user_model.Us
481481
log.Error("LoadPoster: %v", err)
482482
return
483483
}
484+
comment.Issue = nil // reload issue to ensure it has the latest data, especially the number of comments
484485
if err = comment.LoadIssue(ctx); err != nil {
485486
log.Error("LoadIssue: %v", err)
486487
return

0 commit comments

Comments
 (0)