mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-12 02:37:28 -06:00
Add Web Push sender (similar to email sender)
This commit is contained in:
parent
0cffb8784e
commit
0c92f9f0f3
16 changed files with 699 additions and 1 deletions
|
|
@ -51,6 +51,7 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/subscriptions"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/text"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
)
|
||||
|
||||
// Processor groups together processing functions and
|
||||
|
|
@ -188,6 +189,7 @@ func NewProcessor(
|
|||
mediaManager *mm.Manager,
|
||||
state *state.State,
|
||||
emailSender email.Sender,
|
||||
webPushSender webpush.Sender,
|
||||
visFilter *visibility.Filter,
|
||||
intFilter *interaction.Filter,
|
||||
) *Processor {
|
||||
|
|
@ -241,6 +243,7 @@ func NewProcessor(
|
|||
converter,
|
||||
visFilter,
|
||||
emailSender,
|
||||
webPushSender,
|
||||
&processor.account,
|
||||
&processor.media,
|
||||
&processor.stream,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/processing/stream"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
)
|
||||
|
||||
// Surface wraps functions for 'surfacing' the result
|
||||
|
|
@ -38,5 +39,6 @@ type Surface struct {
|
|||
Stream *stream.Processor
|
||||
VisFilter *visibility.Filter
|
||||
EmailSender email.Sender
|
||||
WebPushSender webpush.Sender
|
||||
Conversations *conversations.Processor
|
||||
}
|
||||
|
|
|
|||
|
|
@ -647,5 +647,10 @@ func (s *Surface) Notify(
|
|||
}
|
||||
s.Stream.Notify(ctx, targetAccount, apiNotif)
|
||||
|
||||
// Send Web Push notification to the user.
|
||||
if err = s.WebPushSender.Send(ctx, notif, filters, compiledMutes); err != nil {
|
||||
return gtserror.Newf("error sending Web Push notifications: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/processing/stream"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/workers"
|
||||
)
|
||||
|
||||
|
|
@ -44,6 +45,7 @@ func New(
|
|||
converter *typeutils.Converter,
|
||||
visFilter *visibility.Filter,
|
||||
emailSender email.Sender,
|
||||
webPushSender webpush.Sender,
|
||||
account *account.Processor,
|
||||
media *media.Processor,
|
||||
stream *stream.Processor,
|
||||
|
|
@ -65,6 +67,7 @@ func New(
|
|||
Stream: stream,
|
||||
VisFilter: visFilter,
|
||||
EmailSender: emailSender,
|
||||
WebPushSender: webPushSender,
|
||||
Conversations: conversations,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue