Skip to content

Commit 55bdbdd

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: [skip ci] Updated translations via Crowdin Remove unused code (go-gitea#25734) Fix commits table regression (go-gitea#25710) Fix inconsistent user profile layout across tabs (go-gitea#25625) Simplify the LFS GC logger usage (go-gitea#25717) Allow/fix review (approve/reject) of empty PRs (go-gitea#25690) Correct permissions for `.ssh` and `authorized_keys` (go-gitea#25721) Sync branches when mirroring (go-gitea#25722)
2 parents 3f41e38 + b1eb167 commit 55bdbdd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+757
-665
lines changed

docker/root/etc/s6/gitea/setup

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
if [ ! -d /data/git/.ssh ]; then
44
mkdir -p /data/git/.ssh
5-
chmod 700 /data/git/.ssh
5+
fi
6+
7+
# Set the correct permissions on the .ssh directory and authorized_keys file,
8+
# or sshd will refuse to use them and lead to clone/push/pull failures.
9+
# It could happen when users have copied their data to a new volume and changed the file permission by accident,
10+
# and it would be very hard to troubleshoot unless users know how to check the logs of sshd which is started by s6.
11+
chmod 700 /data/git/.ssh
12+
if [ -f /data/git/.ssh/authorized_keys ]; then
13+
chmod 600 /data/git/.ssh/authorized_keys
614
fi
715

816
if [ ! -f /data/git/.ssh/environment ]; then

models/organization/org.go

-21
Original file line numberDiff line numberDiff line change
@@ -532,27 +532,6 @@ func GetOrgsCanCreateRepoByUserID(userID int64) ([]*Organization, error) {
532532
Find(&orgs)
533533
}
534534

535-
// GetOrgUsersByUserID returns all organization-user relations by user ID.
536-
func GetOrgUsersByUserID(uid int64, opts *SearchOrganizationsOptions) ([]*OrgUser, error) {
537-
ous := make([]*OrgUser, 0, 10)
538-
sess := db.GetEngine(db.DefaultContext).
539-
Join("LEFT", "`user`", "`org_user`.org_id=`user`.id").
540-
Where("`org_user`.uid=?", uid)
541-
if !opts.All {
542-
// Only show public organizations
543-
sess.And("is_public=?", true)
544-
}
545-
546-
if opts.PageSize != 0 {
547-
sess = db.SetSessionPagination(sess, opts)
548-
}
549-
550-
err := sess.
551-
Asc("`user`.name").
552-
Find(&ous)
553-
return ous, err
554-
}
555-
556535
// GetOrgUsersByOrgID returns all organization-user relations by organization ID.
557536
func GetOrgUsersByOrgID(ctx context.Context, opts *FindOrgMembersOpts) ([]*OrgUser, error) {
558537
sess := db.GetEngine(ctx).Where("org_id=?", opts.OrgID)

models/organization/org_test.go

-36
Original file line numberDiff line numberDiff line change
@@ -207,42 +207,6 @@ func TestFindOrgs(t *testing.T) {
207207
assert.EqualValues(t, 1, total)
208208
}
209209

210-
func TestGetOrgUsersByUserID(t *testing.T) {
211-
assert.NoError(t, unittest.PrepareTestDatabase())
212-
213-
orgUsers, err := organization.GetOrgUsersByUserID(5, &organization.SearchOrganizationsOptions{All: true})
214-
assert.NoError(t, err)
215-
if assert.Len(t, orgUsers, 3) {
216-
assert.Equal(t, organization.OrgUser{
217-
ID: orgUsers[0].ID,
218-
OrgID: 23,
219-
UID: 5,
220-
IsPublic: false,
221-
}, *orgUsers[0])
222-
assert.Equal(t, organization.OrgUser{
223-
ID: orgUsers[1].ID,
224-
OrgID: 6,
225-
UID: 5,
226-
IsPublic: true,
227-
}, *orgUsers[1])
228-
assert.Equal(t, organization.OrgUser{
229-
ID: orgUsers[2].ID,
230-
OrgID: 7,
231-
UID: 5,
232-
IsPublic: false,
233-
}, *orgUsers[2])
234-
}
235-
236-
publicOrgUsers, err := organization.GetOrgUsersByUserID(5, &organization.SearchOrganizationsOptions{All: false})
237-
assert.NoError(t, err)
238-
assert.Len(t, publicOrgUsers, 1)
239-
assert.Equal(t, *orgUsers[1], *publicOrgUsers[0])
240-
241-
orgUsers, err = organization.GetOrgUsersByUserID(1, &organization.SearchOrganizationsOptions{All: true})
242-
assert.NoError(t, err)
243-
assert.Len(t, orgUsers, 0)
244-
}
245-
246210
func TestGetOrgUsersByOrgID(t *testing.T) {
247211
assert.NoError(t, unittest.PrepareTestDatabase())
248212

models/user/user.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func GetUserFollowers(ctx context.Context, u, viewer *User, listOptions db.ListO
336336

337337
// GetUserFollowing returns range of user's following.
338338
func GetUserFollowing(ctx context.Context, u, viewer *User, listOptions db.ListOptions) ([]*User, int64, error) {
339-
sess := db.GetEngine(db.DefaultContext).
339+
sess := db.GetEngine(ctx).
340340
Select("`user`.*").
341341
Join("LEFT", "follow", "`user`.id=follow.follow_id").
342342
Where("follow.user_id=?", u.ID).

modules/context/org.go

-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
161161
}
162162
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
163163
ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember
164-
ctx.Data["IsProjectEnabled"] = true
165164
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
166165
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
167166
ctx.Data["IsPublicMember"] = func(uid int64) bool {

modules/doctor/lfs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func garbageCollectLFSCheck(ctx context.Context, logger log.Logger, autofix bool
3131
}
3232

3333
if err := repository.GarbageCollectLFSMetaObjects(ctx, repository.GarbageCollectLFSMetaObjectsOptions{
34-
Logger: logger,
35-
AutoFix: autofix,
34+
LogDetail: logger.Info,
35+
AutoFix: autofix,
3636
// Only attempt to garbage collect lfs meta objects older than a week as the order of git lfs upload
3737
// and git object upload is not necessarily guaranteed. It's possible to imagine a situation whereby
3838
// an LFS object is uploaded but the git branch is not uploaded immediately, or there are some rapid

modules/git/git.go

-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ func InitFull(ctx context.Context) (err error) {
188188
if CheckGitVersionAtLeast("2.9") == nil {
189189
globalCommandArgs = append(globalCommandArgs, "-c", "credential.helper=")
190190
}
191-
192191
SupportProcReceive = CheckGitVersionAtLeast("2.29") == nil
193192

194193
if setting.LFS.StartServer {

0 commit comments

Comments
 (0)