diff options
author | 2024-06-07 01:51:13 -0700 | |
---|---|---|
committer | 2024-06-07 10:51:13 +0200 | |
commit | afcfa48a7dfc87e35ba32c42b1f37405565a5087 (patch) | |
tree | 2639a14b80046914e83f8a7f08f041e6cdfc19d4 /internal/processing/filters/v1 | |
parent | [bugfix] Filter fixes (#2971) (diff) | |
download | gotosocial-afcfa48a7dfc87e35ba32c42b1f37405565a5087.tar.xz |
[feature] Implement filters_changed stream event (#2972)
Diffstat (limited to 'internal/processing/filters/v1')
-rw-r--r-- | internal/processing/filters/v1/create.go | 10 | ||||
-rw-r--r-- | internal/processing/filters/v1/delete.go | 3 | ||||
-rw-r--r-- | internal/processing/filters/v1/filters.go | 5 | ||||
-rw-r--r-- | internal/processing/filters/v1/update.go | 10 |
4 files changed, 25 insertions, 3 deletions
diff --git a/internal/processing/filters/v1/create.go b/internal/processing/filters/v1/create.go index e36d6800a..4d8ffc3e1 100644 --- a/internal/processing/filters/v1/create.go +++ b/internal/processing/filters/v1/create.go @@ -83,5 +83,13 @@ func (p *Processor) Create(ctx context.Context, account *gtsmodel.Account, form return nil, gtserror.NewErrorInternalError(err) } - return p.apiFilter(ctx, filterKeyword) + apiFilter, errWithCode := p.apiFilter(ctx, filterKeyword) + if errWithCode != nil { + return nil, errWithCode + } + + // Send a filters changed event. + p.stream.FiltersChanged(ctx, account) + + return apiFilter, nil } diff --git a/internal/processing/filters/v1/delete.go b/internal/processing/filters/v1/delete.go index f2312f039..89282c65d 100644 --- a/internal/processing/filters/v1/delete.go +++ b/internal/processing/filters/v1/delete.go @@ -63,5 +63,8 @@ func (p *Processor) Delete( } } + // Send a filters changed event. + p.stream.FiltersChanged(ctx, account) + return nil } diff --git a/internal/processing/filters/v1/filters.go b/internal/processing/filters/v1/filters.go index d46c9e72c..daa9087a9 100644 --- a/internal/processing/filters/v1/filters.go +++ b/internal/processing/filters/v1/filters.go @@ -18,6 +18,7 @@ package v1 import ( + "github.com/superseriousbusiness/gotosocial/internal/processing/stream" "github.com/superseriousbusiness/gotosocial/internal/state" "github.com/superseriousbusiness/gotosocial/internal/typeutils" ) @@ -25,11 +26,13 @@ import ( type Processor struct { state *state.State converter *typeutils.Converter + stream *stream.Processor } -func New(state *state.State, converter *typeutils.Converter) Processor { +func New(state *state.State, converter *typeutils.Converter, stream *stream.Processor) Processor { return Processor{ state: state, converter: converter, + stream: stream, } } diff --git a/internal/processing/filters/v1/update.go b/internal/processing/filters/v1/update.go index 0421dc786..2c2fe5574 100644 --- a/internal/processing/filters/v1/update.go +++ b/internal/processing/filters/v1/update.go @@ -163,5 +163,13 @@ func (p *Processor) Update( return nil, gtserror.NewErrorInternalError(err) } - return p.apiFilter(ctx, filterKeyword) + apiFilter, errWithCode := p.apiFilter(ctx, filterKeyword) + if errWithCode != nil { + return nil, errWithCode + } + + // Send a filters changed event. + p.stream.FiltersChanged(ctx, account) + + return apiFilter, nil } |