mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 12:12:24 -05:00
[chore] some tidy ups (#3677)
* small formatting changes (no logic) * improve code comments * fix import cycle * shutup stinky linter
This commit is contained in:
parent
3617e27afa
commit
726d2ba483
6 changed files with 51 additions and 47 deletions
|
|
@ -30,7 +30,9 @@ import (
|
|||
|
||||
// Sender can send Web Push notifications.
|
||||
type Sender interface {
|
||||
// Send queues up a notification for delivery to all of an account's Web Push subscriptions.
|
||||
|
||||
// Send queues up a notification for delivery to
|
||||
// all of an account's Web Push subscriptions.
|
||||
Send(
|
||||
ctx context.Context,
|
||||
notification *gtsmodel.Notification,
|
||||
|
|
@ -41,14 +43,26 @@ type Sender interface {
|
|||
|
||||
// NewSender creates a new sender from an HTTP client, DB, and worker pool.
|
||||
func NewSender(httpClient *httpclient.Client, state *state.State, converter *typeutils.Converter) Sender {
|
||||
return NewRealSender(
|
||||
&http.Client{
|
||||
Transport: >sHTTPClientRoundTripper{
|
||||
httpClient: httpClient,
|
||||
},
|
||||
// Other fields are already set on the http.Client inside the httpclient.Client.
|
||||
return &realSender{
|
||||
httpClient: &http.Client{
|
||||
// Pass in our wrapped httpclient.Client{}
|
||||
// type as http.Transport{} in order to take
|
||||
// advantage of retries, SSF protection etc.
|
||||
Transport: httpClient,
|
||||
|
||||
// Other http.Client{} fields are already
|
||||
// set in embedded httpclient.Client{}.
|
||||
},
|
||||
state,
|
||||
converter,
|
||||
)
|
||||
state: state,
|
||||
converter: converter,
|
||||
}
|
||||
}
|
||||
|
||||
// an internal function purely existing for the webpush test package to link to and use a custom http.Client{}.
|
||||
func newSenderWith(client *http.Client, state *state.State, converter *typeutils.Converter) Sender { //nolint:unused
|
||||
return &realSender{
|
||||
httpClient: client,
|
||||
state: state,
|
||||
converter: converter,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue