diff --git a/server/events/project_command_context_builder.go b/server/events/project_command_context_builder.go index a5906fa8fc..32917a4d02 100644 --- a/server/events/project_command_context_builder.go +++ b/server/events/project_command_context_builder.go @@ -16,17 +16,19 @@ func NewProjectCommandContextBulder(policyCheckEnabled bool, commentBuilder Comm CommentBuilder: commentBuilder, } + contextBuilderWithStats := &CommandScopedStatsProjectCommandContextBuilder{ + ProjectCommandContextBuilder: projectCommandContextBuilder, + ProjectCounter: scope.NewCounter("projects"), + } + if policyCheckEnabled { return &PolicyCheckProjectCommandContextBuilder{ CommentBuilder: commentBuilder, - ProjectCommandContextBuilder: projectCommandContextBuilder, + ProjectCommandContextBuilder: contextBuilderWithStats, } } - return &CommandScopedStatsProjectCommandContextBuilder{ - ProjectCommandContextBuilder: projectCommandContextBuilder, - ProjectCounter: scope.NewCounter("projects"), - } + return projectCommandContextBuilder } type ContextFlags struct { @@ -143,8 +145,8 @@ func (cb *DefaultProjectCommandContextBuilder) BuildProjectContext( } type PolicyCheckProjectCommandContextBuilder struct { - ProjectCommandContextBuilder *DefaultProjectCommandContextBuilder - CommentBuilder CommentBuilder + ProjectCommandContextBuilder + CommentBuilder CommentBuilder } func (cb *PolicyCheckProjectCommandContextBuilder) BuildProjectContext(