summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/filter.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/gtsmodel/filter.go')
-rw-r--r--internal/gtsmodel/filter.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/gtsmodel/filter.go b/internal/gtsmodel/filter.go
index b1e8f5cac..e670e6fc0 100644
--- a/internal/gtsmodel/filter.go
+++ b/internal/gtsmodel/filter.go
@@ -40,6 +40,12 @@ type Filter struct {
ContextAccount *bool `bun:",nullzero,notnull,default:false"` // Apply filter when viewing an account profile.
}
+// Expired returns whether the filter has expired at a given time.
+// Filters without an expiration timestamp never expire.
+func (f *Filter) Expired(now time.Time) bool {
+ return !f.ExpiresAt.IsZero() && !f.ExpiresAt.After(now)
+}
+
// FilterKeyword stores a single keyword to filter statuses against.
type FilterKeyword struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database