Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Fix missed doer (go-gitea#30231)
  Add optional doctor storage init (go-gitea#30330)
  Avoid running action when action unit is disabled after workflows detected (go-gitea#30331)
  Avoid showing `Failed to change the default wiki branch` if repo has no wiki when saving repo settings (go-gitea#30329)
  • Loading branch information
zjjhot committed Apr 9, 2024
2 parents aa3428f + d7013c2 commit d5add2e
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 59 deletions.
5 changes: 4 additions & 1 deletion models/actions/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
Expand Down Expand Up @@ -227,7 +228,9 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
if runner.RepoID != 0 {
jobCond = builder.Eq{"repo_id": runner.RepoID}
} else if runner.OwnerID != 0 {
jobCond = builder.In("repo_id", builder.Select("id").From("repository").Where(builder.Eq{"owner_id": runner.OwnerID}))
jobCond = builder.In("repo_id", builder.Select("id").From("repository").
Join("INNER", "repo_unit", "`repository`.id = `repo_unit`.repo_id").
Where(builder.Eq{"`repository`.owner_id": runner.OwnerID, "`repo_unit`.type": unit.TypeActions}))
}
if jobCond.IsValid() {
jobCond = builder.In("run_id", builder.Select("id").From("action_run").Where(jobCond))
Expand Down
47 changes: 44 additions & 3 deletions options/locale/locale_id-ID.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1331,12 +1331,53 @@ runners.task_list.repository=Repositori
runners.task_list.commit=Memperbuat

runs.commit=Memperbuat



runs.no_matching_online_runner_helper=Tidak ada runner online yang cocok dengan label: %s
runs.actor=Aktor
runs.status=Status
runs.actors_no_select=Semua aktor
runs.status_no_select=Semua status
runs.no_results=Tidak ada hasil yang cocok.
runs.no_workflows=Belum ada alur kerja.
runs.no_workflows.quick_start=Tidak tahu cara memulai dengan Gitea Actions? Lihat <a target="_blank" rel="noopener noreferrer" href="%s">panduan cepat</a>.
runs.no_workflows.documentation=Untuk informasi lebih lanjut tentang Gitea Actions, lihat <a target="_blank" rel="noopener noreferrer" href="%s">dokumentasi</a>.
runs.no_runs=Alur kerja belum berjalan.
runs.empty_commit_message=(pesan commit kosong)

workflow.disable=Nonaktifkan Alur Kerja
workflow.disable_success=Alur kerja '%s' berhasil dinonaktifkan.
workflow.enable=Aktifkan Alur Kerja
workflow.enable_success=Alur kerja '%s' berhasil diaktifkan.
workflow.disabled=Alur kerja dinonaktifkan.

need_approval_desc=Butuh persetujuan untuk menjalankan alur kerja untuk pull request fork.

variables=Variabel
variables.management=Managemen Variabel
variables.creation=Tambah Variabel
variables.none=Belum ada variabel.
variables.deletion=Hapus variabel
variables.deletion.description=Menghapus variabel bersifat permanen dan tidak dapat dibatalkan. Lanjutkan?
variables.description=Variabel akan diteruskan ke beberapa tindakan dan tidak dapat dibaca sebaliknya.
variables.id_not_exist=Variabel dengan ID %d tidak ada.
variables.edit=Edit Variabel
variables.deletion.failed=Gagal menghapus variabel.
variables.deletion.success=Variabel telah dihapus.
variables.creation.failed=Gagal menambahkan variabel.
variables.creation.success=Variabel "%s" telah ditambahkan.
variables.update.failed=Gagal mengedit variabel.
variables.update.success=Variabel telah diedit.

[projects]
type-1.display_name=Proyek Individu
type-2.display_name=Proyek Repositori
type-3.display_name=Proyek Organisasi

[git.filemode]
changed_filemode=%[1]s → %[2]s
; Ordered by git filemode value, ascending. E.g. directory has "040000", normal file has "100644", …
directory=Directory
normal_file=Normal file
executable_file=Executable file
symbolic_link=Symbolic link
submodule=Submodule

10 changes: 5 additions & 5 deletions routers/api/v1/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func SearchIssues(ctx *context.APIContext) {

ctx.SetLinkHeader(int(total), limit)
ctx.SetTotalCountHeader(total)
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
}

// ListIssues list the issues of a repository
Expand Down Expand Up @@ -548,7 +548,7 @@ func ListIssues(ctx *context.APIContext) {

ctx.SetLinkHeader(int(total), listOptions.PageSize)
ctx.SetTotalCountHeader(total)
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
}

func getUserIDForFilter(ctx *context.APIContext, queryName string) int64 {
Expand Down Expand Up @@ -614,7 +614,7 @@ func GetIssue(ctx *context.APIContext) {
ctx.NotFound()
return
}
ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, issue))
ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, ctx.Doer, issue))
}

// CreateIssue create an issue of a repository
Expand Down Expand Up @@ -737,7 +737,7 @@ func CreateIssue(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetIssueByID", err)
return
}
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, issue))
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, issue))
}

// EditIssue modify an issue of a repository
Expand Down Expand Up @@ -911,7 +911,7 @@ func EditIssue(ctx *context.APIContext) {
ctx.InternalServerError(err)
return
}
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, issue))
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, issue))
}

func DeleteIssue(ctx *context.APIContext) {
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/repo/issue_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func ListIssueAttachments(ctx *context.APIContext) {
return
}

ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, issue).Attachments)
ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, ctx.Doer, issue).Attachments)
}

// CreateIssueAttachment creates an attachment and saves the given file
Expand Down
12 changes: 6 additions & 6 deletions routers/api/v1/repo/issue_dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func GetIssueDependencies(ctx *context.APIContext) {
blockerIssues = append(blockerIssues, &blocker.Issue)
}

ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, blockerIssues))
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, blockerIssues))
}

// CreateIssueDependency create a new issue dependencies
Expand Down Expand Up @@ -214,7 +214,7 @@ func CreateIssueDependency(ctx *context.APIContext) {
return
}

ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, target))
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, target))
}

// RemoveIssueDependency remove an issue dependency
Expand Down Expand Up @@ -275,7 +275,7 @@ func RemoveIssueDependency(ctx *context.APIContext) {
return
}

ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, target))
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, target))
}

// GetIssueBlocks list issues that are blocked by this issue
Expand Down Expand Up @@ -381,7 +381,7 @@ func GetIssueBlocks(ctx *context.APIContext) {
issues = append(issues, &depMeta.Issue)
}

ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
}

// CreateIssueBlocking block the issue given in the body by the issue in path
Expand Down Expand Up @@ -438,7 +438,7 @@ func CreateIssueBlocking(ctx *context.APIContext) {
return
}

ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, dependency))
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, dependency))
}

// RemoveIssueBlocking unblock the issue given in the body by the issue in path
Expand Down Expand Up @@ -495,7 +495,7 @@ func RemoveIssueBlocking(ctx *context.APIContext) {
return
}

ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, dependency))
ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, ctx.Doer, dependency))
}

func getParamsIssue(ctx *context.APIContext) *issues_model.Issue {
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/repo/issue_pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func ListPinnedIssues(ctx *context.APIContext) {
return
}

ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, ctx.Doer, issues))
}

// ListPinnedPullRequests returns a list of all pinned PRs
Expand Down
10 changes: 5 additions & 5 deletions routers/api/v1/repo/issue_tracked_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
}

ctx.SetTotalCountHeader(count)
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
}

// AddTime add time manual to the given issue
Expand Down Expand Up @@ -225,7 +225,7 @@ func AddTime(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
ctx.JSON(http.StatusOK, convert.ToTrackedTime(ctx, trackedTime))
ctx.JSON(http.StatusOK, convert.ToTrackedTime(ctx, user, trackedTime))
}

// ResetIssueTime reset time manual to the given issue
Expand Down Expand Up @@ -455,7 +455,7 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
}

// ListTrackedTimesByRepository lists all tracked times of the repository
Expand Down Expand Up @@ -567,7 +567,7 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
}

ctx.SetTotalCountHeader(count)
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
}

// ListMyTrackedTimes lists all tracked times of the current user
Expand Down Expand Up @@ -629,5 +629,5 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
}

ctx.SetTotalCountHeader(count)
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, ctx.Doer, trackedTimes))
}
6 changes: 3 additions & 3 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ func GetIssueInfo(ctx *context.Context) {
}
}

ctx.JSON(http.StatusOK, convert.ToIssue(ctx, issue))
ctx.JSON(http.StatusOK, convert.ToIssue(ctx, ctx.Doer, issue))
}

// UpdateIssueTitle change issue's title
Expand Down Expand Up @@ -2709,7 +2709,7 @@ func SearchIssues(ctx *context.Context) {
}

ctx.SetTotalCountHeader(total)
ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, ctx.Doer, issues))
}

func getUserIDForFilter(ctx *context.Context, queryName string) int64 {
Expand Down Expand Up @@ -2879,7 +2879,7 @@ func ListIssues(ctx *context.Context) {
}

ctx.SetTotalCountHeader(total)
ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, ctx.Doer, issues))
}

func BatchDeleteIssues(ctx *context.Context) {
Expand Down
6 changes: 6 additions & 0 deletions routers/web/repo/wiki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ func TestWikiRaw(t *testing.T) {
func TestDefaultWikiBranch(t *testing.T) {
unittest.PrepareTestEnv(t)

// repo with no wiki
repoWithNoWiki := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2})
assert.False(t, repoWithNoWiki.HasWiki())
assert.NoError(t, wiki_service.ChangeDefaultWikiBranch(db.DefaultContext, repoWithNoWiki, "main"))

// repo with wiki
assert.NoError(t, repo_model.UpdateRepositoryCols(db.DefaultContext, &repo_model.Repository{ID: 1, DefaultWikiBranch: "wrong-branch"}))

ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki")
Expand Down
10 changes: 5 additions & 5 deletions services/actions/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (n *actionsNotifier) NewIssue(ctx context.Context, issue *issues_model.Issu
newNotifyInputFromIssue(issue, webhook_module.HookEventIssues).WithPayload(&api.IssuePayload{
Action: api.HookIssueOpened,
Index: issue.Index,
Issue: convert.ToAPIIssue(ctx, issue),
Issue: convert.ToAPIIssue(ctx, issue.Poster, issue),
Repository: convert.ToRepo(ctx, issue.Repo, permission),
Sender: convert.ToUser(ctx, issue.Poster, nil),
}).Notify(withMethod(ctx, "NewIssue"))
Expand Down Expand Up @@ -89,7 +89,7 @@ func (n *actionsNotifier) IssueChangeContent(ctx context.Context, doer *user_mod
WithPayload(&api.IssuePayload{
Action: api.HookIssueEdited,
Index: issue.Index,
Issue: convert.ToAPIIssue(ctx, issue),
Issue: convert.ToAPIIssue(ctx, doer, issue),
Repository: convert.ToRepo(ctx, issue.Repo, permission),
Sender: convert.ToUser(ctx, doer, nil),
}).
Expand Down Expand Up @@ -127,7 +127,7 @@ func (n *actionsNotifier) IssueChangeStatus(ctx context.Context, doer *user_mode
}
apiIssue := &api.IssuePayload{
Index: issue.Index,
Issue: convert.ToAPIIssue(ctx, issue),
Issue: convert.ToAPIIssue(ctx, doer, issue),
Repository: convert.ToRepo(ctx, issue.Repo, permission),
Sender: convert.ToUser(ctx, doer, nil),
}
Expand Down Expand Up @@ -229,7 +229,7 @@ func notifyIssueChange(ctx context.Context, doer *user_model.User, issue *issues
WithPayload(&api.IssuePayload{
Action: action,
Index: issue.Index,
Issue: convert.ToAPIIssue(ctx, issue),
Issue: convert.ToAPIIssue(ctx, doer, issue),
Repository: convert.ToRepo(ctx, issue.Repo, permission),
Sender: convert.ToUser(ctx, doer, nil),
}).
Expand Down Expand Up @@ -293,7 +293,7 @@ func notifyIssueCommentChange(ctx context.Context, doer *user_model.User, commen

payload := &api.IssueCommentPayload{
Action: action,
Issue: convert.ToAPIIssue(ctx, comment.Issue),
Issue: convert.ToAPIIssue(ctx, doer, comment.Issue),
Comment: convert.ToAPIComment(ctx, comment.Issue.Repo, comment),
Repository: convert.ToRepo(ctx, comment.Issue.Repo, permission),
Sender: convert.ToUser(ctx, doer, nil),
Expand Down
Loading

0 comments on commit d5add2e

Please sign in to comment.