c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
61 lines
2.2 KiB
Go
61 lines
2.2 KiB
Go
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package repo
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/unit"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/setting"
|
|
)
|
|
|
|
// ___________.__ ___________ __
|
|
// \__ ___/|__| _____ ___\__ ___/___________ ____ | | __ ___________
|
|
// | | | |/ \_/ __ \| | \_ __ \__ \ _/ ___\| |/ // __ \_ __ \
|
|
// | | | | Y Y \ ___/| | | | \// __ \\ \___| <\ ___/| | \/
|
|
// |____| |__|__|_| /\___ >____| |__| (____ /\___ >__|_ \\___ >__|
|
|
// \/ \/ \/ \/ \/ \/
|
|
|
|
// CanEnableTimetracker returns true when the server admin enabled time tracking
|
|
// This overrules IsTimetrackerEnabled
|
|
func (repo *Repository) CanEnableTimetracker() bool {
|
|
return setting.Service.EnableTimetracking
|
|
}
|
|
|
|
// IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
|
|
func (repo *Repository) IsTimetrackerEnabled(ctx context.Context) bool {
|
|
if !setting.Service.EnableTimetracking {
|
|
return false
|
|
}
|
|
|
|
var u *RepoUnit
|
|
var err error
|
|
if u, err = repo.GetUnit(ctx, unit.TypeIssues); err != nil {
|
|
return setting.Service.DefaultEnableTimetracking
|
|
}
|
|
return u.IssuesConfig().EnableTimetracker
|
|
}
|
|
|
|
// AllowOnlyContributorsToTrackTime returns value of IssuesConfig or the default value
|
|
func (repo *Repository) AllowOnlyContributorsToTrackTime(ctx context.Context) bool {
|
|
var u *RepoUnit
|
|
var err error
|
|
if u, err = repo.GetUnit(ctx, unit.TypeIssues); err != nil {
|
|
return setting.Service.DefaultAllowOnlyContributorsToTrackTime
|
|
}
|
|
return u.IssuesConfig().AllowOnlyContributorsToTrackTime
|
|
}
|
|
|
|
// IsDependenciesEnabled returns if dependencies are enabled and returns the default setting if not set.
|
|
func (repo *Repository) IsDependenciesEnabled(ctx context.Context) bool {
|
|
var u *RepoUnit
|
|
var err error
|
|
if u, err = repo.GetUnit(ctx, unit.TypeIssues); err != nil {
|
|
log.Trace("IsDependenciesEnabled: %v", err)
|
|
return setting.Service.DefaultEnableDependencies
|
|
}
|
|
return u.IssuesConfig().EnableDependencies
|
|
}
|