Skip to content

Commit 0bf8d34

Browse files
authored
improve empty notice (#15890)
1 parent 3a04d6f commit 0bf8d34

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

models/admin.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ func DeleteNotice(id int64) error {
114114

115115
// DeleteNotices deletes all notices with ID from start to end (inclusive).
116116
func DeleteNotices(start, end int64) error {
117+
if start == 0 && end == 0 {
118+
_, err := x.Exec("DELETE FROM notice")
119+
return err
120+
}
121+
117122
sess := x.Where("id >= ?", start)
118123
if end > 0 {
119124
sess.And("id <= ?", end)

0 commit comments

Comments
 (0)