From b4288f3c47a9ff9254b933dcb9ee7274d4a4135c Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 13 Jun 2021 18:42:28 +0200 Subject: Timeline manager (#40) * start messing about with timeline manager * i have no idea what i'm doing * i continue to not know what i'm doing * it's coming along * bit more progress * update timeline with new posts as they come in * lint and fmt * Select accounts where empty string * restructure a bunch, get unfaves working * moving stuff around * federate status deletes properly * mention regex better but not 100% there * fix regex * some more hacking away at the timeline code phew * fix up some little things * i can't even * more timeline stuff * move to ulid * fiddley * some lil fixes for kibou compatibility * timelines working pretty alright! * tidy + lint --- internal/db/db.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'internal/db/db.go') diff --git a/internal/db/db.go b/internal/db/db.go index 1774420c6..51685f024 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -143,7 +143,9 @@ type DB interface { // GetFollowersByAccountID is a shortcut for the common action of fetching a list of accounts that accountID is followed by. // The given slice 'followers' will be set to the result of the query, whatever it is. // In case of no entries, a 'no entries' error will be returned - GetFollowersByAccountID(accountID string, followers *[]gtsmodel.Follow) error + // + // If localOnly is set to true, then only followers from *this instance* will be returned. + GetFollowersByAccountID(accountID string, followers *[]gtsmodel.Follow, localOnly bool) error // GetFavesByAccountID is a shortcut for the common action of fetching a list of faves made by the given accountID. // The given slice 'faves' will be set to the result of the query, whatever it is. @@ -210,7 +212,7 @@ type DB interface { // 3. Accounts boosted by the target status // // Will return an error if something goes wrong while pulling stuff out of the database. - StatusVisible(targetStatus *gtsmodel.Status, targetAccount *gtsmodel.Account, requestingAccount *gtsmodel.Account, relevantAccounts *gtsmodel.RelevantAccounts) (bool, error) + StatusVisible(targetStatus *gtsmodel.Status, requestingAccount *gtsmodel.Account, relevantAccounts *gtsmodel.RelevantAccounts) (bool, error) // Follows returns true if sourceAccount follows target account, or an error if something goes wrong while finding out. Follows(sourceAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (bool, error) @@ -245,10 +247,6 @@ type DB interface { // StatusBookmarkedBy checks if a given status has been bookmarked by a given account ID StatusBookmarkedBy(status *gtsmodel.Status, accountID string) (bool, error) - // UnfaveStatus unfaves the given status, using accountID as the unfaver (sure, that's a word). - // The returned fave will be nil if the status was already not faved. - UnfaveStatus(status *gtsmodel.Status, accountID string) (*gtsmodel.StatusFave, error) - // WhoFavedStatus returns a slice of accounts who faved the given status. // This slice will be unfiltered, not taking account of blocks and whatnot, so filter it before serving it back to a user. WhoFavedStatus(status *gtsmodel.Status) ([]*gtsmodel.Account, error) @@ -257,9 +255,8 @@ type DB interface { // This slice will be unfiltered, not taking account of blocks and whatnot, so filter it before serving it back to a user. WhoBoostedStatus(status *gtsmodel.Status) ([]*gtsmodel.Account, error) - // GetHomeTimelineForAccount fetches the account's HOME timeline -- ie., posts and replies from people they *follow*. - // It will use the given filters and try to return as many statuses up to the limit as possible. - GetHomeTimelineForAccount(accountID string, maxID string, sinceID string, minID string, limit int, local bool) ([]*gtsmodel.Status, error) + // GetStatusesWhereFollowing returns a slice of statuses from accounts that are followed by the given account id. + GetStatusesWhereFollowing(accountID string, maxID string, sinceID string, minID string, limit int, local bool) ([]*gtsmodel.Status, error) // GetPublicTimelineForAccount fetches the account's PUBLIC timline -- ie., posts and replies that are public. // It will use the given filters and try to return as many statuses as possible up to the limit. -- cgit v1.2.3