mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 17:23:10 +00:00
fix: delete attachment after remove comment.
This commit is contained in:
parent
2831267db1
commit
691fbdf1d3
5 changed files with 11 additions and 7 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
4
vendor/github.com/go-xorm/xorm/engine.go
generated
vendored
4
vendor/github.com/go-xorm/xorm/engine.go
generated
vendored
|
@ -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 {
|
||||
|
|
2
vendor/github.com/go-xorm/xorm/session_delete.go
generated
vendored
2
vendor/github.com/go-xorm/xorm/session_delete.go
generated
vendored
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
2
vendor/github.com/go-xorm/xorm/session_update.go
generated
vendored
2
vendor/github.com/go-xorm/xorm/session_update.go
generated
vendored
|
@ -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
6
vendor/vendor.json
vendored
|
@ -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=",
|
||||
|
|
Loading…
Reference in a new issue