summaryrefslogtreecommitdiffstats
path: root/models/admin.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-01 23:33:08 -0500
committerUnknwon <u@gogs.io>2015-12-01 23:33:08 -0500
commit0be8b1b1a1bc828d0c64f5dbf6e642232590de46 (patch)
treeed24a34e71212cf190dfac764cee0b88ad12f35a /models/admin.go
parent834d38a8fbb4fc87b8f3914d5e2aab07a4d7e809 (diff)
downloadgitea-0be8b1b1a1bc828d0c64f5dbf6e642232590de46.tar.gz
gitea-0be8b1b1a1bc828d0c64f5dbf6e642232590de46.zip
#2052 Ability to batch delete system notices
Diffstat (limited to 'models/admin.go')
-rw-r--r--models/admin.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/admin.go b/models/admin.go
index e24e0026b8..f2ddf11efa 100644
--- a/models/admin.go
+++ b/models/admin.go
@@ -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
+}