forked from gitea/gitea
1
0
Fork 0

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`.
This commit is contained in:
yp05327 2023-10-07 03:00:53 +09:00 committed by GitHub
parent 7b79be24ca
commit 5a7ab86b98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -53,6 +53,10 @@ func ChangeTitle(ctx context.Context, issue *issues_model.Issue, doer *user_mode
oldTitle := issue.Title oldTitle := issue.Title
issue.Title = title issue.Title = title
if oldTitle == title {
return nil
}
if err := issues_model.ChangeIssueTitle(ctx, issue, doer, oldTitle); err != nil { if err := issues_model.ChangeIssueTitle(ctx, issue, doer, oldTitle); err != nil {
return err return err
} }