feat: Follow remote users; feed tab (#10380)

This is hopefully the final part of PR #4767, rebased and squashed.

More thorough federation tests are at https://code.forgejo.org/forgejo/end-to-end/pulls/1276 but the mock has been extended to hopefully cover a good chunk as well.

Co-authored-by: Gergely Nagy <forgejo@gergo.csillger.hu>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-authored-by: zam <mirco.zachmann@meissa.de>
Co-authored-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10380
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: famfo <famfo@famfo.xyz>
Co-committed-by: famfo <famfo@famfo.xyz>
This commit is contained in:
famfo 2026-04-12 03:31:03 +02:00 committed by Gusted
parent 9de142eb7f
commit fd28fd896b
26 changed files with 599 additions and 84 deletions

View file

@ -82,7 +82,7 @@ func GetFollowingFeeds(ctx context.Context, actorID int64, opts GetFollowingFeed
sess = db.SetSessionPagination(sess, &opts)
actions := make([]*FederatedUserActivity, 0, opts.PageSize)
count, err := sess.FindAndCount(&actions)
count, err := sess.Desc("`federated_user_activity`.created").FindAndCount(&actions)
if err != nil {
return nil, 0, fmt.Errorf("FindAndCount: %w", err)
}

View file

@ -5,6 +5,7 @@ package user
import (
"database/sql"
"fmt"
"forgejo.org/modules/validation"
)
@ -42,3 +43,18 @@ func (federatedUser FederatedUser) Validate() []string {
result = append(result, validation.ValidateNotEmpty(federatedUser.InboxPath, "InboxPath")...)
return result
}
func (federatedUser *FederatedUser) LogString() string {
if federatedUser == nil {
return "<FederatedUser nil>"
}
return fmt.Sprintf(
"<FederatedUser ID: %d, UserID: %d, ExternalID: %s, NormalizedOriginalURL: %s, InboxPath: %s>",
federatedUser.ID,
federatedUser.UserID,
federatedUser.ExternalID,
federatedUser.NormalizedOriginalURL,
federatedUser.InboxPath,
)
}