summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-05-16 19:58:26 +0800
committerGitHub <noreply@github.com>2021-05-16 19:58:26 +0800
commit0bf8d34630a9f4fa9314dfa1ecbd32505f341675 (patch)
treeaafd0302defd48fab32c5f5474c4b0e9f98b10cd /models
parent3a04d6f43f429957323dd58d0e720d8d3bf7fee1 (diff)
downloadgitea-0bf8d34630a9f4fa9314dfa1ecbd32505f341675.tar.gz
gitea-0bf8d34630a9f4fa9314dfa1ecbd32505f341675.zip
improve empty notice (#15890)
Diffstat (limited to 'models')
-rw-r--r--models/admin.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/admin.go b/models/admin.go
index 7911ce7511..3a784d6696 100644
--- a/models/admin.go
+++ b/models/admin.go
@@ -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)