Skip to content

Commit

Permalink
improve empty notice (go-gitea#15890)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored May 16, 2021
1 parent 3a04d6f commit 0bf8d34
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ func DeleteNotice(id int64) error {

// DeleteNotices deletes all notices with ID from start to end (inclusive).
func DeleteNotices(start, end int64) error {
if start == 0 && end == 0 {
_, err := x.Exec("DELETE FROM notice")
return err
}

sess := x.Where("id >= ?", start)
if end > 0 {
sess.And("id <= ?", end)
Expand Down

0 comments on commit 0bf8d34

Please sign in to comment.