Fix typos in models/ (#576)
This commit is contained in:
parent
dc3ff9f2ab
commit
1207bda94b
15 changed files with 44 additions and 44 deletions
|
@ -163,7 +163,7 @@ func maxAccessMode(modes ...AccessMode) AccessMode {
|
||||||
return max
|
return max
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: do corss-comparison so reduce deletions and additions to the minimum?
|
// FIXME: do cross-comparison so reduce deletions and additions to the minimum?
|
||||||
func (repo *Repository) refreshAccesses(e Engine, accessMap map[int64]AccessMode) (err error) {
|
func (repo *Repository) refreshAccesses(e Engine, accessMap map[int64]AccessMode) (err error) {
|
||||||
minMode := AccessModeRead
|
minMode := AccessModeRead
|
||||||
if !repo.IsPrivate {
|
if !repo.IsPrivate {
|
||||||
|
|
|
@ -145,7 +145,7 @@ func (a *Action) GetRepoPath() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShortRepoPath returns the virtual path to the action repository
|
// ShortRepoPath returns the virtual path to the action repository
|
||||||
// trimed to max 20 + 1 + 33 chars.
|
// trimmed to max 20 + 1 + 33 chars.
|
||||||
func (a *Action) ShortRepoPath() string {
|
func (a *Action) ShortRepoPath() string {
|
||||||
return path.Join(a.ShortRepoUserName(), a.ShortRepoName())
|
return path.Join(a.ShortRepoUserName(), a.ShortRepoName())
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is conflict to have close and reopen at same time, so refsMarkd doesn't need to reinit here.
|
// It is conflict to have close and reopen at same time, so refsMarked doesn't need to reinit here.
|
||||||
for _, ref := range issueReopenKeywordsPat.FindAllString(c.Message, -1) {
|
for _, ref := range issueReopenKeywordsPat.FindAllString(c.Message, -1) {
|
||||||
ref = ref[strings.IndexByte(ref, byte(' '))+1:]
|
ref = ref[strings.IndexByte(ref, byte(' '))+1:]
|
||||||
ref = strings.TrimRightFunc(ref, issueIndexTrimRight)
|
ref = strings.TrimRightFunc(ref, issueIndexTrimRight)
|
||||||
|
|
|
@ -583,7 +583,7 @@ type ErrPullRequestNotExist struct {
|
||||||
IssueID int64
|
IssueID int64
|
||||||
HeadRepoID int64
|
HeadRepoID int64
|
||||||
BaseRepoID int64
|
BaseRepoID int64
|
||||||
HeadBarcnh string
|
HeadBranch string
|
||||||
BaseBranch string
|
BaseBranch string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ func IsErrPullRequestNotExist(err error) bool {
|
||||||
|
|
||||||
func (err ErrPullRequestNotExist) Error() string {
|
func (err ErrPullRequestNotExist) Error() string {
|
||||||
return fmt.Sprintf("pull request does not exist [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
|
return fmt.Sprintf("pull request does not exist [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
|
||||||
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
|
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
|
// ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
|
||||||
|
|
|
@ -78,7 +78,7 @@ var (
|
||||||
func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML {
|
func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML {
|
||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
|
|
||||||
// Reproduce signs which are cutted for inline diff before.
|
// Reproduce signs which are cut for inline diff before.
|
||||||
switch lineType {
|
switch lineType {
|
||||||
case DiffLineAdd:
|
case DiffLineAdd:
|
||||||
buf.WriteByte('+')
|
buf.WriteByte('+')
|
||||||
|
@ -234,7 +234,7 @@ const cmdDiffHead = "diff --git "
|
||||||
// ParsePatch builds a Diff object from a io.Reader and some
|
// ParsePatch builds a Diff object from a io.Reader and some
|
||||||
// parameters.
|
// parameters.
|
||||||
// TODO: move this function to gogits/git-module
|
// TODO: move this function to gogits/git-module
|
||||||
func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*Diff, error) {
|
func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*Diff, error) {
|
||||||
var (
|
var (
|
||||||
diff = &Diff{Files: make([]*DiffFile, 0)}
|
diff = &Diff{Files: make([]*DiffFile, 0)}
|
||||||
|
|
||||||
|
@ -295,8 +295,8 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
|
||||||
curFileLinesCount++
|
curFileLinesCount++
|
||||||
lineCount++
|
lineCount++
|
||||||
|
|
||||||
// Diff data too large, we only show the first about maxlines lines
|
// Diff data too large, we only show the first about maxLines lines
|
||||||
if curFileLinesCount >= maxLines || len(line) >= maxLineCharacteres {
|
if curFileLinesCount >= maxLines || len(line) >= maxLineCharacters {
|
||||||
curFile.IsIncomplete = true
|
curFile.IsIncomplete = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
|
||||||
// GetDiffRange builds a Diff between two commits of a repository.
|
// GetDiffRange builds a Diff between two commits of a repository.
|
||||||
// passing the empty string as beforeCommitID returns a diff from the
|
// passing the empty string as beforeCommitID returns a diff from the
|
||||||
// parent commit.
|
// parent commit.
|
||||||
func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
|
func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error) {
|
||||||
gitRepo, err := git.OpenRepository(repoPath)
|
gitRepo, err := git.OpenRepository(repoPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -486,7 +486,7 @@ func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxL
|
||||||
pid := process.Add(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath), cmd)
|
pid := process.Add(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath), cmd)
|
||||||
defer process.Remove(pid)
|
defer process.Remove(pid)
|
||||||
|
|
||||||
diff, err := ParsePatch(maxLines, maxLineCharacteres, maxFiles, stdout)
|
diff, err := ParsePatch(maxLines, maxLineCharacters, maxFiles, stdout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("ParsePatch: %v", err)
|
return nil, fmt.Errorf("ParsePatch: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -554,6 +554,6 @@ func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Write
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDiffCommit builds a Diff representing the given commitID.
|
// GetDiffCommit builds a Diff representing the given commitID.
|
||||||
func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
|
func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error) {
|
||||||
return GetDiffRange(repoPath, "", commitID, maxLines, maxLineCharacteres, maxFiles)
|
return GetDiffRange(repoPath, "", commitID, maxLines, maxLineCharacters, maxFiles)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ type GraphItems []GraphItem
|
||||||
// GetCommitGraph return a list of commit (GraphItems) from all branches
|
// GetCommitGraph return a list of commit (GraphItems) from all branches
|
||||||
func GetCommitGraph(r *git.Repository) (GraphItems, error) {
|
func GetCommitGraph(r *git.Repository) (GraphItems, error) {
|
||||||
|
|
||||||
var Commitgraph []GraphItem
|
var CommitGraph []GraphItem
|
||||||
|
|
||||||
format := "DATA:|%d|%H|%ad|%an|%ae|%h|%s"
|
format := "DATA:|%d|%H|%ad|%an|%ae|%h|%s"
|
||||||
|
|
||||||
|
@ -47,19 +47,19 @@ func GetCommitGraph(r *git.Repository) (GraphItems, error) {
|
||||||
)
|
)
|
||||||
graph, err := graphCmd.RunInDir(r.Path)
|
graph, err := graphCmd.RunInDir(r.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Commitgraph, err
|
return CommitGraph, err
|
||||||
}
|
}
|
||||||
|
|
||||||
Commitgraph = make([]GraphItem, 0, 100)
|
CommitGraph = make([]GraphItem, 0, 100)
|
||||||
for _, s := range strings.Split(graph, "\n") {
|
for _, s := range strings.Split(graph, "\n") {
|
||||||
GraphItem, err := graphItemFromString(s, r)
|
GraphItem, err := graphItemFromString(s, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Commitgraph, err
|
return CommitGraph, err
|
||||||
}
|
}
|
||||||
Commitgraph = append(Commitgraph, GraphItem)
|
CommitGraph = append(CommitGraph, GraphItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Commitgraph, nil
|
return CommitGraph, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
|
func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
|
||||||
|
@ -102,7 +102,7 @@ func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
|
||||||
rows[5],
|
rows[5],
|
||||||
rows[6],
|
rows[6],
|
||||||
rows[7],
|
rows[7],
|
||||||
len(rows[2]) == 0, // no commits refered to, only relation in current line.
|
len(rows[2]) == 0, // no commits referred to, only relation in current line.
|
||||||
}
|
}
|
||||||
return gi, nil
|
return gi, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ func DeleteLabel(repoID, labelID int64) error {
|
||||||
// |___/____ >____ >____/ \___ >_______ (____ /___ /\___ >____/
|
// |___/____ >____ >____/ \___ >_______ (____ /___ /\___ >____/
|
||||||
// \/ \/ \/ \/ \/ \/ \/
|
// \/ \/ \/ \/ \/ \/ \/
|
||||||
|
|
||||||
// IssueLabel represetns an issue-lable relation.
|
// IssueLabel represents an issue-label relation.
|
||||||
type IssueLabel struct {
|
type IssueLabel struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
IssueID int64 `xorm:"UNIQUE(s)"`
|
IssueID int64 `xorm:"UNIQUE(s)"`
|
||||||
|
|
|
@ -24,7 +24,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mail wahtcers.
|
// Mail watchers.
|
||||||
watchers, err := GetWatchers(issue.RepoID)
|
watchers, err := GetWatchers(issue.RepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("GetWatchers [%d]: %v", issue.RepoID, err)
|
return fmt.Errorf("GetWatchers [%d]: %v", issue.RepoID, err)
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (n *Notification) BeforeInsert() {
|
||||||
n.UpdatedUnix = nowUnix
|
n.UpdatedUnix = nowUnix
|
||||||
}
|
}
|
||||||
|
|
||||||
// BeforeUpdate runs while updateing a record
|
// BeforeUpdate runs while updating a record
|
||||||
func (n *Notification) BeforeUpdate() {
|
func (n *Notification) BeforeUpdate() {
|
||||||
var (
|
var (
|
||||||
now = time.Now()
|
now = time.Now()
|
||||||
|
|
|
@ -372,7 +372,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
|
||||||
|
|
||||||
// TODO: when squash commits, no need to append merge commit.
|
// TODO: when squash commits, no need to append merge commit.
|
||||||
// It is possible that head branch is not fully sync with base branch for merge commits,
|
// It is possible that head branch is not fully sync with base branch for merge commits,
|
||||||
// so we need to get latest head commit and append merge commit manully
|
// so we need to get latest head commit and append merge commit manually
|
||||||
// to avoid strange diff commits produced.
|
// to avoid strange diff commits produced.
|
||||||
mergeCommit, err := baseGitRepo.GetBranchCommit(pr.BaseBranch)
|
mergeCommit, err := baseGitRepo.GetBranchCommit(pr.BaseBranch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -419,9 +419,9 @@ func (pr *PullRequest) testPatch() (err error) {
|
||||||
return fmt.Errorf("BaseRepo.PatchPath: %v", err)
|
return fmt.Errorf("BaseRepo.PatchPath: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fast fail if patch does not exist, this assumes data is cruppted.
|
// Fast fail if patch does not exist, this assumes data is corrupted.
|
||||||
if !com.IsFile(patchPath) {
|
if !com.IsFile(patchPath) {
|
||||||
log.Trace("PullRequest[%d].testPatch: ignored cruppted data", pr.ID)
|
log.Trace("PullRequest[%d].testPatch: ignored corrupted data", pr.ID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ func PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest,
|
||||||
return prs, maxResults, findSession.Find(&prs)
|
return prs, maxResults, findSession.Find(&prs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUnmergedPullRequest returnss a pull request that is open and has not been merged
|
// GetUnmergedPullRequest returns a pull request that is open and has not been merged
|
||||||
// by given head/base and repo/branch.
|
// by given head/base and repo/branch.
|
||||||
func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error) {
|
func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error) {
|
||||||
pr := new(PullRequest)
|
pr := new(PullRequest)
|
||||||
|
@ -591,7 +591,7 @@ func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch
|
||||||
return pr, nil
|
return pr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUnmergedPullRequestsByHeadInfo returnss all pull requests that are open and has not been merged
|
// GetUnmergedPullRequestsByHeadInfo returns all pull requests that are open and has not been merged
|
||||||
// by given head information (repo and branch).
|
// by given head information (repo and branch).
|
||||||
func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error) {
|
func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error) {
|
||||||
prs := make([]*PullRequest, 0, 2)
|
prs := make([]*PullRequest, 0, 2)
|
||||||
|
@ -602,7 +602,7 @@ func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequ
|
||||||
Find(&prs)
|
Find(&prs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUnmergedPullRequestsByBaseInfo returnss all pull requests that are open and has not been merged
|
// GetUnmergedPullRequestsByBaseInfo returns all pull requests that are open and has not been merged
|
||||||
// by given base information (repo and branch).
|
// by given base information (repo and branch).
|
||||||
func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error) {
|
func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error) {
|
||||||
prs := make([]*PullRequest, 0, 2)
|
prs := make([]*PullRequest, 0, 2)
|
||||||
|
@ -885,7 +885,7 @@ func ChangeUsernameInPullRequests(oldUserName, newUserName string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkAndUpdateStatus checks if pull request is possible to levaing checking status,
|
// checkAndUpdateStatus checks if pull request is possible to leaving checking status,
|
||||||
// and set to be either conflict or mergeable.
|
// and set to be either conflict or mergeable.
|
||||||
func (pr *PullRequest) checkAndUpdateStatus() {
|
func (pr *PullRequest) checkAndUpdateStatus() {
|
||||||
// Status is not changed to conflict means mergeable.
|
// Status is not changed to conflict means mergeable.
|
||||||
|
@ -893,7 +893,7 @@ func (pr *PullRequest) checkAndUpdateStatus() {
|
||||||
pr.Status = PullRequestStatusMergeable
|
pr.Status = PullRequestStatusMergeable
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure there is no waiting test to process before levaing the checking status.
|
// Make sure there is no waiting test to process before leaving the checking status.
|
||||||
if !pullRequestQueue.Exist(pr.ID) {
|
if !pullRequestQueue.Exist(pr.ID) {
|
||||||
if err := pr.UpdateCols("status"); err != nil {
|
if err := pr.UpdateCols("status"); err != nil {
|
||||||
log.Error(4, "Update[%d]: %v", pr.ID, err)
|
log.Error(4, "Update[%d]: %v", pr.ID, err)
|
||||||
|
|
|
@ -259,7 +259,7 @@ func (repo *Repository) AfterSet(colName string, _ xorm.Cell) {
|
||||||
|
|
||||||
// MustOwner always returns a valid *User object to avoid
|
// MustOwner always returns a valid *User object to avoid
|
||||||
// conceptually impossible error handling.
|
// conceptually impossible error handling.
|
||||||
// It creates a fake object that contains error deftail
|
// It creates a fake object that contains error details
|
||||||
// when error occurs.
|
// when error occurs.
|
||||||
func (repo *Repository) MustOwner() *User {
|
func (repo *Repository) MustOwner() *User {
|
||||||
return repo.mustOwner(x)
|
return repo.mustOwner(x)
|
||||||
|
@ -854,7 +854,7 @@ func getRepoInitFile(tp, name string) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRepoOptions) error {
|
func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRepoOptions) error {
|
||||||
// Clone to temprory path and do the init commit.
|
// Clone to temporary path and do the init commit.
|
||||||
_, stderr, err := process.Exec(
|
_, stderr, err := process.Exec(
|
||||||
fmt.Sprintf("initRepository(git clone): %s", repoPath), "git", "clone", repoPath, tmpDir)
|
fmt.Sprintf("initRepository(git clone): %s", repoPath), "git", "clone", repoPath, tmpDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1327,7 +1327,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
|
||||||
return fmt.Errorf("getOwner: %v", err)
|
return fmt.Errorf("getOwner: %v", err)
|
||||||
}
|
}
|
||||||
if repo.Owner.IsOrganization() {
|
if repo.Owner.IsOrganization() {
|
||||||
// Organization repository need to recalculate access table when visivility is changed.
|
// Organization repository need to recalculate access table when visibility is changed.
|
||||||
if err = repo.recalculateTeamAccesses(e, 0); err != nil {
|
if err = repo.recalculateTeamAccesses(e, 0); err != nil {
|
||||||
return fmt.Errorf("recalculateTeamAccesses: %v", err)
|
return fmt.Errorf("recalculateTeamAccesses: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ func SyncMirrors() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitSyncMirrors initializes a go routine to sync the mirros
|
// InitSyncMirrors initializes a go routine to sync the mirrors
|
||||||
func InitSyncMirrors() {
|
func InitSyncMirrors() {
|
||||||
go SyncMirrors()
|
go SyncMirrors()
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ func appendAuthorizedKeysToFile(keys ...*PublicKey) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkKeyContent onlys checks if key content has been used as public key,
|
// checkKeyContent only checks if key content has been used as public key,
|
||||||
// it is OK to use same key as deploy key for multiple repositories/users.
|
// it is OK to use same key as deploy key for multiple repositories/users.
|
||||||
func checkKeyContent(content string) error {
|
func checkKeyContent(content string) error {
|
||||||
has, err := x.Get(&PublicKey{
|
has, err := x.Get(&PublicKey{
|
||||||
|
@ -526,7 +526,7 @@ func DeletePublicKey(doer *User, id int64) (err error) {
|
||||||
|
|
||||||
// RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.
|
// RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.
|
||||||
// Note: x.Iterate does not get latest data after insert/delete, so we have to call this function
|
// Note: x.Iterate does not get latest data after insert/delete, so we have to call this function
|
||||||
// outsite any session scope independently.
|
// outside any session scope independently.
|
||||||
func RewriteAllPublicKeys() error {
|
func RewriteAllPublicKeys() error {
|
||||||
sshOpLocker.Lock()
|
sshOpLocker.Lock()
|
||||||
defer sshOpLocker.Unlock()
|
defer sshOpLocker.Unlock()
|
||||||
|
|
|
@ -663,7 +663,7 @@ func Users(opts *SearchUserOptions) ([]*User, error) {
|
||||||
Find(&users)
|
Find(&users)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get user by erify code
|
// get user by verify code
|
||||||
func getVerifyUser(code string) (user *User) {
|
func getVerifyUser(code string) (user *User) {
|
||||||
if len(code) <= base.TimeLimitCodeLength {
|
if len(code) <= base.TimeLimitCodeLength {
|
||||||
return nil
|
return nil
|
||||||
|
@ -1057,7 +1057,7 @@ type UserCommit struct {
|
||||||
*git.Commit
|
*git.Commit
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user.
|
// ValidateCommitWithEmail check if author's e-mail of commit is corresponding to a user.
|
||||||
func ValidateCommitWithEmail(c *git.Commit) *User {
|
func ValidateCommitWithEmail(c *git.Commit) *User {
|
||||||
u, err := GetUserByEmail(c.Author.Email)
|
u, err := GetUserByEmail(c.Author.Email)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1216,7 +1216,7 @@ func FollowUser(userID, followID int64) (err error) {
|
||||||
return sess.Commit()
|
return sess.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnfollowUser unmarks someone be another's follower.
|
// UnfollowUser unmarks someone as another's follower.
|
||||||
func UnfollowUser(userID, followID int64) (err error) {
|
func UnfollowUser(userID, followID int64) (err error) {
|
||||||
if userID == followID || !IsFollowing(userID, followID) {
|
if userID == followID || !IsFollowing(userID, followID) {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -49,8 +49,8 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We alway want the primary email address displayed, even if it's not in
|
// We always want the primary email address displayed, even if it's not in
|
||||||
// the emailaddress table (yet).
|
// the email address table (yet).
|
||||||
if !isPrimaryFound {
|
if !isPrimaryFound {
|
||||||
emails = append(emails, &EmailAddress{
|
emails = append(emails, &EmailAddress{
|
||||||
Email: u.Email,
|
Email: u.Email,
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SlackMeta contains the slack metdata
|
// SlackMeta contains the slack metadata
|
||||||
type SlackMeta struct {
|
type SlackMeta struct {
|
||||||
Channel string `json:"channel"`
|
Channel string `json:"channel"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
|
@ -75,7 +75,7 @@ func SlackShortTextFormatter(s string) string {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// SlackLinkFormatter creates a link compatablie with slack
|
// SlackLinkFormatter creates a link compatible with slack
|
||||||
func SlackLinkFormatter(url string, text string) string {
|
func SlackLinkFormatter(url string, text string) string {
|
||||||
return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))
|
return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue