1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Update progress of milestones when closing/reopening issues and allow closing of issues in commit messages

This commit is contained in:
Justin Nuß
2014-07-23 13:48:06 +02:00
parent 6e9f1c52b1
commit 469cbc8813
4 changed files with 155 additions and 24 deletions

View File

@@ -7,9 +7,9 @@ package models
import (
"errors"
"fmt"
"io/ioutil"
"html"
"html/template"
"io/ioutil"
"os"
"path"
"path/filepath"
@@ -43,6 +43,7 @@ var (
ErrRepoNameIllegal = errors.New("Repository name contains illegal characters")
ErrRepoFileNotLoaded = errors.New("Repository file not loaded")
ErrMirrorNotExist = errors.New("Mirror does not exist")
ErrInvalidReference = errors.New("Invalid reference specified")
)
var (
@@ -837,6 +838,26 @@ func DeleteRepository(userId, repoId int64, userName string) error {
return sess.Commit()
}
// GetRepositoryByRef returns a Repository specified by a GFM reference.
// See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
func GetRepositoryByRef(ref string) (*Repository, error) {
n := strings.IndexByte(ref, byte('/'))
if n < 2 {
return nil, ErrInvalidReference
}
userName, repoName := ref[:n], ref[n+1:]
user, err := GetUserByName(userName)
if err != nil {
return nil, err
}
return GetRepositoryByName(user.Id, repoName)
}
// GetRepositoryByName returns the repository by given name under user if exists.
func GetRepositoryByName(userId int64, repoName string) (*Repository, error) {
repo := &Repository{
@@ -1017,4 +1038,4 @@ func IsWatching(uid, rid int64) bool {
func ForkRepository(repoName string, uid int64) {
}
}