Skip to content

Commit 8942c19

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: [skip ci] Updated translations via Crowdin Scroll images in project issues separately from the remaining issue (go-gitea#31683) Support issue template assignees (go-gitea#31083)
2 parents 6e13951 + 5bcab0b commit 8942c19

File tree

9 files changed

+61
-26
lines changed

9 files changed

+61
-26
lines changed

modules/issue/template/template_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ name: Name
466466
title: Title
467467
about: About
468468
labels: ["label1", "label2"]
469+
assignees: ["user1", "user2"]
469470
ref: Ref
470471
body:
471472
- type: markdown
@@ -523,11 +524,12 @@ body:
523524
visible: [form]
524525
`,
525526
want: &api.IssueTemplate{
526-
Name: "Name",
527-
Title: "Title",
528-
About: "About",
529-
Labels: []string{"label1", "label2"},
530-
Ref: "Ref",
527+
Name: "Name",
528+
Title: "Title",
529+
About: "About",
530+
Labels: []string{"label1", "label2"},
531+
Assignees: []string{"user1", "user2"},
532+
Ref: "Ref",
531533
Fields: []*api.IssueFormField{
532534
{
533535
Type: "markdown",

modules/structs/issue.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,20 @@ const (
177177
// IssueTemplate represents an issue template for a repository
178178
// swagger:model
179179
type IssueTemplate struct {
180-
Name string `json:"name" yaml:"name"`
181-
Title string `json:"title" yaml:"title"`
182-
About string `json:"about" yaml:"about"` // Using "description" in a template file is compatible
183-
Labels IssueTemplateLabels `json:"labels" yaml:"labels"`
184-
Ref string `json:"ref" yaml:"ref"`
185-
Content string `json:"content" yaml:"-"`
186-
Fields []*IssueFormField `json:"body" yaml:"body"`
187-
FileName string `json:"file_name" yaml:"-"`
180+
Name string `json:"name" yaml:"name"`
181+
Title string `json:"title" yaml:"title"`
182+
About string `json:"about" yaml:"about"` // Using "description" in a template file is compatible
183+
Labels IssueTemplateStringSlice `json:"labels" yaml:"labels"`
184+
Assignees IssueTemplateStringSlice `json:"assignees" yaml:"assignees"`
185+
Ref string `json:"ref" yaml:"ref"`
186+
Content string `json:"content" yaml:"-"`
187+
Fields []*IssueFormField `json:"body" yaml:"body"`
188+
FileName string `json:"file_name" yaml:"-"`
188189
}
189190

190-
type IssueTemplateLabels []string
191+
type IssueTemplateStringSlice []string
191192

192-
func (l *IssueTemplateLabels) UnmarshalYAML(value *yaml.Node) error {
193+
func (l *IssueTemplateStringSlice) UnmarshalYAML(value *yaml.Node) error {
193194
var labels []string
194195
if value.IsZero() {
195196
*l = labels
@@ -217,7 +218,7 @@ func (l *IssueTemplateLabels) UnmarshalYAML(value *yaml.Node) error {
217218
*l = labels
218219
return nil
219220
}
220-
return fmt.Errorf("line %d: cannot unmarshal %s into IssueTemplateLabels", value.Line, value.ShortTag())
221+
return fmt.Errorf("line %d: cannot unmarshal %s into IssueTemplateStringSlice", value.Line, value.ShortTag())
221222
}
222223

223224
type IssueConfigContactLink struct {

modules/structs/issue_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestIssueTemplate_Type(t *testing.T) {
4242
}
4343
}
4444

45-
func TestIssueTemplateLabels_UnmarshalYAML(t *testing.T) {
45+
func TestIssueTemplateStringSlice_UnmarshalYAML(t *testing.T) {
4646
tests := []struct {
4747
name string
4848
content string
@@ -88,7 +88,7 @@ labels:
8888
b: bb
8989
`,
9090
tmpl: &IssueTemplate{},
91-
wantErr: "line 3: cannot unmarshal !!map into IssueTemplateLabels",
91+
wantErr: "line 3: cannot unmarshal !!map into IssueTemplateStringSlice",
9292
},
9393
}
9494
for _, tt := range tests {

options/locale/locale_ja-JP.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,6 +2868,7 @@ dashboard.reinit_missing_repos=レコードが存在するが見当たらない
28682868
dashboard.sync_external_users=外部ユーザーデータの同期
28692869
dashboard.cleanup_hook_task_table=hook_taskテーブルのクリーンアップ
28702870
dashboard.cleanup_packages=期限切れパッケージのクリーンアップ
2871+
dashboard.cleanup_actions=期限切れのActionsリソースのクリーンアップ
28712872
dashboard.server_uptime=サーバーの稼働時間
28722873
dashboard.current_goroutine=現在のGoroutine数
28732874
dashboard.current_memory_usage=現在のメモリ使用量
@@ -2897,9 +2898,15 @@ dashboard.total_gc_time=GC停止時間の合計
28972898
dashboard.total_gc_pause=GC停止時間の合計
28982899
dashboard.last_gc_pause=前回のGC停止時間
28992900
dashboard.gc_times=GC実行回数
2901+
dashboard.delete_old_actions=データベースから古い操作履歴をすべて削除
2902+
dashboard.delete_old_actions.started=データベースからの古い操作履歴の削除を開始しました。
29002903
dashboard.update_checker=更新チェック
29012904
dashboard.delete_old_system_notices=データベースから古いシステム通知をすべて削除
29022905
dashboard.gc_lfs=LFSメタオブジェクトのガベージコレクション
2906+
dashboard.stop_zombie_tasks=Actionsゾンビタスクを停止
2907+
dashboard.stop_endless_tasks=終わらないActionsタスクを停止
2908+
dashboard.cancel_abandoned_jobs=放置されたままのActionsジョブをキャンセル
2909+
dashboard.start_schedule_tasks=Actionsスケジュールタスクを開始
29032910
dashboard.sync_branch.started=ブランチの同期を開始しました
29042911
dashboard.sync_tag.started=タグの同期を開始しました
29052912
dashboard.rebuild_issue_indexer=イシューインデクサーの再構築
@@ -2974,6 +2981,10 @@ emails.not_updated=メール設定の更新に失敗しました: %v
29742981
emails.duplicate_active=メールアドレスは別のユーザーが既に使用中です。
29752982
emails.change_email_header=メール設定の更新
29762983
emails.change_email_text=このメールアドレスで更新してもよろしいですか?
2984+
emails.delete=メールアドレスの削除
2985+
emails.delete_desc=このメールアドレスを削除してよろしいですか?
2986+
emails.deletion_success=メールアドレスを削除しました。
2987+
emails.delete_primary_email_error=プライマリメールアドレスを削除することはできません。
29772988

29782989
orgs.org_manage_panel=組織の管理
29792990
orgs.name=名称
@@ -3666,6 +3677,7 @@ runs.no_workflows.quick_start=Gitea Actions の始め方がわからない?
36663677
runs.no_workflows.documentation=Gitea Actions の詳細については、<a target="_blank" rel="noopener noreferrer" href="%s">ドキュメント</a>を参照してください。
36673678
runs.no_runs=ワークフローはまだ実行されていません。
36683679
runs.empty_commit_message=(空のコミットメッセージ)
3680+
runs.expire_log_message=ログは古すぎるため消去されています。
36693681

36703682
workflow.disable=ワークフローを無効にする
36713683
workflow.disable_success=ワークフロー '%s' が無効になりました。
@@ -3692,6 +3704,7 @@ variables.update.failed=変数を更新できませんでした。
36923704
variables.update.success=変数を更新しました。
36933705

36943706
[projects]
3707+
deleted.display_name=削除されたプロジェクト
36953708
type-1.display_name=個人プロジェクト
36963709
type-2.display_name=リポジトリ プロジェクト
36973710
type-3.display_name=組織プロジェクト

routers/web/repo/issue.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,12 +939,23 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles
939939
}
940940
}
941941
}
942+
selectedAssigneeIDs := make([]int64, 0, len(template.Assignees))
943+
selectedAssigneeIDStrings := make([]string, 0, len(template.Assignees))
944+
if userIDs, err := user_model.GetUserIDsByNames(ctx, template.Assignees, false); err == nil {
945+
for _, userID := range userIDs {
946+
selectedAssigneeIDs = append(selectedAssigneeIDs, userID)
947+
selectedAssigneeIDStrings = append(selectedAssigneeIDStrings, strconv.FormatInt(userID, 10))
948+
}
949+
}
942950

943951
if template.Ref != "" && !strings.HasPrefix(template.Ref, "refs/") { // Assume that the ref intended is always a branch - for tags users should use refs/tags/<ref>
944952
template.Ref = git.BranchPrefix + template.Ref
945953
}
946954
ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0
947955
ctx.Data["label_ids"] = strings.Join(labelIDs, ",")
956+
ctx.Data["HasSelectedAssignee"] = len(selectedAssigneeIDs) > 0
957+
ctx.Data["assignee_ids"] = strings.Join(selectedAssigneeIDStrings, ",")
958+
ctx.Data["SelectedAssigneeIDs"] = selectedAssigneeIDs
948959
ctx.Data["Reference"] = template.Ref
949960
ctx.Data["RefEndName"] = git.RefName(template.Ref).ShortName()
950961
return true, templateErrs

templates/repo/issue/new_form.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@
155155
</div>
156156
<div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div>
157157
{{range .Assignees}}
158-
<a class="item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}">
159-
<span class="octicon-check tw-invisible">{{svg "octicon-check"}}</span>
158+
<a class="{{if SliceUtils.Contains $.SelectedAssigneeIDs .ID}}checked{{end}} item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}">
159+
<span class="octicon-check {{if not (SliceUtils.Contains $.SelectedAssigneeIDs .ID)}}tw-invisible{{end}}">{{svg "octicon-check"}}</span>
160160
<span class="text">
161161
{{ctx.AvatarUtils.Avatar . 28 "tw-mr-2"}}{{template "repo/search_name" .}}
162162
</span>
@@ -165,12 +165,12 @@
165165
</div>
166166
</div>
167167
<div class="ui assignees list">
168-
<span class="no-select item {{if .HasSelectedLabel}}tw-hidden{{end}}">
168+
<span class="no-select item {{if .HasSelectedAssignee}}tw-hidden{{end}}">
169169
{{ctx.Locale.Tr "repo.issues.new.no_assignees"}}
170170
</span>
171171
<div class="selected">
172172
{{range .Assignees}}
173-
<a class="item tw-p-1 muted tw-hidden" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}">
173+
<a class="item tw-p-1 muted {{if not (SliceUtils.Contains $.SelectedAssigneeIDs .ID)}}tw-hidden{{end}}" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}">
174174
{{ctx.AvatarUtils.Avatar . 28 "tw-mr-2 tw-align-middle"}}{{.GetDisplayName}}
175175
</a>
176176
{{end}}

templates/swagger/v1_json.tmpl

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web_src/css/features/projects.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,20 @@
7070
.card-attachment-images {
7171
display: inline-block;
7272
white-space: nowrap;
73-
overflow: hidden;
73+
overflow: scroll;
74+
cursor: default;
75+
scroll-snap-type: x mandatory;
7476
text-align: center;
7577
}
7678

7779
.card-attachment-images img {
7880
display: inline-block;
7981
max-height: 50px;
8082
border-radius: var(--border-radius);
83+
text-align: left;
84+
scroll-snap-align: center;
8185
margin-right: 2px;
86+
aspect-ratio: 1;
8287
}
8388

8489
.card-attachment-images img:only-child {

web_src/css/repo/issue-card.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
display: flex;
33
flex-direction: column;
44
gap: 4px;
5-
align-items: start;
5+
align-items: stretch;
66
border-radius: var(--border-radius);
77
padding: 8px 10px;
88
border: 1px solid var(--color-secondary);

0 commit comments

Comments
 (0)