mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Move some files into models' sub packages (#20262)
* Move some files into models' sub packages * Move functions * merge main branch * Fix check * fix check * Fix some tests * Fix lint * Fix lint * Revert lint changes * Fix error comments * Fix lint Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
		@@ -6,6 +6,7 @@
 | 
			
		||||
package repo
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
@@ -14,6 +15,51 @@ import (
 | 
			
		||||
	"code.gitea.io/gitea/modules/util"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.
 | 
			
		||||
type ErrWikiAlreadyExist struct {
 | 
			
		||||
	Title string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
 | 
			
		||||
func IsErrWikiAlreadyExist(err error) bool {
 | 
			
		||||
	_, ok := err.(ErrWikiAlreadyExist)
 | 
			
		||||
	return ok
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (err ErrWikiAlreadyExist) Error() string {
 | 
			
		||||
	return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ErrWikiReservedName represents a reserved name error.
 | 
			
		||||
type ErrWikiReservedName struct {
 | 
			
		||||
	Title string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
 | 
			
		||||
func IsErrWikiReservedName(err error) bool {
 | 
			
		||||
	_, ok := err.(ErrWikiReservedName)
 | 
			
		||||
	return ok
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (err ErrWikiReservedName) Error() string {
 | 
			
		||||
	return fmt.Sprintf("wiki title is reserved: %s", err.Title)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ErrWikiInvalidFileName represents an invalid wiki file name.
 | 
			
		||||
type ErrWikiInvalidFileName struct {
 | 
			
		||||
	FileName string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
 | 
			
		||||
func IsErrWikiInvalidFileName(err error) bool {
 | 
			
		||||
	_, ok := err.(ErrWikiInvalidFileName)
 | 
			
		||||
	return ok
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (err ErrWikiInvalidFileName) Error() string {
 | 
			
		||||
	return fmt.Sprintf("Invalid wiki filename: %s", err.FileName)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WikiCloneLink returns clone URLs of repository wiki.
 | 
			
		||||
func (repo *Repository) WikiCloneLink() *CloneLink {
 | 
			
		||||
	return repo.cloneLink(true)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user