mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-04 17:42:46 +00:00
[chore] Refresh origin acct before streaming notif
This commit is contained in:
parent
027a93facc
commit
73c1fead12
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/email"
|
"github.com/superseriousbusiness/gotosocial/internal/email"
|
||||||
|
"github.com/superseriousbusiness/gotosocial/internal/federation"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
|
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/processing/stream"
|
"github.com/superseriousbusiness/gotosocial/internal/processing/stream"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||||
|
@ -37,4 +38,5 @@ type Surface struct {
|
||||||
Stream *stream.Processor
|
Stream *stream.Processor
|
||||||
Filter *visibility.Filter
|
Filter *visibility.Filter
|
||||||
EmailSender email.Sender
|
EmailSender email.Sender
|
||||||
|
Federator *federation.Federator
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,6 +468,20 @@ func (s *Surface) Notify(
|
||||||
// with the state-y stuff.
|
// with the state-y stuff.
|
||||||
unlock()
|
unlock()
|
||||||
|
|
||||||
|
// Try to bring notif origin account is up to date,
|
||||||
|
// so receiver of the notif doesn't see an empty
|
||||||
|
// or out-of-date avatar in the stream.
|
||||||
|
updatedOrigin, _, err := s.Federator.RefreshAccount(
|
||||||
|
ctx,
|
||||||
|
targetAccount.Username,
|
||||||
|
originAccount,
|
||||||
|
nil,
|
||||||
|
nil, // default freshness
|
||||||
|
)
|
||||||
|
if err == nil {
|
||||||
|
notif.OriginAccount = updatedOrigin
|
||||||
|
}
|
||||||
|
|
||||||
// Stream notification to the user.
|
// Stream notification to the user.
|
||||||
filters, err := s.State.DB.GetFiltersForAccountID(ctx, targetAccount.ID)
|
filters, err := s.State.DB.GetFiltersForAccountID(ctx, targetAccount.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -61,6 +61,7 @@ func New(
|
||||||
Stream: stream,
|
Stream: stream,
|
||||||
Filter: filter,
|
Filter: filter,
|
||||||
EmailSender: emailSender,
|
EmailSender: emailSender,
|
||||||
|
Federator: federator,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init shared util funcs.
|
// Init shared util funcs.
|
||||||
|
|
Loading…
Reference in a new issue