finish all new user settings UI

This commit is contained in:
Unknwon 2015-09-10 11:40:34 -04:00
parent c8d92fad30
commit 52ec80fa18
21 changed files with 295 additions and 283 deletions

View file

@ -546,7 +546,7 @@ func GetIssueCountByPoster(uid, rid int64, isClosed bool) int64 {
// IssueUser represents an issue-user relation.
type IssueUser struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"uid INDEX"` // User ID.
UID int64 `xorm:"INDEX"` // User ID.
IssueID int64
RepoID int64 `xorm:"INDEX"`
MilestoneID int64

View file

@ -87,7 +87,7 @@ func init() {
new(Team), new(OrgUser), new(TeamUser), new(TeamRepo),
new(Notice), new(EmailAddress))
gonicNames := []string{"SSL"}
gonicNames := []string{"UID", "SSL"}
for _, name := range gonicNames {
core.LintGonicMapper[name] = true
}

View file

@ -1658,7 +1658,7 @@ func NotifyWatchers(act *Action) error {
type Star struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"uid UNIQUE(s)"`
UID int64 `xorm:"UNIQUE(s)"`
RepoID int64 `xorm:"UNIQUE(s)"`
}

View file

@ -14,7 +14,7 @@ import (
// AccessToken represents a personal access token.
type AccessToken struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"uid INDEX"`
UID int64 `xorm:"INDEX"`
Name string
Sha1 string `xorm:"UNIQUE VARCHAR(40)"`
Created time.Time `xorm:"CREATED"`

View file

@ -110,8 +110,8 @@ func (u *User) AfterSet(colName string, _ xorm.Cell) {
// EmailAdresses is the list of all email addresses of a user. Can contain the
// primary email address, but is not obligatory
type EmailAddress struct {
Id int64
Uid int64 `xorm:"INDEX NOT NULL"`
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"INDEX NOT NULL"`
Email string `xorm:"UNIQUE NOT NULL"`
IsActivated bool
IsPrimary bool `xorm:"-"`
@ -624,7 +624,7 @@ func deleteUser(e *xorm.Session, u *User) error {
&Follow{FollowID: u.Id},
&Action{UserID: u.Id},
&IssueUser{UID: u.Id},
&EmailAddress{Uid: u.Id},
&EmailAddress{UID: u.Id},
); err != nil {
return fmt.Errorf("deleteUser: %v", err)
}
@ -831,11 +831,11 @@ func AddEmailAddress(email *EmailAddress) error {
func (email *EmailAddress) Activate() error {
email.IsActivated = true
if _, err := x.Id(email.Id).AllCols().Update(email); err != nil {
if _, err := x.Id(email.ID).AllCols().Update(email); err != nil {
return err
}
if user, err := GetUserByID(email.Uid); err != nil {
if user, err := GetUserByID(email.UID); err != nil {
return err
} else {
user.Rands = GetUserSalt()
@ -851,7 +851,7 @@ func DeleteEmailAddress(email *EmailAddress) error {
return ErrEmailNotExist
}
if _, err = x.Id(email.Id).Delete(email); err != nil {
if _, err = x.Id(email.ID).Delete(email); err != nil {
return err
}
@ -871,12 +871,12 @@ func MakeEmailPrimary(email *EmailAddress) error {
return ErrEmailNotActivated
}
user := &User{Id: email.Uid}
user := &User{Id: email.UID}
has, err = x.Get(user)
if err != nil {
return err
} else if !has {
return ErrUserNotExist{email.Uid, ""}
return ErrUserNotExist{email.UID, ""}
}
// Make sure the former primary email doesn't disappear
@ -885,7 +885,7 @@ func MakeEmailPrimary(email *EmailAddress) error {
if err != nil {
return err
} else if !has {
former_primary_email.Uid = user.Id
former_primary_email.UID = user.Id
former_primary_email.IsActivated = user.IsActive
x.Insert(former_primary_email)
}
@ -962,7 +962,7 @@ func GetUserByEmail(email string) (*User, error) {
return nil, err
}
if has {
return GetUserByID(emailAddress.Uid)
return GetUserByID(emailAddress.UID)
}
return nil, ErrUserNotExist{0, "email"}