forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Show lock owner instead of repo owner on LFS setting page (go-gitea#31788) Move repository visibility to danger zone in the settings area (go-gitea#31126) [skip ci] Updated translations via Crowdin Add types to various low-level functions (go-gitea#31781) Add warning message in merge instructions when `AutodetectManualMerge` was not enabled (go-gitea#31805) Show latest run when visit /run/latest (go-gitea#31808) Fix typo for `LOG_COMPRESSION` in ini (go-gitea#31809) Add label `docs-update-needed` for PRs that modify `app.example.ini` (go-gitea#31810) Fix `IsObjectExist` with gogit (go-gitea#31790) Support compression for Actions logs (go-gitea#31761) Add issue comment when moving issues from one column to another of the project (go-gitea#29311) [skip ci] Updated translations via Crowdin Fix RPM resource leak (go-gitea#31794)
- Loading branch information
Showing
60 changed files
with
1,416 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2024 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package git | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"code.gitea.io/gitea/models/db" | ||
user_model "code.gitea.io/gitea/models/user" | ||
"code.gitea.io/gitea/modules/container" | ||
) | ||
|
||
// LFSLockList is a list of LFSLock | ||
type LFSLockList []*LFSLock | ||
|
||
// LoadAttributes loads the attributes for the given locks | ||
func (locks LFSLockList) LoadAttributes(ctx context.Context) error { | ||
if len(locks) == 0 { | ||
return nil | ||
} | ||
|
||
if err := locks.LoadOwner(ctx); err != nil { | ||
return fmt.Errorf("load owner: %w", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// LoadOwner loads the owner of the locks | ||
func (locks LFSLockList) LoadOwner(ctx context.Context) error { | ||
if len(locks) == 0 { | ||
return nil | ||
} | ||
|
||
usersIDs := container.FilterSlice(locks, func(lock *LFSLock) (int64, bool) { | ||
return lock.OwnerID, true | ||
}) | ||
users := make(map[int64]*user_model.User, len(usersIDs)) | ||
if err := db.GetEngine(ctx). | ||
In("id", usersIDs). | ||
Find(&users); err != nil { | ||
return fmt.Errorf("find users: %w", err) | ||
} | ||
for _, v := range locks { | ||
v.Owner = users[v.OwnerID] | ||
if v.Owner == nil { // not exist | ||
v.Owner = user_model.NewGhostUser() | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2024 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package v1_23 //nolint | ||
|
||
import ( | ||
"xorm.io/xorm" | ||
) | ||
|
||
// CommentMetaData stores metadata for a comment, these data will not be changed once inserted into database | ||
type CommentMetaData struct { | ||
ProjectColumnID int64 `json:"project_column_id"` | ||
ProjectColumnTitle string `json:"project_column_title"` | ||
ProjectTitle string `json:"project_title"` | ||
} | ||
|
||
func AddCommentMetaDataColumn(x *xorm.Engine) error { | ||
type Comment struct { | ||
CommentMetaData *CommentMetaData `xorm:"JSON TEXT"` // put all non-index metadata in a single field | ||
} | ||
|
||
return x.Sync(new(Comment)) | ||
} |
Oops, something went wrong.