aboutsummaryrefslogtreecommitdiffstats
path: root/services/wiki
diff options
context:
space:
mode:
Diffstat (limited to 'services/wiki')
-rw-r--r--services/wiki/wiki.go7
-rw-r--r--services/wiki/wiki_test.go9
2 files changed, 7 insertions, 9 deletions
diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go
index 43e35eed69..ac5283bbeb 100644
--- a/services/wiki/wiki.go
+++ b/services/wiki/wiki.go
@@ -12,7 +12,6 @@ import (
"os"
"strings"
- "code.gitea.io/gitea/models"
admin_model "code.gitea.io/gitea/models/admin"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
@@ -33,7 +32,7 @@ var (
func nameAllowed(name string) error {
if util.IsStringInSlice(name, reservedWikiNames) {
- return models.ErrWikiReservedName{
+ return repo_model.ErrWikiReservedName{
Title: name,
}
}
@@ -59,7 +58,7 @@ func NameToFilename(name string) string {
// FilenameToName converts a wiki filename to its corresponding page name.
func FilenameToName(filename string) (string, error) {
if !strings.HasSuffix(filename, ".md") {
- return "", models.ErrWikiInvalidFileName{
+ return "", repo_model.ErrWikiInvalidFileName{
FileName: filename,
}
}
@@ -178,7 +177,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
if isNew {
if isWikiExist {
- return models.ErrWikiAlreadyExist{
+ return repo_model.ErrWikiAlreadyExist{
Title: newWikiPath,
}
}
diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go
index 1852ddbcb3..938a7d6acd 100644
--- a/services/wiki/wiki_test.go
+++ b/services/wiki/wiki_test.go
@@ -9,7 +9,6 @@ import (
"path/filepath"
"testing"
- "code.gitea.io/gitea/models"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
@@ -90,11 +89,11 @@ func TestWikiFilenameToName(t *testing.T) {
} {
_, err := FilenameToName(badFilename)
assert.Error(t, err)
- assert.True(t, models.IsErrWikiInvalidFileName(err))
+ assert.True(t, repo_model.IsErrWikiInvalidFileName(err))
}
_, err := FilenameToName("badescaping%%.md")
assert.Error(t, err)
- assert.False(t, models.IsErrWikiInvalidFileName(err))
+ assert.False(t, repo_model.IsErrWikiInvalidFileName(err))
}
func TestWikiNameToFilenameToName(t *testing.T) {
@@ -157,7 +156,7 @@ func TestRepository_AddWikiPage(t *testing.T) {
// test for already-existing wiki name
err := AddWikiPage(git.DefaultContext, doer, repo, "Home", wikiContent, commitMsg)
assert.Error(t, err)
- assert.True(t, models.IsErrWikiAlreadyExist(err))
+ assert.True(t, repo_model.IsErrWikiAlreadyExist(err))
})
t.Run("check wiki reserved name", func(t *testing.T) {
@@ -165,7 +164,7 @@ func TestRepository_AddWikiPage(t *testing.T) {
// test for reserved wiki name
err := AddWikiPage(git.DefaultContext, doer, repo, "_edit", wikiContent, commitMsg)
assert.Error(t, err)
- assert.True(t, models.IsErrWikiReservedName(err))
+ assert.True(t, repo_model.IsErrWikiReservedName(err))
})
}