From 5a7ab86b985ed09782f06047901ca8c1ca3cdea9 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Sat, 7 Oct 2023 03:00:53 +0900 Subject: [PATCH] Avoid run change title process when the title is same (#27467) If user only changed the target branch or just did nothing and clicked the `Save` button, you will see the change log as following: ![image](https://github.com/go-gitea/gitea/assets/18380374/d30927dd-9227-4653-8fac-b890ef0b3f88) This makes no sense, so we should check whether the title is surely changed before run the `ChangeTitle`. --- services/issue/issue.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/issue/issue.go b/services/issue/issue.go index 198dc0b2e1..b1f418c32e 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -53,6 +53,10 @@ func ChangeTitle(ctx context.Context, issue *issues_model.Issue, doer *user_mode oldTitle := issue.Title issue.Title = title + if oldTitle == title { + return nil + } + if err := issues_model.ChangeIssueTitle(ctx, issue, doer, oldTitle); err != nil { return err }