Skip to content

Commit decaf7f

Browse files
authored
Merge branch 'main' into refactor-of-32211
2 parents 26d90b9 + 81aec6d commit decaf7f

File tree

8 files changed

+57
-15
lines changed

8 files changed

+57
-15
lines changed

modules/migration/pullrequest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type PullRequest struct {
3737
ForeignIndex int64
3838
Context DownloaderContext `yaml:"-"`
3939
EnsuredSafe bool `yaml:"ensured_safe"`
40+
IsDraft bool `yaml:"is_draft"`
4041
}
4142

4243
func (p *PullRequest) GetLocalIndex() int64 { return p.Number }

services/actions/notifier_helper.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,20 @@ func (input *notifyInput) Notify(ctx context.Context) {
116116
}
117117

118118
func notify(ctx context.Context, input *notifyInput) error {
119+
shouldDetectSchedules := input.Event == webhook_module.HookEventPush && input.Ref.BranchName() == input.Repo.DefaultBranch
119120
if input.Doer.IsActions() {
120121
// avoiding triggering cyclically, for example:
121122
// a comment of an issue will trigger the runner to add a new comment as reply,
122123
// and the new comment will trigger the runner again.
123124
log.Debug("ignore executing %v for event %v whose doer is %v", getMethod(ctx), input.Event, input.Doer.Name)
125+
126+
// we should update schedule tasks in this case, because
127+
// 1. schedule tasks cannot be triggered by other events, so cyclic triggering will not occur
128+
// 2. some schedule tasks may update the repo periodically, so the refs of schedule tasks need to be updated
129+
if shouldDetectSchedules {
130+
return DetectAndHandleSchedules(ctx, input.Repo)
131+
}
132+
124133
return nil
125134
}
126135
if input.Repo.IsEmpty || input.Repo.IsArchived {
@@ -174,7 +183,6 @@ func notify(ctx context.Context, input *notifyInput) error {
174183

175184
var detectedWorkflows []*actions_module.DetectedWorkflow
176185
actionsConfig := input.Repo.MustGetUnit(ctx, unit_model.TypeActions).ActionsConfig()
177-
shouldDetectSchedules := input.Event == webhook_module.HookEventPush && input.Ref.BranchName() == input.Repo.DefaultBranch
178186
workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit,
179187
input.Event,
180188
input.Payload,

services/migrations/gitea_uploader.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,10 +760,15 @@ func (g *GiteaLocalUploader) newPullRequest(pr *base.PullRequest) (*issues_model
760760
pr.Updated = pr.Created
761761
}
762762

763+
prTitle := pr.Title
764+
if pr.IsDraft && !issues_model.HasWorkInProgressPrefix(pr.Title) {
765+
prTitle = fmt.Sprintf("%s %s", setting.Repository.PullRequest.WorkInProgressPrefixes[0], pr.Title)
766+
}
767+
763768
issue := issues_model.Issue{
764769
RepoID: g.repo.ID,
765770
Repo: g.repo,
766-
Title: pr.Title,
771+
Title: prTitle,
767772
Index: pr.Number,
768773
Content: pr.Content,
769774
MilestoneID: milestoneID,

services/migrations/github.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullReq
737737
PatchURL: pr.GetPatchURL(), // see below for SECURITY related issues here
738738
Reactions: reactions,
739739
ForeignIndex: int64(*pr.Number),
740+
IsDraft: pr.GetDraft(),
740741
})
741742

742743
// SECURITY: Ensure that the PR is safe

services/migrations/gitlab.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque
722722
PatchURL: pr.WebURL + ".patch",
723723
ForeignIndex: int64(pr.IID),
724724
Context: gitlabIssueContext{IsMergeRequest: true},
725+
IsDraft: pr.Draft,
725726
})
726727

727728
// SECURITY: Ensure that the PR is safe

services/user/user.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ import (
3232

3333
// RenameUser renames a user
3434
func RenameUser(ctx context.Context, u *user_model.User, newUserName string) error {
35+
if newUserName == u.Name {
36+
return nil
37+
}
38+
3539
// Non-local users are not allowed to change their username.
3640
if !u.IsOrganization() && !u.IsLocal() {
3741
return user_model.ErrUserIsNotLocal{
@@ -40,10 +44,6 @@ func RenameUser(ctx context.Context, u *user_model.User, newUserName string) err
4044
}
4145
}
4246

43-
if newUserName == u.Name {
44-
return nil
45-
}
46-
4747
if err := user_model.IsUsableUsername(newUserName); err != nil {
4848
return err
4949
}

templates/devtest/fomantic-dropdown.tmpl

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@
2929
<div class="default text">empty multiple dropdown</div>
3030
<div class="menu">
3131
<div class="item">item</div>
32-
</div>
33-
</div>
34-
<div class="ui multiple clearable search selection dropdown">
35-
<input type="hidden" value="1">
36-
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
37-
{{svg "octicon-x" 14 "remove icon"}}
38-
<div class="default text">clearable search dropdown</div>
39-
<div class="menu">
40-
<div class="item" data-value="1">item</div>
32+
<div class="item">sm1</div>
33+
<div class="item">sm2</div>
34+
<div class="item">medium1</div>
35+
<div class="item">medium2</div>
36+
<div class="item">large item1</div>
37+
<div class="item">large item2</div>
38+
<div class="item">large item3</div>
39+
<div class="item">very large item test 1</div>
40+
<div class="item">very large item test 2</div>
41+
<div class="item">very large item test 3</div>
4142
</div>
4243
</div>
4344
<div class="ui buttons">
@@ -50,6 +51,27 @@
5051
</div>
5152
</div>
5253
</div>
54+
<div>
55+
<div class="ui multiple clearable search selection dropdown tw-max-w-[220px]">
56+
<input type="hidden" value="1,2,3,4,5,10">
57+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
58+
{{svg "octicon-x" 14 "remove icon"}}
59+
<div class="default text">clearable search dropdown</div>
60+
<div class="menu">
61+
<div class="item" data-value="1">item</div>
62+
<div class="item" data-value="2">sm1</div>
63+
<div class="item" data-value="3">sm2</div>
64+
<div class="item" data-value="4">medium1</div>
65+
<div class="item" data-value="5">medium2</div>
66+
<div class="item" data-value="6">large item1</div>
67+
<div class="item" data-value="7">large item2</div>
68+
<div class="item" data-value="8">large item3</div>
69+
<div class="item" data-value="9">very large item test 1</div>
70+
<div class="item" data-value="10">very large item test 2</div>
71+
<div class="item" data-value="11">very large item test 3</div>
72+
</div>
73+
</div>
74+
</div>
5375

5476
<h2>Selection</h2>
5577
<div>

web_src/css/base.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,10 @@ table th[data-sortt-desc] .svg {
13641364
min-width: 0; /* make ellipsis work */
13651365
}
13661366

1367+
.ui.multiple.selection.dropdown {
1368+
flex-wrap: wrap;
1369+
}
1370+
13671371
.ui.ui.dropdown.selection {
13681372
min-width: 14em; /* match the default min width */
13691373
}

0 commit comments

Comments
 (0)