mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-21 17:24:10 +00:00
Move change issue title from models to issue service package (#8456)
* move change issue title from models to issue service package * make the change less * fix typo
This commit is contained in:
parent
9ff9f5ad1d
commit
46a12f196b
6 changed files with 71 additions and 61 deletions
|
@ -28,7 +28,6 @@ func updateIssueLock(opts *IssueLockOptions, lock bool) error {
|
|||
}
|
||||
|
||||
opts.Issue.IsLocked = lock
|
||||
|
||||
var commentType CommentType
|
||||
if opts.Issue.IsLocked {
|
||||
commentType = CommentTypeLock
|
||||
|
@ -36,16 +35,26 @@ func updateIssueLock(opts *IssueLockOptions, lock bool) error {
|
|||
commentType = CommentTypeUnlock
|
||||
}
|
||||
|
||||
if err := UpdateIssueCols(opts.Issue, "is_locked"); err != nil {
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
if err := sess.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := CreateComment(&CreateCommentOptions{
|
||||
if err := updateIssueCols(sess, opts.Issue, "is_locked"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := createComment(sess, &CreateCommentOptions{
|
||||
Doer: opts.Doer,
|
||||
Issue: opts.Issue,
|
||||
Repo: opts.Issue.Repo,
|
||||
Type: commentType,
|
||||
Content: opts.Reason,
|
||||
})
|
||||
return err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return sess.Commit()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue