diff options
author | 2021-10-04 15:24:19 +0200 | |
---|---|---|
committer | 2021-10-04 15:24:19 +0200 | |
commit | e04b187702acb0c9908237a35b3a9857e2167b3f (patch) | |
tree | 29839b8d5bbc28d34aba759a48dd7b005f1444f5 /internal/processing/fromcommon.go | |
parent | Follow request auto approval (#259) (diff) | |
download | gotosocial-e04b187702acb0c9908237a35b3a9857e2167b3f.tar.xz |
Refactor/tidy (#261)
* tidy up streaming
* cut down code duplication
* test get followers/following
* test streaming processor
* fix some test models
* add TimeMustParse
* fix uri / url typo
* make trace logging less verbose
* make logging more consistent
* disable quote on logging
* remove context.Background
* remove many extraneous mastodon references
* regenerate swagger
* don't log query on no rows result
* log latency first for easier reading
Diffstat (limited to 'internal/processing/fromcommon.go')
-rw-r--r-- | internal/processing/fromcommon.go | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/internal/processing/fromcommon.go b/internal/processing/fromcommon.go index e14c36fd4..88f9994d4 100644 --- a/internal/processing/fromcommon.go +++ b/internal/processing/fromcommon.go @@ -96,12 +96,12 @@ func (p *processor) notifyStatus(ctx context.Context, status *gtsmodel.Status) e } // now stream the notification to the user - mastoNotif, err := p.tc.NotificationToMasto(ctx, notif) + apiNotif, err := p.tc.NotificationToAPINotification(ctx, notif) if err != nil { - return fmt.Errorf("notifyStatus: error converting notification to masto representation: %s", err) + return fmt.Errorf("notifyStatus: error converting notification to api representation: %s", err) } - if err := p.streamingProcessor.StreamNotificationToAccount(mastoNotif, m.TargetAccount); err != nil { + if err := p.streamingProcessor.StreamNotificationToAccount(apiNotif, m.TargetAccount); err != nil { return fmt.Errorf("notifyStatus: error streaming notification to account: %s", err) } } @@ -143,12 +143,12 @@ func (p *processor) notifyFollowRequest(ctx context.Context, followRequest *gtsm } // now stream the notification to the user - mastoNotif, err := p.tc.NotificationToMasto(ctx, notif) + apiNotif, err := p.tc.NotificationToAPINotification(ctx, notif) if err != nil { - return fmt.Errorf("notifyStatus: error converting notification to masto representation: %s", err) + return fmt.Errorf("notifyStatus: error converting notification to api representation: %s", err) } - if err := p.streamingProcessor.StreamNotificationToAccount(mastoNotif, targetAccount); err != nil { + if err := p.streamingProcessor.StreamNotificationToAccount(apiNotif, targetAccount); err != nil { return fmt.Errorf("notifyStatus: error streaming notification to account: %s", err) } @@ -189,12 +189,12 @@ func (p *processor) notifyFollow(ctx context.Context, follow *gtsmodel.Follow, t } // now stream the notification to the user - mastoNotif, err := p.tc.NotificationToMasto(ctx, notif) + apiNotif, err := p.tc.NotificationToAPINotification(ctx, notif) if err != nil { - return fmt.Errorf("notifyStatus: error converting notification to masto representation: %s", err) + return fmt.Errorf("notifyStatus: error converting notification to api representation: %s", err) } - if err := p.streamingProcessor.StreamNotificationToAccount(mastoNotif, targetAccount); err != nil { + if err := p.streamingProcessor.StreamNotificationToAccount(apiNotif, targetAccount); err != nil { return fmt.Errorf("notifyStatus: error streaming notification to account: %s", err) } @@ -237,12 +237,12 @@ func (p *processor) notifyFave(ctx context.Context, fave *gtsmodel.StatusFave) e } // now stream the notification to the user - mastoNotif, err := p.tc.NotificationToMasto(ctx, notif) + apiNotif, err := p.tc.NotificationToAPINotification(ctx, notif) if err != nil { - return fmt.Errorf("notifyStatus: error converting notification to masto representation: %s", err) + return fmt.Errorf("notifyStatus: error converting notification to api representation: %s", err) } - if err := p.streamingProcessor.StreamNotificationToAccount(mastoNotif, targetAccount); err != nil { + if err := p.streamingProcessor.StreamNotificationToAccount(apiNotif, targetAccount); err != nil { return fmt.Errorf("notifyStatus: error streaming notification to account: %s", err) } @@ -316,12 +316,12 @@ func (p *processor) notifyAnnounce(ctx context.Context, status *gtsmodel.Status) } // now stream the notification to the user - mastoNotif, err := p.tc.NotificationToMasto(ctx, notif) + apiNotif, err := p.tc.NotificationToAPINotification(ctx, notif) if err != nil { - return fmt.Errorf("notifyStatus: error converting notification to masto representation: %s", err) + return fmt.Errorf("notifyStatus: error converting notification to api representation: %s", err) } - if err := p.streamingProcessor.StreamNotificationToAccount(mastoNotif, status.BoostOfAccount); err != nil { + if err := p.streamingProcessor.StreamNotificationToAccount(apiNotif, status.BoostOfAccount); err != nil { return fmt.Errorf("notifyStatus: error streaming notification to account: %s", err) } @@ -414,21 +414,21 @@ func (p *processor) timelineStatusForAccount(ctx context.Context, status *gtsmod // the status was inserted to stream it to the user if inserted { - mastoStatus, err := p.tc.StatusToMasto(ctx, status, timelineAccount) + apiStatus, err := p.tc.StatusToAPIStatus(ctx, status, timelineAccount) if err != nil { errors <- fmt.Errorf("timelineStatusForAccount: error converting status %s to frontend representation: %s", status.ID, err) } else { - if err := p.streamingProcessor.StreamStatusToAccount(mastoStatus, timelineAccount); err != nil { + if err := p.streamingProcessor.StreamUpdateToAccount(apiStatus, timelineAccount); err != nil { errors <- fmt.Errorf("timelineStatusForAccount: error streaming status %s: %s", status.ID, err) } } } - mastoStatus, err := p.tc.StatusToMasto(ctx, status, timelineAccount) + apiStatus, err := p.tc.StatusToAPIStatus(ctx, status, timelineAccount) if err != nil { errors <- fmt.Errorf("timelineStatusForAccount: error converting status %s to frontend representation: %s", status.ID, err) } else { - if err := p.streamingProcessor.StreamStatusToAccount(mastoStatus, timelineAccount); err != nil { + if err := p.streamingProcessor.StreamUpdateToAccount(apiStatus, timelineAccount); err != nil { errors <- fmt.Errorf("timelineStatusForAccount: error streaming status %s: %s", status.ID, err) } } |