Skip to content

Commit 8483adc

Browse files
committed
remove nolint comment
1 parent dc08ddb commit 8483adc

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

models/user/redirect.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,25 @@ func (err ErrUserRedirectNotExist) Error() string {
2727
return fmt.Sprintf("user redirect does not exist [name: %s]", err.Name)
2828
}
2929

30-
// UserRedirect represents that a user name should be redirected to another
31-
//nolint
32-
type UserRedirect struct { //nolint
30+
// Redirect represents that a user name should be redirected to another
31+
type Redirect struct {
3332
ID int64 `xorm:"pk autoincr"`
3433
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
3534
RedirectUserID int64 // userID to redirect to
3635
}
3736

37+
func (Redirect) TableName() string {
38+
return "user_redirect"
39+
}
40+
3841
func init() {
39-
db.RegisterModel(new(UserRedirect))
42+
db.RegisterModel(new(Redirect))
4043
}
4144

4245
// LookupUserRedirect look up userID if a user has a redirect name
4346
func LookupUserRedirect(userName string) (int64, error) {
4447
userName = strings.ToLower(userName)
45-
redirect := &UserRedirect{LowerName: userName}
48+
redirect := &Redirect{LowerName: userName}
4649
if has, err := db.GetEngine(db.DefaultContext).Get(redirect); err != nil {
4750
return 0, err
4851
} else if !has {
@@ -60,7 +63,7 @@ func NewUserRedirect(ctx context.Context, ID int64, oldUserName, newUserName str
6063
return err
6164
}
6265

63-
return db.Insert(ctx, &UserRedirect{
66+
return db.Insert(ctx, &Redirect{
6467
LowerName: oldUserName,
6568
RedirectUserID: ID,
6669
})
@@ -70,6 +73,6 @@ func NewUserRedirect(ctx context.Context, ID int64, oldUserName, newUserName str
7073
// anything else
7174
func DeleteUserRedirect(ctx context.Context, userName string) error {
7275
userName = strings.ToLower(userName)
73-
_, err := db.GetEngine(ctx).Delete(&UserRedirect{LowerName: userName})
76+
_, err := db.GetEngine(ctx).Delete(&Redirect{LowerName: userName})
7477
return err
7578
}

0 commit comments

Comments
 (0)