Skip to content

Commit 49ce9fe

Browse files
Zettat1234kProgrammer
authored andcommitted
[skip ci] Updated translations via Crowdin (+7 squashed commit)
Squashed commit: [e1468e2] Fixes for unreachable project issues when transfer repository from organization (go-gitea#31770) dfhgfdhfghfg When transferring repositories that have issues linked to a project board to another organization, the issues remain associated with the original project board. This causes the columns in the project board to become bugged, making it difficult to move other issues in or out of the affected columns. As a solution, I removed the issue relations since the other organization does not have this project table. Fix for go-gitea#31538 Co-authored-by: Jason Song <[email protected]> [c39643f] fghfghf [38a09ea] render plain text file if the LFS object doesn't exist (go-gitea#31812)gfgdfg We had an issue where a repo was using LFS to store a file, but the user did not push the file. When trying to view the file, Gitea returned a 500 HTTP status code referencing `ErrLFSObjectNotExist`. It appears the intent was the render this file as plain text, but the conditional was flipped. I've also added a test to verify that the file is rendered as plain text. [2477511] Add spacing to global error message (go-gitea#31826) Fixes go-gitea#31717. Include Typescript files in Tailwind config so they can be pre-processed. ![Screenshot from 2024-08-13 08-44-33](https://github.com/user-attachments/assets/196d7801-e299-4000-8b39-cd9f89917f17) [5bcab0b] [skip ci] Updated translations via Crowdin [fe7c941] Scroll images in project issues separately from the remaining issue (go-gitea#31683) As discussed in go-gitea#31667 & go-gitea#26561, when a card on a Project contains images, they can overflow the card on its containing column. This aims to fix this issue via snapping scrollbars. --- Issue go-gitea#31667 is open to discussion as there should be room for improvement. [8883d99] Support issue template assignees (go-gitea#31083) Resolve go-gitea#13955
1 parent 63c5ac6 commit 49ce9fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+334
-112
lines changed

New Text Document.txt

Whitespace-only changes.

models/asymkey/ssh_key.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,35 +229,26 @@ func UpdatePublicKeyUpdated(ctx context.Context, id int64) error {
229229

230230
// PublicKeysAreExternallyManaged returns whether the provided KeyID represents an externally managed Key
231231
func PublicKeysAreExternallyManaged(ctx context.Context, keys []*PublicKey) ([]bool, error) {
232-
sources := make([]*auth.Source, 0, 5)
232+
sourceCache := make(map[int64]*auth.Source, len(keys))
233233
externals := make([]bool, len(keys))
234-
keyloop:
234+
235235
for i, key := range keys {
236236
if key.LoginSourceID == 0 {
237237
externals[i] = false
238-
continue keyloop
239-
}
240-
241-
var source *auth.Source
242-
243-
sourceloop:
244-
for _, s := range sources {
245-
if s.ID == key.LoginSourceID {
246-
source = s
247-
break sourceloop
248-
}
238+
continue
249239
}
250240

251-
if source == nil {
241+
source, ok := sourceCache[key.LoginSourceID]
242+
if !ok {
252243
var err error
253244
source, err = auth.GetSourceByID(ctx, key.LoginSourceID)
254245
if err != nil {
255246
if auth.IsErrSourceNotExist(err) {
256247
externals[i] = false
257-
sources[i] = &auth.Source{
248+
sourceCache[key.LoginSourceID] = &auth.Source{
258249
ID: key.LoginSourceID,
259250
}
260-
continue keyloop
251+
continue
261252
}
262253
return nil, err
263254
}

models/asymkey/ssh_key_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
"strings"
1313
"testing"
1414

15+
"code.gitea.io/gitea/models/db"
16+
"code.gitea.io/gitea/models/unittest"
1517
"code.gitea.io/gitea/modules/setting"
1618

1719
"github.com/42wim/sshsig"
@@ -503,3 +505,11 @@ func runErr(t *testing.T, stdin []byte, args ...string) {
503505
t.Fatal("expected error")
504506
}
505507
}
508+
509+
func Test_PublicKeysAreExternallyManaged(t *testing.T) {
510+
key1 := unittest.AssertExistsAndLoadBean(t, &PublicKey{ID: 1})
511+
externals, err := PublicKeysAreExternallyManaged(db.DefaultContext, []*PublicKey{key1})
512+
assert.NoError(t, err)
513+
assert.Len(t, externals, 1)
514+
assert.False(t, externals[0])
515+
}

models/project/issue.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,9 @@ func (c *Column) moveIssuesToAnotherColumn(ctx context.Context, newColumn *Colum
117117
return nil
118118
})
119119
}
120+
121+
// DeleteAllProjectIssueByIssueIDsAndProjectIDs delete all project's issues by issue's and project's ids
122+
func DeleteAllProjectIssueByIssueIDsAndProjectIDs(ctx context.Context, issueIDs, projectIDs []int64) error {
123+
_, err := db.GetEngine(ctx).In("project_id", projectIDs).In("issue_id", issueIDs).Delete(&ProjectIssue{})
124+
return err
125+
}

models/project/project.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ func GetProjectForRepoByID(ctx context.Context, repoID, id int64) (*Project, err
296296
return p, nil
297297
}
298298

299+
// GetAllProjectsIDsByOwnerID returns the all projects ids it owns
300+
func GetAllProjectsIDsByOwnerIDAndType(ctx context.Context, ownerID int64, projectType Type) ([]int64, error) {
301+
projects := make([]int64, 0)
302+
return projects, db.GetEngine(ctx).Table(&Project{}).Where("owner_id=? AND type=?", ownerID, projectType).Cols("id").Find(&projects)
303+
}
304+
299305
// UpdateProject updates project properties
300306
func UpdateProject(ctx context.Context, p *Project) error {
301307
if !IsCardTypeValid(p.CardType) {

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/markup/html_link.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
package markup
55

66
import (
7-
"path"
8-
97
"code.gitea.io/gitea/modules/util"
108
)
119

@@ -14,13 +12,9 @@ func ResolveLink(ctx *RenderContext, link, userContentAnchorPrefix string) (resu
1412
if !isAnchorFragment && !IsFullURLString(link) {
1513
linkBase := ctx.Links.Base
1614
if ctx.IsWiki {
17-
if ext := path.Ext(link); ext == "" || ext == ".-" {
18-
linkBase = ctx.Links.WikiLink() // the link is for a wiki page
19-
} else if DetectMarkupTypeByFileName(link) != "" {
20-
linkBase = ctx.Links.WikiLink() // the link is renderable as a wiki page
21-
} else {
22-
linkBase = ctx.Links.WikiRawLink() // otherwise, use a raw link instead to view&download medias
23-
}
15+
// no need to check if the link should be resolved as a wiki link or a wiki raw link
16+
// just use wiki link here and it will be redirected to a wiki raw link if necessary
17+
linkBase = ctx.Links.WikiLink()
2418
} else if ctx.Links.BranchPath != "" || ctx.Links.TreePath != "" {
2519
// if there is no BranchPath, then the link will be something like "/owner/repo/src/{the-file-path}"
2620
// and then this link will be handled by the "legacy-ref" code and be redirected to the default branch like "/owner/repo/src/branch/main/{the-file-path}"

modules/markup/html_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ func TestRender_ShortLinks(t *testing.T) {
437437
renderableFileURL := util.URLJoin(tree, "markdown_file.md")
438438
renderableFileURLWiki := util.URLJoin(markup.TestRepoURL, "wiki", "markdown_file.md")
439439
unrenderableFileURL := util.URLJoin(tree, "file.zip")
440-
unrenderableFileURLWiki := util.URLJoin(markup.TestRepoURL, "wiki", "raw", "file.zip")
440+
unrenderableFileURLWiki := util.URLJoin(markup.TestRepoURL, "wiki", "file.zip")
441441
favicon := "http://google.com/favicon.ico"
442442

443443
test(

modules/markup/markdown/markdown_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,9 @@ space</p>
672672
Expected: `<p>space @mention-user<br/>
673673
/just/a/path.bin<br/>
674674
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
675-
<a href="/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
675+
<a href="/wiki/file.bin" rel="nofollow">local link</a><br/>
676676
<a href="https://example.com" rel="nofollow">remote link</a><br/>
677-
<a href="/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
677+
<a href="/wiki/file.bin" rel="nofollow">local link</a><br/>
678678
<a href="https://example.com" rel="nofollow">remote link</a><br/>
679679
<a href="/wiki/raw/image.jpg" target="_blank" rel="nofollow noopener"><img src="/wiki/raw/image.jpg" alt="local image"/></a><br/>
680680
<a href="/wiki/raw/path/file" target="_blank" rel="nofollow noopener"><img src="/wiki/raw/path/file" alt="local image"/></a><br/>
@@ -730,9 +730,9 @@ space</p>
730730
Expected: `<p>space @mention-user<br/>
731731
/just/a/path.bin<br/>
732732
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
733-
<a href="https://gitea.io/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
733+
<a href="https://gitea.io/wiki/file.bin" rel="nofollow">local link</a><br/>
734734
<a href="https://example.com" rel="nofollow">remote link</a><br/>
735-
<a href="https://gitea.io/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
735+
<a href="https://gitea.io/wiki/file.bin" rel="nofollow">local link</a><br/>
736736
<a href="https://example.com" rel="nofollow">remote link</a><br/>
737737
<a href="https://gitea.io/wiki/raw/image.jpg" target="_blank" rel="nofollow noopener"><img src="https://gitea.io/wiki/raw/image.jpg" alt="local image"/></a><br/>
738738
<a href="https://gitea.io/wiki/raw/path/file" target="_blank" rel="nofollow noopener"><img src="https://gitea.io/wiki/raw/path/file" alt="local image"/></a><br/>
@@ -788,9 +788,9 @@ space</p>
788788
Expected: `<p>space @mention-user<br/>
789789
/just/a/path.bin<br/>
790790
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
791-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
791+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
792792
<a href="https://example.com" rel="nofollow">remote link</a><br/>
793-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
793+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
794794
<a href="https://example.com" rel="nofollow">remote link</a><br/>
795795
<a href="/relative/path/wiki/raw/image.jpg" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/image.jpg" alt="local image"/></a><br/>
796796
<a href="/relative/path/wiki/raw/path/file" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/path/file" alt="local image"/></a><br/>
@@ -848,9 +848,9 @@ space</p>
848848
Expected: `<p>space @mention-user<br/>
849849
/just/a/path.bin<br/>
850850
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
851-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
851+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
852852
<a href="https://example.com" rel="nofollow">remote link</a><br/>
853-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
853+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
854854
<a href="https://example.com" rel="nofollow">remote link</a><br/>
855855
<a href="/relative/path/wiki/raw/image.jpg" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/image.jpg" alt="local image"/></a><br/>
856856
<a href="/relative/path/wiki/raw/path/file" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/path/file" alt="local image"/></a><br/>
@@ -908,9 +908,9 @@ space</p>
908908
Expected: `<p>space @mention-user<br/>
909909
/just/a/path.bin<br/>
910910
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
911-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
911+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
912912
<a href="https://example.com" rel="nofollow">remote link</a><br/>
913-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
913+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
914914
<a href="https://example.com" rel="nofollow">remote link</a><br/>
915915
<a href="/relative/path/wiki/raw/image.jpg" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/image.jpg" alt="local image"/></a><br/>
916916
<a href="/relative/path/wiki/raw/path/file" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/path/file" alt="local image"/></a><br/>
@@ -970,9 +970,9 @@ space</p>
970970
Expected: `<p>space @mention-user<br/>
971971
/just/a/path.bin<br/>
972972
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
973-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
973+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
974974
<a href="https://example.com" rel="nofollow">remote link</a><br/>
975-
<a href="/relative/path/wiki/raw/file.bin" rel="nofollow">local link</a><br/>
975+
<a href="/relative/path/wiki/file.bin" rel="nofollow">local link</a><br/>
976976
<a href="https://example.com" rel="nofollow">remote link</a><br/>
977977
<a href="/relative/path/wiki/raw/image.jpg" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/image.jpg" alt="local image"/></a><br/>
978978
<a href="/relative/path/wiki/raw/path/file" target="_blank" rel="nofollow noopener"><img src="/relative/path/wiki/raw/path/file" alt="local image"/></a><br/>

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 {

0 commit comments

Comments
 (0)