This commit is contained in:
Lunny Xiao 2025-03-10 14:34:57 -07:00
parent 6658b8ec42
commit ec86404f8d
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 8 additions and 4 deletions

View File

@ -118,7 +118,7 @@ func Dashboard(ctx *context.Context) {
ctx.Data["HeatmapTotalContributions"] = activities_model.GetTotalContributionsInHeatmap(data)
}
feeds, count, err := feed_service.GetFeeds(ctx, activities_model.GetFeedsOptions{
feeds, count, err := feed_service.GetFeedsForDashboard(ctx, activities_model.GetFeedsOptions{
RequestedUser: ctxUser,
RequestedTeam: ctx.Org.Team,
Actor: ctx.Doer,

View File

@ -21,9 +21,8 @@ func userFeedCacheKey(userID int64) string {
return fmt.Sprintf("user_feed_%d", userID)
}
// GetFeeds returns actions according to the provided options
func GetFeeds(ctx context.Context, opts activities_model.GetFeedsOptions) (activities_model.ActionList, int64, error) {
opts.DontCount = opts.Actor != nil && opts.RequestedUser != nil && (opts.Actor.IsAdmin || opts.Actor.ID == opts.RequestedUser.ID)
func GetFeedsForDashboard(ctx context.Context, opts activities_model.GetFeedsOptions) (activities_model.ActionList, int64, error) {
opts.DontCount = opts.RequestedTeam == nil && opts.Date == ""
results, cnt, err := activities_model.GetFeeds(ctx, opts)
if err != nil {
return nil, 0, err
@ -36,6 +35,11 @@ func GetFeeds(ctx context.Context, opts activities_model.GetFeedsOptions) (activ
return results, cnt, err
}
// GetFeeds returns actions according to the provided options
func GetFeeds(ctx context.Context, opts activities_model.GetFeedsOptions) (activities_model.ActionList, int64, error) {
return activities_model.GetFeeds(ctx, opts)
}
// notifyWatchers creates batch of actions for every watcher.
// It could insert duplicate actions for a repository action, like this:
// * Original action: UserID=1 (the real actor), ActUserID=1