diff options
author | 2024-06-06 11:16:20 -0700 | |
---|---|---|
committer | 2024-06-06 20:16:20 +0200 | |
commit | e605788b4bd624d68c6a499b943f186c9ac3ebe3 (patch) | |
tree | df25b2f67f5620ef4cd4a18195629c1b8b1bc4ad /internal/gtsmodel/filter.go | |
parent | [feature] User muting (#2960) (diff) | |
download | gotosocial-e605788b4bd624d68c6a499b943f186c9ac3ebe3.tar.xz |
[bugfix] Filter fixes (#2971)
* Add Filter.Expired convenience method, consistent with mutes
* Add missing Swagger for filter keyword/status delete and for 403s on moved accounts
Diffstat (limited to 'internal/gtsmodel/filter.go')
-rw-r--r-- | internal/gtsmodel/filter.go | 6 |
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 |