From 1b296ed1a422b8f29ea0c0e887f6470b8895116c Mon Sep 17 00:00:00 2001 From: Pedro Nishiyama Date: Thu, 28 Nov 2024 04:18:23 -0300 Subject: [PATCH 1/3] Allow users with write permission to run actions (#32644) --- I have a use case where I need a team to be able to run actions without admin access. --- routers/web/repo/actions/actions.go | 4 ++-- routers/web/web.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index f5fb056494d..ad16b9fb4e4 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -168,8 +168,8 @@ func List(ctx *context.Context) { actionsConfig := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions).ActionsConfig() ctx.Data["ActionsConfig"] = actionsConfig - if len(workflowID) > 0 && ctx.Repo.IsAdmin() { - ctx.Data["AllowDisableOrEnableWorkflow"] = true + if len(workflowID) > 0 && ctx.Repo.CanWrite(unit.TypeActions) { + ctx.Data["AllowDisableOrEnableWorkflow"] = ctx.Repo.IsAdmin() isWorkflowDisabled := actionsConfig.IsWorkflowDisabled(workflowID) ctx.Data["CurWorkflowDisabled"] = isWorkflowDisabled diff --git a/routers/web/web.go b/routers/web/web.go index a2c14993ac3..5ed046a9838 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1406,7 +1406,7 @@ func registerRoutes(m *web.Router) { m.Get("", actions.List) m.Post("/disable", reqRepoAdmin, actions.DisableWorkflowFile) m.Post("/enable", reqRepoAdmin, actions.EnableWorkflowFile) - m.Post("/run", reqRepoAdmin, actions.Run) + m.Post("/run", reqRepoActionsWriter, actions.Run) m.Group("/runs/{run}", func() { m.Combo(""). From 00f8090de4b42305f6e717dc2cdb32c14b4a8fe2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 27 Nov 2024 23:43:38 -0800 Subject: [PATCH 2/3] Don't create action when syncing mirror pull refs (#32659) Fix #27961 --- services/feed/action.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/feed/action.go b/services/feed/action.go index 83daaa1438f..a8820aeb777 100644 --- a/services/feed/action.go +++ b/services/feed/action.go @@ -390,6 +390,12 @@ func (a *actionNotifier) DeleteRef(ctx context.Context, doer *user_model.User, r } func (a *actionNotifier) SyncPushCommits(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { + // ignore pull sync message for pull requests refs + // TODO: it's better to have a UI to let users chose + if opts.RefFullName.IsPull() { + return + } + data, err := json.Marshal(commits) if err != nil { log.Error("json.Marshal: %v", err) From a1f56f83bff56f86180e59742efd3748908b82c1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 28 Nov 2024 13:25:21 +0100 Subject: [PATCH 3/3] Improve diff file tree (#32658) - Unfolded directories now show a "open" icon - Prevent accidential text selection while toggling directories - Increase vertical item padding from 3px to 6px image --- web_src/js/components/DiffFileTreeItem.vue | 8 ++++++-- web_src/js/svg.ts | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/web_src/js/components/DiffFileTreeItem.vue b/web_src/js/components/DiffFileTreeItem.vue index 84431ff372d..12cafd8f1b5 100644 --- a/web_src/js/components/DiffFileTreeItem.vue +++ b/web_src/js/components/DiffFileTreeItem.vue @@ -51,7 +51,7 @@ function getIconForDiffType(pType) {
- + {{ item.name }}
@@ -87,12 +87,16 @@ a, a:hover { color: var(--color-text-light-3); } +.item-directory { + user-select: none; +} + .item-file, .item-directory { display: flex; align-items: center; gap: 0.25em; - padding: 3px 6px; + padding: 6px; } .item-file:hover, diff --git a/web_src/js/svg.ts b/web_src/js/svg.ts index cbb1af4ba16..3a0f2ed53c7 100644 --- a/web_src/js/svg.ts +++ b/web_src/js/svg.ts @@ -27,6 +27,7 @@ import octiconDownload from '../../public/assets/img/svg/octicon-download.svg'; import octiconEye from '../../public/assets/img/svg/octicon-eye.svg'; import octiconFile from '../../public/assets/img/svg/octicon-file.svg'; import octiconFileDirectoryFill from '../../public/assets/img/svg/octicon-file-directory-fill.svg'; +import octiconFileDirectoryOpenFill from '../../public/assets/img/svg/octicon-file-directory-open-fill.svg'; import octiconFilter from '../../public/assets/img/svg/octicon-filter.svg'; import octiconGear from '../../public/assets/img/svg/octicon-gear.svg'; import octiconGitBranch from '../../public/assets/img/svg/octicon-git-branch.svg'; @@ -101,6 +102,7 @@ const svgs = { 'octicon-eye': octiconEye, 'octicon-file': octiconFile, 'octicon-file-directory-fill': octiconFileDirectoryFill, + 'octicon-file-directory-open-fill': octiconFileDirectoryOpenFill, 'octicon-filter': octiconFilter, 'octicon-gear': octiconGear, 'octicon-git-branch': octiconGitBranch,