@@ -714,11 +714,6 @@ func updateIssueCols(e Engine, issue *Issue, cols ...string) error {
714714 return nil
715715}
716716
717- // UpdateIssueCols only updates values of specific columns for given issue.
718- func UpdateIssueCols (issue * Issue , cols ... string ) error {
719- return updateIssueCols (x , issue , cols ... )
720- }
721-
722717func (issue * Issue ) changeStatus (e * xorm.Session , doer * User , isClosed bool ) (err error ) {
723718 // Reload the issue
724719 currentIssue , err := getIssueByID (e , issue .ID )
@@ -844,9 +839,7 @@ func (issue *Issue) ChangeStatus(doer *User, isClosed bool) (err error) {
844839}
845840
846841// ChangeTitle changes the title of this issue, as the given user.
847- func (issue * Issue ) ChangeTitle (doer * User , title string ) (err error ) {
848- oldTitle := issue .Title
849- issue .Title = title
842+ func (issue * Issue ) ChangeTitle (doer * User , oldTitle string ) (err error ) {
850843 sess := x .NewSession ()
851844 defer sess .Close ()
852845
@@ -862,7 +855,7 @@ func (issue *Issue) ChangeTitle(doer *User, title string) (err error) {
862855 return fmt .Errorf ("loadRepo: %v" , err )
863856 }
864857
865- if _ , err = createChangeTitleComment (sess , doer , issue .Repo , issue , oldTitle , title ); err != nil {
858+ if _ , err = createChangeTitleComment (sess , doer , issue .Repo , issue , oldTitle , issue . Title ); err != nil {
866859 return fmt .Errorf ("createChangeTitleComment: %v" , err )
867860 }
868861
@@ -874,51 +867,7 @@ func (issue *Issue) ChangeTitle(doer *User, title string) (err error) {
874867 return err
875868 }
876869
877- if err = sess .Commit (); err != nil {
878- return err
879- }
880- sess .Close ()
881-
882- mode , _ := AccessLevel (issue .Poster , issue .Repo )
883- if issue .IsPull {
884- if err = issue .loadPullRequest (sess ); err != nil {
885- return fmt .Errorf ("loadPullRequest: %v" , err )
886- }
887- issue .PullRequest .Issue = issue
888- err = PrepareWebhooks (issue .Repo , HookEventPullRequest , & api.PullRequestPayload {
889- Action : api .HookIssueEdited ,
890- Index : issue .Index ,
891- Changes : & api.ChangesPayload {
892- Title : & api.ChangesFromPayload {
893- From : oldTitle ,
894- },
895- },
896- PullRequest : issue .PullRequest .APIFormat (),
897- Repository : issue .Repo .APIFormat (mode ),
898- Sender : doer .APIFormat (),
899- })
900- } else {
901- err = PrepareWebhooks (issue .Repo , HookEventIssues , & api.IssuePayload {
902- Action : api .HookIssueEdited ,
903- Index : issue .Index ,
904- Changes : & api.ChangesPayload {
905- Title : & api.ChangesFromPayload {
906- From : oldTitle ,
907- },
908- },
909- Issue : issue .APIFormat (),
910- Repository : issue .Repo .APIFormat (mode ),
911- Sender : issue .Poster .APIFormat (),
912- })
913- }
914-
915- if err != nil {
916- log .Error ("PrepareWebhooks [is_pull: %v]: %v" , issue .IsPull , err )
917- } else {
918- go HookQueue .Add (issue .RepoID )
919- }
920-
921- return nil
870+ return sess .Commit ()
922871}
923872
924873// AddDeletePRBranchComment adds delete branch comment for pull request issue
0 commit comments