-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Rewrite reference processing code in preparation for opening/closing from comment references #8261
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
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
9dbabcd
Merge go-gitea/master into master
guillep2k 889c619
Merge branch 'master' of github.com:go-gitea/gitea
guillep2k d7c46c8
Merge branch 'master' of github.com:go-gitea/gitea
guillep2k 8eaacbf
Merge remote-tracking branch 'refs/remotes/origin/master'
guillep2k de5aa64
Merge branch 'master' of github.com:go-gitea/gitea
guillep2k 80c6f2b
Merge branch 'master' of github.com:go-gitea/gitea
guillep2k 7d7bd6c
Add a markdown stripper for mentions and xrefs
guillep2k c20afe1
Improve comments
guillep2k 69ef1c3
Small code simplification
guillep2k ae66b14
Move reference code to modules/references
guillep2k 999bc87
Fix typo
guillep2k 06f092e
Make MarkdownStripper return [][]byte
guillep2k 16c6ab4
Implement preliminary keywords parsing
guillep2k dadadfa
Add FIXME comment
guillep2k ac40f7f
Merge branch 'master' of github.com:go-gitea/gitea
guillep2k a118be2
Fix comment
guillep2k 9206849
Merge branch 'master' of github.com:go-gitea/gitea into strip-markdown
guillep2k debb01a
make fmt
guillep2k 163ec65
Fix permissions check
guillep2k 4796f43
Fix text assumptions
guillep2k 4c75723
Fix imports
guillep2k 79a7275
Fix lint, fmt
guillep2k 98ea87e
Fix unused import
guillep2k 361ba2e
Add missing export comment
guillep2k ac57ac5
Bypass revive on implemented interface
guillep2k f6ac46b
Merge branch 'master' of github.com:go-gitea/gitea
guillep2k caa53b7
Move mdstripper into its own package
guillep2k b936015
Support alphanumeric patterns
guillep2k c4c467c
Refactor FindAllMentions
guillep2k fdb45e6
Move mentions test to references
guillep2k 70684f5
Parse mentions from reference package
guillep2k b9d709b
Refactor code to implement renderizable references
guillep2k b763968
Fix typo
guillep2k 06b0f51
Move patterns and tests to the references package
guillep2k a00c798
Fix nil reference
guillep2k b563158
Merge branch 'master' of github.com:go-gitea/gitea
guillep2k 5acbf34
Merge 'master' into strip-markdown
guillep2k 8668772
Preliminary rendering attempt of closing keywords
guillep2k fc7e278
Normalize names, comments, general tidy-up
guillep2k 3f9cd80
Add CSS style for action keywords
guillep2k cd31aad
Merge branch 'master' of github.com:go-gitea/gitea into strip-markdown
guillep2k 44d1758
Merge branch 'master' into strip-markdown
guillep2k 02b6eb2
Fix permission for admin and owner
guillep2k 549ef80
Merge branch 'strip-markdown' of github.com:guillep2k/gitea into stri…
guillep2k 4acf06f
Merge branch 'master' of github.com:go-gitea/gitea into strip-markdown
guillep2k 1faece0
Fix golangci-lint
guillep2k b0735c3
Fix golangci-lint
guillep2k d18ade7
merge from master, resolve conflicts
guillep2k 4927471
Merge branch 'master' into strip-markdown
lafriks 4780e47
Merge branch 'master' into strip-markdown
zeripath 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
package models | ||
|
||
import ( | ||
"fmt" | ||
"path" | ||
"strings" | ||
"testing" | ||
|
@@ -181,56 +180,6 @@ func TestPushCommits_AvatarLink(t *testing.T) { | |
pushCommits.AvatarLink("[email protected]")) | ||
} | ||
|
||
func TestRegExp_issueReferenceKeywordsPat(t *testing.T) { | ||
trueTestCases := []string{ | ||
"#2", | ||
"[#2]", | ||
"please see go-gitea/gitea#5", | ||
"#2:", | ||
} | ||
falseTestCases := []string{ | ||
"kb#2", | ||
"#2xy", | ||
} | ||
|
||
for _, testCase := range trueTestCases { | ||
assert.True(t, issueReferenceKeywordsPat.MatchString(testCase)) | ||
} | ||
for _, testCase := range falseTestCases { | ||
assert.False(t, issueReferenceKeywordsPat.MatchString(testCase)) | ||
} | ||
} | ||
|
||
func Test_getIssueFromRef(t *testing.T) { | ||
assert.NoError(t, PrepareTestDatabase()) | ||
repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) | ||
for _, test := range []struct { | ||
Ref string | ||
ExpectedIssueID int64 | ||
}{ | ||
{"#2", 2}, | ||
{"reopen #2", 2}, | ||
{"user2/repo2#1", 4}, | ||
{"fixes user2/repo2#1", 4}, | ||
{"fixes: user2/repo2#1", 4}, | ||
} { | ||
issue, err := getIssueFromRef(repo, test.Ref) | ||
assert.NoError(t, err) | ||
if assert.NotNil(t, issue) { | ||
assert.EqualValues(t, test.ExpectedIssueID, issue.ID) | ||
} | ||
} | ||
|
||
for _, badRef := range []string{ | ||
"doesnotexist/doesnotexist#1", | ||
fmt.Sprintf("#%d", NonexistentID), | ||
} { | ||
issue, err := getIssueFromRef(repo, badRef) | ||
assert.NoError(t, err) | ||
assert.Nil(t, issue) | ||
} | ||
} | ||
|
||
func TestUpdateIssuesCommit(t *testing.T) { | ||
assert.NoError(t, PrepareTestDatabase()) | ||
pushCommits := []*PushCommit{ | ||
|
@@ -431,7 +380,7 @@ func TestUpdateIssuesCommit_AnotherRepoNoPermission(t *testing.T) { | |
AssertNotExistsBean(t, commentBean) | ||
AssertNotExistsBean(t, issueBean, "is_closed=1") | ||
assert.NoError(t, UpdateIssuesCommit(user, repo, pushCommits, repo.DefaultBranch)) | ||
AssertExistsAndLoadBean(t, commentBean) | ||
AssertNotExistsBean(t, commentBean) | ||
AssertNotExistsBean(t, issueBean, "is_closed=1") | ||
CheckConsistencyFor(t, &Action{}) | ||
} | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.