forked from NYANDEV/forgejo
#2052 Ability to batch delete system notices
This commit is contained in:
parent
834d38a8fb
commit
0be8b1b1a1
9 changed files with 32 additions and 6 deletions
|
@ -61,3 +61,13 @@ func DeleteNotice(id int64) error {
|
|||
_, err := x.Id(id).Delete(new(Notice))
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteNotices deletes all notices with ID from start to end (inclusive).
|
||||
func DeleteNotices(start, end int64) error {
|
||||
sess := x.Where("id >= ?", start)
|
||||
if end > 0 {
|
||||
sess.And("id <= ?", end)
|
||||
}
|
||||
_, err := sess.Delete(new(Notice))
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue