Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
* upstream/main:
  Use full width for project boards (go-gitea#28225)
  Increase "version" when update the setting value to a same value as before (go-gitea#28243)
  Fix issue will be detected as pull request when checking `First-time contributor` (go-gitea#28237)
  Fix link to `Code` tab on wiki commits (go-gitea#28041)
  Fix links in docs (go-gitea#28234)
  • Loading branch information
zjjhot committed Nov 28, 2023
2 parents b5c792f + 4d7c063 commit acaeefb
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/content/administration/email-setup.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ PASSWD = `password`

要发送测试邮件以验证设置,请转到 Gitea > 站点管理 > 配置 > SMTP 邮件配置。

有关所有选项的完整列表,请查看[配置速查表](doc/administration/config-cheat-sheet.md)
有关所有选项的完整列表,请查看[配置速查表](administration/config-cheat-sheet.md)

请注意:只有在使用 TLS 或 `HOST=localhost` 加密 SMTP 服务器通信时才支持身份验证。TLS 加密可以通过以下方式进行:

Expand Down
2 changes: 1 addition & 1 deletion docs/content/usage/actions/act-runner.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ If you cannot see the settings page, please make sure that you have the right pe

The format of the registration token is a random string `D0gvfu2iHfUjNqCYVljVyRV14fISpJxxxxxxxxxx`.

A registration token can also be obtained from the gitea [command-line interface](../../administration/command-line.md#actions-generate-runner-token):
A registration token can also be obtained from the gitea [command-line interface](administration/command-line.md#actions-generate-runner-token):

```
gitea --config /etc/gitea/app.ini actions generate-runner-token
Expand Down
2 changes: 1 addition & 1 deletion docs/content/usage/actions/act-runner.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Runner级别决定了从哪里获取注册令牌。

注册令牌的格式是一个随机字符串 `D0gvfu2iHfUjNqCYVljVyRV14fISpJxxxxxxxxxx`

注册令牌也可以通过 Gitea 的 [命令行](../../administration/command-line.md#actions-generate-runner-token) 获得:
注册令牌也可以通过 Gitea 的 [命令行](administration/command-line.md#actions-generate-runner-token) 获得:

### 注册Runner

Expand Down
2 changes: 1 addition & 1 deletion models/system/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func SetSettings(ctx context.Context, settings map[string]string) error {
return err
}
for k, v := range settings {
res, err := e.Exec("UPDATE system_setting SET setting_value=? WHERE setting_key=?", v, k)
res, err := e.Exec("UPDATE system_setting SET version=version+1, setting_value=? WHERE setting_key=?", v, k)
if err != nil {
return err
}
Expand Down
12 changes: 12 additions & 0 deletions models/system/setting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@ func TestSettings(t *testing.T) {
assert.EqualValues(t, 3, rev)
assert.Len(t, settings, 2)
assert.EqualValues(t, "false", settings[keyName])

// setting the same value should not trigger DuplicateKey error, and the "version" should be increased
setting := &system.Setting{SettingKey: keyName}
_, err = db.GetByBean(db.DefaultContext, setting)
assert.NoError(t, err)
assert.EqualValues(t, 2, setting.Version)
err = system.SetSettings(db.DefaultContext, map[string]string{keyName: "false"})
assert.NoError(t, err)
setting = &system.Setting{SettingKey: keyName}
_, err = db.GetByBean(db.DefaultContext, setting)
assert.NoError(t, err)
assert.EqualValues(t, 3, setting.Version)
}
2 changes: 1 addition & 1 deletion routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ func roleDescriptor(ctx stdCtx.Context, repo *repo_model.Repository, poster *use
return roleDescriptor, err
} else if hasMergedPR {
roleDescriptor.RoleInRepo = issues_model.RoleRepoContributor
} else {
} else if issue.IsPull {
// only display first time contributor in the first opening pull request
roleDescriptor.RoleInRepo = issues_model.RoleRepoFirstTimeContributor
}
Expand Down
6 changes: 4 additions & 2 deletions templates/org/projects/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<div role="main" aria-label="{{.Title}}" class="page-content repository projects view-project">
{{template "shared/user/org_profile_avatar" .}}
<div class="ui container">
{{template "user/overview/header" .}}
{{template "projects/view" .}}
{{template "user/overview/header" .}}
</div>
<div class="ui container fluid padded">
{{template "projects/view" .}}
</div>
</div>
{{template "base/footer" .}}
104 changes: 53 additions & 51 deletions templates/projects/view.tmpl
Original file line number Diff line number Diff line change
@@ -1,65 +1,67 @@
{{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}

<div class="gt-df gt-sb gt-ac gt-mb-4">
<h2 class="gt-mb-0">{{.Project.Title}}</h2>
{{if $canWriteProject}}
<div class="ui compact mini menu">
<a class="item" href="{{.Link}}/edit?redirect=project">
{{svg "octicon-pencil"}}
{{ctx.Locale.Tr "repo.issues.label_edit"}}
</a>
{{if .Project.IsClosed}}
<button class="item btn link-action" data-url="{{.Link}}/open">
{{svg "octicon-check"}}
{{ctx.Locale.Tr "repo.projects.open"}}
<div class="ui container">
<div class="gt-df gt-sb gt-ac gt-mb-4">
<h2 class="gt-mb-0">{{.Project.Title}}</h2>
{{if $canWriteProject}}
<div class="ui compact mini menu">
<a class="item" href="{{.Link}}/edit?redirect=project">
{{svg "octicon-pencil"}}
{{ctx.Locale.Tr "repo.issues.label_edit"}}
</a>
{{if .Project.IsClosed}}
<button class="item btn link-action" data-url="{{.Link}}/open">
{{svg "octicon-check"}}
{{ctx.Locale.Tr "repo.projects.open"}}
</button>
{{else}}
<button class="item btn link-action" data-url="{{.Link}}/close">
{{svg "octicon-skip"}}
{{ctx.Locale.Tr "repo.projects.close"}}
</button>
{{end}}
<button class="item btn delete-button" data-url="{{.Link}}/delete" data-id="{{.Project.ID}}">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "repo.issues.label_delete"}}
</button>
{{else}}
<button class="item btn link-action" data-url="{{.Link}}/close">
{{svg "octicon-skip"}}
{{ctx.Locale.Tr "repo.projects.close"}}
<button class="item btn show-modal" data-modal="#new-project-column-item">
{{svg "octicon-plus"}}
{{ctx.Locale.Tr "new_project_column"}}
</button>
{{end}}
<button class="item btn delete-button" data-url="{{.Link}}/delete" data-id="{{.Project.ID}}">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "repo.issues.label_delete"}}
</button>
<button class="item btn show-modal" data-modal="#new-project-column-item">
{{svg "octicon-plus"}}
{{ctx.Locale.Tr "new_project_column"}}
</button>
</div>
<div class="ui small modal new-project-column-modal" id="new-project-column-item">
<div class="header">
{{ctx.Locale.Tr "repo.projects.column.new"}}
</div>
<div class="content">
<form class="ui form">
<div class="required field">
<label for="new_project_column">{{ctx.Locale.Tr "repo.projects.column.new_title"}}</label>
<input class="new-project-column" id="new_project_column" name="title" required>
</div>
<div class="ui small modal new-project-column-modal" id="new-project-column-item">
<div class="header">
{{ctx.Locale.Tr "repo.projects.column.new"}}
</div>
<div class="content">
<form class="ui form">
<div class="required field">
<label for="new_project_column">{{ctx.Locale.Tr "repo.projects.column.new_title"}}</label>
<input class="new-project-column" id="new_project_column" name="title" required>
</div>

<div class="field color-field">
<label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
<div class="color picker column">
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color_picker" name="color">
{{template "repo/issue/label_precolors"}}
<div class="field color-field">
<label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
<div class="color picker column">
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color_picker" name="color">
{{template "repo/issue/label_precolors"}}
</div>
</div>
</div>

<div class="text right actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button data-url="{{$.Link}}" class="ui primary button" id="new_project_column_submit">{{ctx.Locale.Tr "repo.projects.column.new_submit"}}</button>
</div>
</form>
<div class="text right actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button data-url="{{$.Link}}" class="ui primary button" id="new_project_column_submit">{{ctx.Locale.Tr "repo.projects.column.new_submit"}}</button>
</div>
</form>
</div>
</div>
</div>
{{end}}
</div>
{{end}}
</div>

<div class="content">{{$.Project.RenderedContent|Str2html}}</div>
<div class="content">{{$.Project.RenderedContent|Str2html}}</div>

<div class="divider"></div>
<div class="divider"></div>
</div>

<div id="project-board">
<div class="board {{if .CanWriteProjects}}sortable{{end}}">
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
<div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
{{if .Permission.CanRead $.UnitTypeCode}}
<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}">
<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}">
{{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
</a>
{{end}}
Expand Down
2 changes: 2 additions & 0 deletions templates/repo/projects/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{{template "repo/issue/navbar" .}}
<a class="ui small primary button" href="{{.RepoLink}}/issues/new/choose?project={{.Project.ID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a>
</div>
</div>
<div class="ui container fluid padded">
{{template "projects/view" .}}
</div>
</div>
Expand Down

0 comments on commit acaeefb

Please sign in to comment.