mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix spelling errors in comments.
This commit is contained in:
		@@ -349,7 +349,7 @@ func NewRepoAction(u *User, repo *Repository) (err error) {
 | 
				
			|||||||
	return err
 | 
						return err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TransferRepoAction adds new action for transfering repository.
 | 
					// TransferRepoAction adds new action for transferring repository.
 | 
				
			||||||
func TransferRepoAction(u, newUser *User, repo *Repository) (err error) {
 | 
					func TransferRepoAction(u, newUser *User, repo *Repository) (err error) {
 | 
				
			||||||
	action := &Action{
 | 
						action := &Action{
 | 
				
			||||||
		ActUserId:    u.Id,
 | 
							ActUserId:    u.Id,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@ var LoginTypes = map[LoginType]string{
 | 
				
			|||||||
	SMTP: "SMTP",
 | 
						SMTP: "SMTP",
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Ensure structs implmented interface.
 | 
					// Ensure structs implemented interface.
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	_ core.Conversion = &LDAPConfig{}
 | 
						_ core.Conversion = &LDAPConfig{}
 | 
				
			||||||
	_ core.Conversion = &SMTPConfig{}
 | 
						_ core.Conversion = &SMTPConfig{}
 | 
				
			||||||
@@ -226,7 +226,7 @@ func UserSignIn(uname, passwd string) (*User, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Query if name/passwd can login against the LDAP direcotry pool
 | 
					// Query if name/passwd can login against the LDAP directory pool
 | 
				
			||||||
// Create a local user if success
 | 
					// Create a local user if success
 | 
				
			||||||
// Return the same LoginUserPlain semantic
 | 
					// Return the same LoginUserPlain semantic
 | 
				
			||||||
// FIXME: https://github.com/gogits/gogs/issues/672
 | 
					// FIXME: https://github.com/gogits/gogs/issues/672
 | 
				
			||||||
@@ -318,7 +318,7 @@ func SmtpAuth(host string, port int, a smtp.Auth, useTls bool) error {
 | 
				
			|||||||
	return ErrUnsupportedLoginType
 | 
						return ErrUnsupportedLoginType
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Query if name/passwd can login against the LDAP direcotry pool
 | 
					// Query if name/passwd can login against the LDAP directory pool
 | 
				
			||||||
// Create a local user if success
 | 
					// Create a local user if success
 | 
				
			||||||
// Return the same LoginUserPlain semantic
 | 
					// Return the same LoginUserPlain semantic
 | 
				
			||||||
func LoginUserSMTPSource(u *User, name, passwd string, sourceId int64, cfg *SMTPConfig, autoRegister bool) (*User, error) {
 | 
					func LoginUserSMTPSource(u *User, name, passwd string, sourceId int64, cfg *SMTPConfig, autoRegister bool) (*User, error) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -107,7 +107,7 @@ func SetEngine() (err error) {
 | 
				
			|||||||
		return fmt.Errorf("models.init(fail to connect to database): %v", err)
 | 
							return fmt.Errorf("models.init(fail to connect to database): %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// WARNNING: for serv command, MUST remove the output to os.stdout,
 | 
						// WARNING: for serv command, MUST remove the output to os.stdout,
 | 
				
			||||||
	// so use log file to instead print to stdout.
 | 
						// so use log file to instead print to stdout.
 | 
				
			||||||
	logPath := path.Join(setting.LogRootPath, "xorm.log")
 | 
						logPath := path.Join(setting.LogRootPath, "xorm.log")
 | 
				
			||||||
	os.MkdirAll(path.Dir(logPath), os.ModePerm)
 | 
						os.MkdirAll(path.Dir(logPath), os.ModePerm)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,7 +79,7 @@ func UpdateOauth2(oa *Oauth2) error {
 | 
				
			|||||||
	return err
 | 
						return err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetOauthByUserId returns list of oauthes that are releated to given user.
 | 
					// GetOauthByUserId returns list of oauthes that are related to given user.
 | 
				
			||||||
func GetOauthByUserId(uid int64) ([]*Oauth2, error) {
 | 
					func GetOauthByUserId(uid int64) ([]*Oauth2, error) {
 | 
				
			||||||
	socials := make([]*Oauth2, 0, 5)
 | 
						socials := make([]*Oauth2, 0, 5)
 | 
				
			||||||
	err := x.Find(&socials, Oauth2{Uid: uid})
 | 
						err := x.Find(&socials, Oauth2{Uid: uid})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -240,7 +240,7 @@ func IsOrganizationMember(orgId, uid int64) bool {
 | 
				
			|||||||
	return has
 | 
						return has
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// IsPublicMembership returns ture if given user public his/her membership.
 | 
					// IsPublicMembership returns true if given user public his/her membership.
 | 
				
			||||||
func IsPublicMembership(orgId, uid int64) bool {
 | 
					func IsPublicMembership(orgId, uid int64) bool {
 | 
				
			||||||
	has, _ := x.Where("uid=?", uid).And("org_id=?", orgId).And("is_public=?", true).Get(new(OrgUser))
 | 
						has, _ := x.Where("uid=?", uid).And("org_id=?", orgId).And("is_public=?", true).Get(new(OrgUser))
 | 
				
			||||||
	return has
 | 
						return has
 | 
				
			||||||
@@ -861,7 +861,7 @@ func GetTeamMembers(orgId, teamId int64) ([]*User, error) {
 | 
				
			|||||||
	return us, err
 | 
						return us, err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetUserTeams returns all teams that user belongs to in given origanization.
 | 
					// GetUserTeams returns all teams that user belongs to in given organization.
 | 
				
			||||||
func GetUserTeams(orgId, uid int64) ([]*Team, error) {
 | 
					func GetUserTeams(orgId, uid int64) ([]*Team, error) {
 | 
				
			||||||
	tus := make([]*TeamUser, 0, 5)
 | 
						tus := make([]*TeamUser, 0, 5)
 | 
				
			||||||
	if err := x.Where("uid=?", uid).And("org_id=?", orgId).Find(&tus); err != nil {
 | 
						if err := x.Where("uid=?", uid).And("org_id=?", orgId).Find(&tus); err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -856,7 +856,7 @@ func UpdateRepository(repo *Repository) error {
 | 
				
			|||||||
	return err
 | 
						return err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DeleteRepository deletes a repository for a user or orgnaztion.
 | 
					// DeleteRepository deletes a repository for a user or organization.
 | 
				
			||||||
func DeleteRepository(uid, repoId int64, userName string) error {
 | 
					func DeleteRepository(uid, repoId int64, userName string) error {
 | 
				
			||||||
	repo := &Repository{Id: repoId, OwnerId: uid}
 | 
						repo := &Repository{Id: repoId, OwnerId: uid}
 | 
				
			||||||
	has, err := x.Get(repo)
 | 
						has, err := x.Get(repo)
 | 
				
			||||||
@@ -1239,7 +1239,7 @@ func GitGcRepos() error {
 | 
				
			|||||||
//   \__/\  /  (____  /__|  \___  >___|  /
 | 
					//   \__/\  /  (____  /__|  \___  >___|  /
 | 
				
			||||||
//        \/        \/          \/     \/
 | 
					//        \/        \/          \/     \/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Watch is connection request for receiving repository notifycation.
 | 
					// Watch is connection request for receiving repository notification.
 | 
				
			||||||
type Watch struct {
 | 
					type Watch struct {
 | 
				
			||||||
	Id     int64
 | 
						Id     int64
 | 
				
			||||||
	UserId int64 `xorm:"UNIQUE(watch)"`
 | 
						UserId int64 `xorm:"UNIQUE(watch)"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -147,7 +147,7 @@ func (u *User) CustomAvatarPath() string {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UploadAvatar saves custom avatar for user.
 | 
					// UploadAvatar saves custom avatar for user.
 | 
				
			||||||
// FIXME: splite uploads to different subdirs in case we have massive users.
 | 
					// FIXME: split uploads to different subdirs in case we have massive users.
 | 
				
			||||||
func (u *User) UploadAvatar(data []byte) error {
 | 
					func (u *User) UploadAvatar(data []byte) error {
 | 
				
			||||||
	u.UseCustomAvatar = true
 | 
						u.UseCustomAvatar = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -584,7 +584,7 @@ func GetUserIdsByNames(names []string) []int64 {
 | 
				
			|||||||
	return ids
 | 
						return ids
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UserCommit represtns a commit with validation of user.
 | 
					// UserCommit represents a commit with validation of user.
 | 
				
			||||||
type UserCommit struct {
 | 
					type UserCommit struct {
 | 
				
			||||||
	User *User
 | 
						User *User
 | 
				
			||||||
	*git.Commit
 | 
						*git.Commit
 | 
				
			||||||
@@ -651,7 +651,7 @@ func SearchUserByName(opt SearchOption) (us []*User, err error) {
 | 
				
			|||||||
	return us, err
 | 
						return us, err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Follow is connection request for receiving user notifycation.
 | 
					// Follow is connection request for receiving user notification.
 | 
				
			||||||
type Follow struct {
 | 
					type Follow struct {
 | 
				
			||||||
	Id       int64
 | 
						Id       int64
 | 
				
			||||||
	UserId   int64 `xorm:"unique(follow)"`
 | 
						UserId   int64 `xorm:"unique(follow)"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,7 +99,7 @@ func (w *Webhook) UpdateEvent() error {
 | 
				
			|||||||
	return err
 | 
						return err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HasPushEvent returns true if hook enbaled push event.
 | 
					// HasPushEvent returns true if hook enabled push event.
 | 
				
			||||||
func (w *Webhook) HasPushEvent() bool {
 | 
					func (w *Webhook) HasPushEvent() bool {
 | 
				
			||||||
	if w.PushOnly {
 | 
						if w.PushOnly {
 | 
				
			||||||
		return true
 | 
							return true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,7 +80,7 @@ func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) {
 | 
				
			|||||||
						return nil, false
 | 
											return nil, false
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					// Check if enabled auto-registeration.
 | 
										// Check if enabled auto-registration.
 | 
				
			||||||
					if setting.Service.EnableReverseProxyAutoRegister {
 | 
										if setting.Service.EnableReverseProxyAutoRegister {
 | 
				
			||||||
						u := &models.User{
 | 
											u := &models.User{
 | 
				
			||||||
							Name:     webAuthUser,
 | 
												Name:     webAuthUser,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ type Ldapsource struct {
 | 
				
			|||||||
	Port         int    // port number
 | 
						Port         int    // port number
 | 
				
			||||||
	UseSSL       bool   // Use SSL
 | 
						UseSSL       bool   // Use SSL
 | 
				
			||||||
	BaseDN       string // Base DN
 | 
						BaseDN       string // Base DN
 | 
				
			||||||
	Attributes   string // Attribut to search
 | 
						Attributes   string // Attribute to search
 | 
				
			||||||
	Filter       string // Query filter to validate entry
 | 
						Filter       string // Query filter to validate entry
 | 
				
			||||||
	MsAdSAFormat string // in the case of MS AD Simple Authen, the format to use (see: http://msdn.microsoft.com/en-us/library/cc223499.aspx)
 | 
						MsAdSAFormat string // in the case of MS AD Simple Authen, the format to use (see: http://msdn.microsoft.com/en-us/library/cc223499.aspx)
 | 
				
			||||||
	Enabled      bool   // if this source is disabled
 | 
						Enabled      bool   // if this source is disabled
 | 
				
			||||||
@@ -37,7 +37,7 @@ func AddSource(name string, host string, port int, usessl bool, basedn string, a
 | 
				
			|||||||
	Authensource = append(Authensource, ldaphost)
 | 
						Authensource = append(Authensource, ldaphost)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//LoginUser : try to login an user to LDAP sources, return requested (attribut,true) if ok, ("",false) other wise
 | 
					//LoginUser : try to login an user to LDAP sources, return requested (attribute,true) if ok, ("",false) other wise
 | 
				
			||||||
//First match wins
 | 
					//First match wins
 | 
				
			||||||
//Returns first attribute if exists
 | 
					//Returns first attribute if exists
 | 
				
			||||||
func LoginUser(name, passwd string) (a string, r bool) {
 | 
					func LoginUser(name, passwd string) (a string, r bool) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ func init() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// hash email to md5 string
 | 
					// hash email to md5 string
 | 
				
			||||||
// keep this func in order to make this package indenpent
 | 
					// keep this func in order to make this package independent
 | 
				
			||||||
func HashEmail(email string) string {
 | 
					func HashEmail(email string) string {
 | 
				
			||||||
	// https://en.gravatar.com/site/implement/hash/
 | 
						// https://en.gravatar.com/site/implement/hash/
 | 
				
			||||||
	email = strings.TrimSpace(email)
 | 
						email = strings.TrimSpace(email)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import (
 | 
				
			|||||||
	"github.com/gogits/gogs/modules/asn1-ber"
 | 
						"github.com/gogits/gogs/modules/asn1-ber"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// debbuging type
 | 
					// debugging type
 | 
				
			||||||
//     - has a Printf method to write the debug output
 | 
					//     - has a Printf method to write the debug output
 | 
				
			||||||
type debugging bool
 | 
					type debugging bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -162,7 +162,7 @@ func newLogger(buffer int64) *Logger {
 | 
				
			|||||||
	return l
 | 
						return l
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SetLogger sets new logger instanse with given logger adapter and config.
 | 
					// SetLogger sets new logger instance with given logger adapter and config.
 | 
				
			||||||
func (l *Logger) SetLogger(adapter string, config string) error {
 | 
					func (l *Logger) SetLogger(adapter string, config string) error {
 | 
				
			||||||
	l.lock.Lock()
 | 
						l.lock.Lock()
 | 
				
			||||||
	defer l.lock.Unlock()
 | 
						defer l.lock.Unlock()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ const (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// A Decoder is a function that decodes a character set, one character at a time.
 | 
					// A Decoder is a function that decodes a character set, one character at a time.
 | 
				
			||||||
// It works much like utf8.DecodeRune, but has an aditional status return value.
 | 
					// It works much like utf8.DecodeRune, but has an additional status return value.
 | 
				
			||||||
type Decoder func(p []byte) (c rune, size int, status Status)
 | 
					type Decoder func(p []byte) (c rune, size int, status Status)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// An Encoder is a function that encodes a character set, one character at a time.
 | 
					// An Encoder is a function that encodes a character set, one character at a time.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -453,7 +453,7 @@ func RequireTrueOwner() macaron.Handler {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GitHookService checks if repsitory Git hooks service has been enabled.
 | 
					// GitHookService checks if repository Git hooks service has been enabled.
 | 
				
			||||||
func GitHookService() macaron.Handler {
 | 
					func GitHookService() macaron.Handler {
 | 
				
			||||||
	return func(ctx *Context) {
 | 
						return func(ctx *Context) {
 | 
				
			||||||
		if !ctx.User.AllowGitHook && !ctx.User.IsAdmin {
 | 
							if !ctx.User.AllowGitHook && !ctx.User.IsAdmin {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -260,7 +260,7 @@ func NewConfigContext() {
 | 
				
			|||||||
		log.Fatal(4, "Expect user(%s) but current user is: %s", RunUser, curUser)
 | 
							log.Fatal(4, "Expect user(%s) but current user is: %s", RunUser, curUser)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Determine and create root git reposiroty path.
 | 
						// Determine and create root git repository path.
 | 
				
			||||||
	homeDir, err := com.HomeDir()
 | 
						homeDir, err := com.HomeDir()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		log.Fatal(4, "Fail to get home directory: %v", err)
 | 
							log.Fatal(4, "Fail to get home directory: %v", err)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -628,7 +628,7 @@ func UpdateAssignee(ctx *middleware.Context) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	aid := com.StrTo(ctx.Query("assigneeid")).MustInt64()
 | 
						aid := com.StrTo(ctx.Query("assigneeid")).MustInt64()
 | 
				
			||||||
	// Not check for invalid assignne id and give responsibility to owners.
 | 
						// Not check for invalid assignee id and give responsibility to owners.
 | 
				
			||||||
	issue.AssigneeId = aid
 | 
						issue.AssigneeId = aid
 | 
				
			||||||
	if err = models.UpdateIssueUserPairByAssignee(aid, issue.Id); err != nil {
 | 
						if err = models.UpdateIssueUserPairByAssignee(aid, issue.Id); err != nil {
 | 
				
			||||||
		ctx.Handle(500, "UpdateIssueUserPairByAssignee: %v", err)
 | 
							ctx.Handle(500, "UpdateIssueUserPairByAssignee: %v", err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user