mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-09 17:38:06 -06:00
Serve outbox for Actor (#289)
* add statusesvisible convenience function * add minID + onlyPublic to account statuses get * move swagger collection stuff to common * start working on Outbox GETting * move functions into federationProcessor * outboxToASCollection * add statusesvisible convenience function * add minID + onlyPublic to account statuses get * move swagger collection stuff to common * start working on Outbox GETting * move functions into federationProcessor * outboxToASCollection * bit more work on outbox paging * wrapNoteInCreate function * test + hook up the processor functions * don't do prev + next links on empty reply * test get outbox through api * don't fail on no status entries * add outbox implementation doc * typo
This commit is contained in:
parent
26a95ad27d
commit
4b1d9d3780
38 changed files with 1851 additions and 470 deletions
|
|
@ -32,6 +32,10 @@ type Filter interface {
|
|||
// or account domains, and other relevant accounts mentioned in or replied to by the status.
|
||||
StatusVisible(ctx context.Context, targetStatus *gtsmodel.Status, requestingAccount *gtsmodel.Account) (bool, error)
|
||||
|
||||
// StatusesVisible calls StatusVisible for each status in the statuses slice, and returns a slice of only
|
||||
// statuses which are visible to the requestingAccount.
|
||||
StatusesVisible(ctx context.Context, statuses []*gtsmodel.Status, requestingAccount *gtsmodel.Account) ([]*gtsmodel.Status, error)
|
||||
|
||||
// StatusHometimelineable returns true if targetStatus should be in the home timeline of the requesting account.
|
||||
//
|
||||
// This function will call StatusVisible internally, so it's not necessary to call it beforehand.
|
||||
|
|
|
|||
|
|
@ -239,3 +239,17 @@ func (f *filter) StatusVisible(ctx context.Context, targetStatus *gtsmodel.Statu
|
|||
// If we reached here, all is okay
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (f *filter) StatusesVisible(ctx context.Context, statuses []*gtsmodel.Status, requestingAccount *gtsmodel.Account) ([]*gtsmodel.Status, error) {
|
||||
filtered := []*gtsmodel.Status{}
|
||||
for _, s := range statuses {
|
||||
visible, err := f.StatusVisible(ctx, s, requestingAccount)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if visible {
|
||||
filtered = append(filtered, s)
|
||||
}
|
||||
}
|
||||
return filtered, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue