Files
MokoGitea/services/convert/activity.go
Jonathan Miller c572fcfe04
PR RC Release / Build RC Release (pull_request) Failing after 0s
Branch Policy Check / Verify merge target (pull_request) Failing after 0s
chore(core): rename Go module from code.gitea.io/gitea to MokoGitea namespace
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>
2026-05-25 00:22:38 -05:00

53 lines
1.6 KiB
Go

// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package convert
import (
"context"
activities_model "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/activities"
perm_model "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/perm"
access_model "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/perm/access"
user_model "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/user"
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
api "git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/structs"
)
func ToActivity(ctx context.Context, ac *activities_model.Action, doer *user_model.User) *api.Activity {
p, err := access_model.GetDoerRepoPermission(ctx, ac.Repo, doer)
if err != nil {
log.Error("GetDoerRepoPermission[%d]: %v", ac.RepoID, err)
p.AccessMode = perm_model.AccessModeNone
}
result := &api.Activity{
ID: ac.ID,
UserID: ac.UserID,
OpType: ac.OpType.String(),
ActUserID: ac.ActUserID,
ActUser: ToUser(ctx, ac.ActUser, doer),
RepoID: ac.RepoID,
Repo: ToRepo(ctx, ac.Repo, p),
RefName: ac.RefName,
IsPrivate: ac.IsPrivate,
Content: ac.Content,
Created: ac.CreatedUnix.AsTime(),
}
if ac.Comment != nil {
result.CommentID = ac.CommentID
result.Comment = ToAPIComment(ctx, ac.Repo, ac.Comment)
}
return result
}
func ToActivities(ctx context.Context, al activities_model.ActionList, doer *user_model.User) []*api.Activity {
result := make([]*api.Activity, 0, len(al))
for _, ac := range al {
result = append(result, ToActivity(ctx, ac, doer))
}
return result
}