From 76449a989d9da928a974f31b3f088130134c0313 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sun, 16 Jun 2024 14:32:44 +0200 Subject: [PATCH] allow everyone to see full heatmap --- FORK.md | 6 ++++++ models/activities/action.go | 3 ++- models/activities/user_heatmap.go | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 FORK.md diff --git a/FORK.md b/FORK.md new file mode 100644 index 0000000000..ce3744fac1 --- /dev/null +++ b/FORK.md @@ -0,0 +1,6 @@ +# TudbuT FORK + +## Changes: + +- Allow anyone to see the activity heatmap in full + diff --git a/models/activities/action.go b/models/activities/action.go index b6c816f096..8c3019d929 100644 --- a/models/activities/action.go +++ b/models/activities/action.go @@ -440,6 +440,7 @@ type GetFeedsOptions struct { OnlyPerformedByActor bool // only actions performed by the original actor IncludeDeleted bool // include deleted actions Date string // the day we want activity for: YYYY-MM-DD + IncludeInaccessible bool // if inaccessible activities should be included } // GetFeeds returns actions according to the provided options @@ -526,7 +527,7 @@ func activityQueryCondition(ctx context.Context, opts GetFeedsOptions) (builder. } // check readable repositories by doer/actor - if opts.Actor == nil || !opts.Actor.IsAdmin { + if !opts.IncludeInaccessible && (opts.Actor == nil || !opts.Actor.IsAdmin) { cond = cond.And(builder.In("repo_id", repo_model.AccessibleRepoIDsQuery(opts.Actor))) } diff --git a/models/activities/user_heatmap.go b/models/activities/user_heatmap.go index 080075d793..baa6f8ee02 100644 --- a/models/activities/user_heatmap.go +++ b/models/activities/user_heatmap.go @@ -53,6 +53,7 @@ func getUserHeatmapData(ctx context.Context, user *user_model.User, team *organi // * For organizations actions by all users that were made in owned // repositories are counted. OnlyPerformedBy: !user.IsOrganization(), + IncludeInaccessible: true, }) if err != nil { return nil, err