2019-10-30 14:06:25 +05:30
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2019-10-30 14:06:25 +05:30
|
|
|
|
|
|
|
package issue
|
|
|
|
|
|
|
|
import (
|
2023-09-15 11:43:19 +05:30
|
|
|
"context"
|
|
|
|
|
2022-06-13 15:07:59 +05:30
|
|
|
issues_model "code.gitea.io/gitea/models/issues"
|
2021-11-24 15:19:20 +05:30
|
|
|
user_model "code.gitea.io/gitea/models/user"
|
2023-09-06 00:07:47 +05:30
|
|
|
notify_service "code.gitea.io/gitea/services/notify"
|
2019-10-30 14:06:25 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
// ChangeContent changes issue content, as the given user.
|
2024-05-27 21:04:18 +05:30
|
|
|
func ChangeContent(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, content string, contentVersion int) (err error) {
|
2019-10-30 14:06:25 +05:30
|
|
|
oldContent := issue.Content
|
|
|
|
|
2024-05-27 21:04:18 +05:30
|
|
|
if err := issues_model.ChangeIssueContent(ctx, issue, doer, content, contentVersion); err != nil {
|
2019-10-30 14:06:25 +05:30
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-09-15 11:43:19 +05:30
|
|
|
notify_service.IssueChangeContent(ctx, doer, issue, oldContent)
|
2019-10-30 14:06:25 +05:30
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|