From 691fbdf1d362e77ab5eb2c42e51844b54a69b058 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 25 Jan 2017 22:54:52 +0800 Subject: [PATCH] fix: delete attachment after remove comment. --- models/issue_comment.go | 4 +++- vendor/github.com/go-xorm/xorm/engine.go | 4 +++- vendor/github.com/go-xorm/xorm/session_delete.go | 2 +- vendor/github.com/go-xorm/xorm/session_update.go | 2 +- vendor/vendor.json | 6 +++--- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index a17be97e72..bab002fcad 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -462,7 +462,9 @@ func DeleteComment(comment *Comment) error { return err } - if _, err := sess.Id(comment.ID).Delete(new(Comment)); err != nil { + if _, err := sess.Delete(&Comment{ + ID: comment.ID, + }); err != nil { return err } diff --git a/vendor/github.com/go-xorm/xorm/engine.go b/vendor/github.com/go-xorm/xorm/engine.go index 1ee1589c31..7bd0df6e89 100644 --- a/vendor/github.com/go-xorm/xorm/engine.go +++ b/vendor/github.com/go-xorm/xorm/engine.go @@ -573,7 +573,7 @@ func (engine *Engine) Id(id interface{}) *Session { return session.Id(id) } -// ID mehtod provoide a condition as (id) = ? +// ID method provoide a condition as (id) = ? func (engine *Engine) ID(id interface{}) *Session { session := engine.NewSession() session.IsAutoClose = true @@ -1599,6 +1599,8 @@ func (engine *Engine) formatTime(tz *time.Location, sqlTypeName string, t time.T return t } if tz != nil { + t = t.In(tz) + } else { t = engine.TZTime(t) } switch sqlTypeName { diff --git a/vendor/github.com/go-xorm/xorm/session_delete.go b/vendor/github.com/go-xorm/xorm/session_delete.go index 8c9193c209..1c458fe1ea 100644 --- a/vendor/github.com/go-xorm/xorm/session_delete.go +++ b/vendor/github.com/go-xorm/xorm/session_delete.go @@ -226,7 +226,7 @@ func (session *Session) Delete(bean interface{}) (int64, error) { session.afterDeleteBeans[bean] = &afterClosures } } else { - if _, ok := interface{}(bean).(AfterInsertProcessor); ok { + if _, ok := interface{}(bean).(AfterDeleteProcessor); ok { session.afterDeleteBeans[bean] = nil } } diff --git a/vendor/github.com/go-xorm/xorm/session_update.go b/vendor/github.com/go-xorm/xorm/session_update.go index 17e5672ed2..27e2deb0fe 100644 --- a/vendor/github.com/go-xorm/xorm/session_update.go +++ b/vendor/github.com/go-xorm/xorm/session_update.go @@ -333,7 +333,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6 } } else { - if _, ok := interface{}(bean).(AfterInsertProcessor); ok { + if _, ok := interface{}(bean).(AfterUpdateProcessor); ok { session.afterUpdateBeans[bean] = nil } } diff --git a/vendor/vendor.json b/vendor/vendor.json index 778edbd0b8..05e01d6e0e 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -455,10 +455,10 @@ "revisionTime": "2016-08-11T02:11:45Z" }, { - "checksumSHA1": "V3Sy7+JY2PVw3EkfajS4DxCDBg8=", + "checksumSHA1": "pbmrxOvDzdm40iRgnsS25Ig+33o=", "path": "github.com/go-xorm/xorm", - "revision": "57bcb65078410bcd5c7c8ee52d7494e7b5146a04", - "revisionTime": "2017-01-22T09:17:55Z" + "revision": "445a934d32ed0934aedf0ef99b4b7c69b22f8e58", + "revisionTime": "2017-01-25T11:54:21Z" }, { "checksumSHA1": "1ft/4j5MFa7C9dPI9whL03HSUzk=",