Skip to content

Commit

Permalink
fix issues after rebase on upstream/main
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaaaWhatsUpDoc committed Sep 12, 2024
1 parent 7c8429a commit c1a220e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion internal/api/client/lists/listaccountsadd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ func (suite *ListAccountsAddTestSuite) TestPostListAccountNotFollowed() {
}

func (suite *ListAccountsAddTestSuite) TestPostListAccountOK() {
entry := suite.testListEntries["local_account_1_list_1_entry_1"]

// Remove turtle from the list.
if err := suite.db.DeleteListEntry(
context.Background(),
suite.testListEntries["local_account_1_list_1_entry_1"].ID,
entry.ListID,
entry.FollowID,
); err != nil {
suite.FailNow(err.Error())
}
Expand Down
12 changes: 9 additions & 3 deletions internal/db/bundb/timeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (t *timelineDB) GetHomeTimeline(ctx context.Context, accountID string, maxI
// To take account of exclusive lists, get all of
// this account's lists, so we can filter out follows
// that are in contained in exclusive lists.
lists, err := t.state.DB.GetListsForAccountID(ctx, accountID)
lists, err := t.state.DB.GetListsByAccountID(ctx, accountID)
if err != nil && !errors.Is(err, db.ErrNoEntries) {
return nil, gtserror.Newf("db error getting lists for account %s: %w", accountID, err)
}
Expand All @@ -84,9 +84,15 @@ func (t *timelineDB) GetHomeTimeline(ctx context.Context, accountID string, maxI
continue
}

// Fetch all follow IDs of the entries ccontained in this list.
listFollowIDs, err := t.state.DB.GetFollowIDsInList(ctx, list.ID, nil)
if err != nil && !errors.Is(err, db.ErrNoEntries) {
return nil, gtserror.Newf("db error getting list entry follow ids: %w", err)
}

// Exclusive list, index all its follow IDs.
for _, listEntry := range list.ListEntries {
ignoreFollowIDs[listEntry.FollowID] = struct{}{}
for _, followID := range listFollowIDs {
ignoreFollowIDs[followID] = struct{}{}
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/db/bundb/timeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ func (suite *TimelineTestSuite) TestGetHomeTimelineIgnoreExclusive() {
suite.checkStatuses(s, id.Highest, id.Lowest, 8)

// Remove admin account from the exclusive list.
listEntryID := suite.testListEntries["local_account_1_list_1_entry_2"].ID
if err := suite.db.DeleteListEntry(ctx, listEntryID); err != nil {
listEntry := suite.testListEntries["local_account_1_list_1_entry_2"]
if err := suite.db.DeleteListEntry(ctx, listEntry.ListID, listEntry.FollowID); err != nil {
suite.FailNow(err.Error())
}

Expand Down

0 comments on commit c1a220e

Please sign in to comment.