0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-22 08:48:17 +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
}
if _, err := sess.Id(comment.ID).Delete(new(Comment)); err != nil {
if _, err := sess.Delete(&Comment{
ID: comment.ID,
}); err != nil {
return err
}

View file

@ -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 {

View file

@ -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
}
}

View file

@ -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
}
}

6
vendor/vendor.json vendored
View file

@ -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=",