Skip to content

Commit 4facdc9

Browse files
committed
Revert "use xorm session"
This reverts commit c1de540.
1 parent c1de540 commit 4facdc9

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

models/issue_watch.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,7 @@ type IssueWatchList []*IssueWatch
2121

2222
// CreateOrUpdateIssueWatch set watching for a user and issue
2323
func CreateOrUpdateIssueWatch(userID, issueID int64, isWatching bool) error {
24-
sess := x.NewSession()
25-
defer sess.Close()
26-
27-
if err := sess.Begin(); err != nil {
28-
return err
29-
}
30-
if err := createOrUpdateIssueWatch(sess, userID, issueID, isWatching); err != nil {
31-
return err
32-
}
33-
34-
return sess.Commit()
35-
}
36-
37-
func createOrUpdateIssueWatch(e Engine, userID, issueID int64, isWatching bool) error {
38-
iw, exists, err := getIssueWatch(e, userID, issueID)
24+
iw, exists, err := getIssueWatch(x, userID, issueID)
3925
if err != nil {
4026
return err
4127
}
@@ -47,13 +33,13 @@ func createOrUpdateIssueWatch(e Engine, userID, issueID int64, isWatching bool)
4733
IsWatching: isWatching,
4834
}
4935

50-
if _, err := e.Insert(iw); err != nil {
36+
if _, err := x.Insert(iw); err != nil {
5137
return err
5238
}
5339
} else {
5440
iw.IsWatching = isWatching
5541

56-
if _, err := e.ID(iw.ID).Cols("is_watching", "updated_unix").Update(iw); err != nil {
42+
if _, err := x.ID(iw.ID).Cols("is_watching", "updated_unix").Update(iw); err != nil {
5743
return err
5844
}
5945
}

0 commit comments

Comments
 (0)