-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use relative links for commits, mentions, and issues in markdown #29427
Merged
+65
−26
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
db9e758
Use relative links.
KN4CK3R ed4b32e
Use absolute links in mails.
KN4CK3R 55ae966
Merge branch 'main' of https://github.com/go-gitea/gitea into enhance…
KN4CK3R f40d2d2
Merge branch 'main' into enhancement-relative-link
silverwind 0c5dccc
Merge branch 'main' into enhancement-relative-link
silverwind 76abf30
Merge branch 'main' into enhancement-relative-link
silverwind c3d32c1
Merge branch 'enhancement-relative-link' of https://github.com/KN4CK3…
KN4CK3R 7be3d2b
Fix tests.
KN4CK3R 518a434
Use quotedprintable reader.
KN4CK3R 25befd2
Merge branch 'main' into enhancement-relative-link
GiteaBot bf4da2b
Merge branch 'main' into enhancement-relative-link
GiteaBot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,21 +117,21 @@ com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a582 | |
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb mit | ||
<span class="emoji" aria-label="thumbs up">👍</span> | ||
<a href="mailto:[email protected]" class="mailto">[email protected]</a> | ||
<a href="http://localhost:3000/mention-user" class="mention">@mention-user</a> test | ||
<a href="http://localhost:3000/user13/repo11/issues/123" class="ref-issue">#123</a> | ||
<a href="/mention-user" class="mention">@mention-user</a> test | ||
<a href="/user13/repo11/issues/123" class="ref-issue">#123</a> | ||
space` | ||
|
||
assert.EqualValues(t, expected, RenderCommitBody(context.Background(), testInput, testMetas)) | ||
} | ||
|
||
func TestRenderCommitMessage(t *testing.T) { | ||
expected := `space <a href="http://localhost:3000/mention-user" class="mention">@mention-user</a> ` | ||
expected := `space <a href="/mention-user" class="mention">@mention-user</a> ` | ||
|
||
assert.EqualValues(t, expected, RenderCommitMessage(context.Background(), testInput, testMetas)) | ||
} | ||
|
||
func TestRenderCommitMessageLinkSubject(t *testing.T) { | ||
expected := `<a href="https://example.com/link" class="default-link muted">space </a><a href="http://localhost:3000/mention-user" class="mention">@mention-user</a>` | ||
expected := `<a href="https://example.com/link" class="default-link muted">space </a><a href="/mention-user" class="mention">@mention-user</a>` | ||
|
||
assert.EqualValues(t, expected, RenderCommitMessageLinkSubject(context.Background(), testInput, "https://example.com/link", testMetas)) | ||
} | ||
|
@@ -155,14 +155,14 @@ com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb mit | |
<span class="emoji" aria-label="thumbs up">👍</span> | ||
[email protected] | ||
@mention-user test | ||
<a href="http://localhost:3000/user13/repo11/issues/123" class="ref-issue">#123</a> | ||
<a href="/user13/repo11/issues/123" class="ref-issue">#123</a> | ||
space | ||
` | ||
assert.EqualValues(t, expected, RenderIssueTitle(context.Background(), testInput, testMetas)) | ||
} | ||
|
||
func TestRenderMarkdownToHtml(t *testing.T) { | ||
expected := `<p>space <a href="http://localhost:3000/mention-user" rel="nofollow">@mention-user</a><br/> | ||
expected := `<p>space <a href="/mention-user" rel="nofollow">@mention-user</a><br/> | ||
/just/a/path.bin | ||
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a> | ||
<a href="/file.bin" rel="nofollow">local link</a> | ||
|
@@ -179,7 +179,7 @@ com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a582 | |
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb mit | ||
<span class="emoji" aria-label="thumbs up">👍</span> | ||
<a href="mailto:[email protected]" rel="nofollow">[email protected]</a> | ||
<a href="http://localhost:3000/mention-user" rel="nofollow">@mention-user</a> test | ||
<a href="/mention-user" rel="nofollow">@mention-user</a> test | ||
#123 | ||
space</p> | ||
` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mail, maybe
/routers/common/markup.go
and/or rendered webhook messages should be the only places withAbsolutePrefix = true
. Some tests havetrue
too but that should be changed in another PR.