summaryrefslogtreecommitdiff
path: root/internal/processing/workers
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/workers')
-rw-r--r--internal/processing/workers/fromfediapi.go10
-rw-r--r--internal/processing/workers/fromfediapi_test.go46
2 files changed, 51 insertions, 5 deletions
diff --git a/internal/processing/workers/fromfediapi.go b/internal/processing/workers/fromfediapi.go
index 93b12d89c..86d868530 100644
--- a/internal/processing/workers/fromfediapi.go
+++ b/internal/processing/workers/fromfediapi.go
@@ -991,11 +991,6 @@ func (p *fediAPI) UpdateStatus(ctx context.Context, fMsg *messages.FromFediAPI)
}
}
- // Push message that the status has been edited to streams.
- if err := p.surface.timelineStatusUpdate(ctx, status); err != nil {
- log.Errorf(ctx, "error streaming status edit: %v", err)
- }
-
// Notify any *new* mentions added
// to this status by the editor.
for _, mention := range status.Mentions {
@@ -1015,6 +1010,11 @@ func (p *fediAPI) UpdateStatus(ctx context.Context, fMsg *messages.FromFediAPI)
}
}
+ // Push message that the status has been edited to streams.
+ if err := p.surface.timelineStatusUpdate(ctx, status); err != nil {
+ log.Errorf(ctx, "error streaming status edit: %v", err)
+ }
+
// Status representation changed, uncache from timelines.
p.surface.invalidateStatusFromTimelines(status.ID)
diff --git a/internal/processing/workers/fromfediapi_test.go b/internal/processing/workers/fromfediapi_test.go
index 9fe5cb0f4..203863e12 100644
--- a/internal/processing/workers/fromfediapi_test.go
+++ b/internal/processing/workers/fromfediapi_test.go
@@ -735,6 +735,52 @@ func (suite *FromFediAPITestSuite) TestUndoAnnounce() {
}
}
+func (suite *FromFediAPITestSuite) TestUpdateNote() {
+ var (
+ ctx = context.Background()
+ testStructs = testrig.SetupTestStructs(rMediaPath, rTemplatePath)
+ requestingAcct = suite.testAccounts["remote_account_2"]
+ receivingAcct = suite.testAccounts["local_account_1"]
+ )
+ defer testrig.TearDownTestStructs(testStructs)
+
+ update := testrig.NewTestActivities(suite.testAccounts)["remote_account_2_status_1_update"]
+ statusable := update.Activity.GetActivityStreamsObject().At(0).GetActivityStreamsNote()
+ noteURI := ap.GetJSONLDId(statusable)
+
+ // Get the OG status.
+ status, err := testStructs.State.DB.GetStatusByURI(ctx, noteURI.String())
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ // Process the Update.
+ err = testStructs.Processor.Workers().ProcessFromFediAPI(ctx, &messages.FromFediAPI{
+ APObjectType: ap.ObjectNote,
+ APActivityType: ap.ActivityUpdate,
+ GTSModel: status, // original status
+ APObject: (ap.Statusable)(statusable),
+ Receiving: receivingAcct,
+ Requesting: requestingAcct,
+ })
+ suite.NoError(err)
+
+ // Wait for side effects to trigger:
+ // zork should have a mention notif.
+ if !testrig.WaitFor(func() bool {
+ _, err := testStructs.State.DB.GetNotification(
+ gtscontext.SetBarebones(ctx),
+ gtsmodel.NotificationMention,
+ receivingAcct.ID,
+ requestingAcct.ID,
+ status.ID,
+ )
+ return err == nil
+ }) {
+ suite.FailNow("timed out waiting for mention notif")
+ }
+}
+
func TestFromFederatorTestSuite(t *testing.T) {
suite.Run(t, &FromFediAPITestSuite{})
}