0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-16 15:01:07 +01:00

fix: delete attachment after remove comment.

This commit is contained in:
Bo-Yi Wu 2017-01-25 22:54:52 +08:00 committed by Kim "BKC" Carlbäcker
parent 2831267db1
commit 691fbdf1d3
5 changed files with 11 additions and 7 deletions

View file

@ -462,7 +462,9 @@ func DeleteComment(comment *Comment) error {
return err 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 return err
} }

View file

@ -573,7 +573,7 @@ func (engine *Engine) Id(id interface{}) *Session {
return session.Id(id) 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 { func (engine *Engine) ID(id interface{}) *Session {
session := engine.NewSession() session := engine.NewSession()
session.IsAutoClose = true session.IsAutoClose = true
@ -1599,6 +1599,8 @@ func (engine *Engine) formatTime(tz *time.Location, sqlTypeName string, t time.T
return t return t
} }
if tz != nil { if tz != nil {
t = t.In(tz)
} else {
t = engine.TZTime(t) t = engine.TZTime(t)
} }
switch sqlTypeName { switch sqlTypeName {

View file

@ -226,7 +226,7 @@ func (session *Session) Delete(bean interface{}) (int64, error) {
session.afterDeleteBeans[bean] = &afterClosures session.afterDeleteBeans[bean] = &afterClosures
} }
} else { } else {
if _, ok := interface{}(bean).(AfterInsertProcessor); ok { if _, ok := interface{}(bean).(AfterDeleteProcessor); ok {
session.afterDeleteBeans[bean] = nil session.afterDeleteBeans[bean] = nil
} }
} }

View file

@ -333,7 +333,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
} }
} else { } else {
if _, ok := interface{}(bean).(AfterInsertProcessor); ok { if _, ok := interface{}(bean).(AfterUpdateProcessor); ok {
session.afterUpdateBeans[bean] = nil session.afterUpdateBeans[bean] = nil
} }
} }

6
vendor/vendor.json vendored
View file

@ -455,10 +455,10 @@
"revisionTime": "2016-08-11T02:11:45Z" "revisionTime": "2016-08-11T02:11:45Z"
}, },
{ {
"checksumSHA1": "V3Sy7+JY2PVw3EkfajS4DxCDBg8=", "checksumSHA1": "pbmrxOvDzdm40iRgnsS25Ig+33o=",
"path": "github.com/go-xorm/xorm", "path": "github.com/go-xorm/xorm",
"revision": "57bcb65078410bcd5c7c8ee52d7494e7b5146a04", "revision": "445a934d32ed0934aedf0ef99b4b7c69b22f8e58",
"revisionTime": "2017-01-22T09:17:55Z" "revisionTime": "2017-01-25T11:54:21Z"
}, },
{ {
"checksumSHA1": "1ft/4j5MFa7C9dPI9whL03HSUzk=", "checksumSHA1": "1ft/4j5MFa7C9dPI9whL03HSUzk=",