Skip to content

Add badge capabilities to users #20607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
placate lint
  • Loading branch information
techknowlogick committed Aug 2, 2022
commit 8c8f0206aacd4e40575d73b1cee17bfb7777457d
7 changes: 2 additions & 5 deletions models/migrations/v999.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func creatUserBadgesTable(x *xorm.Engine) error {
ImageURL string
}

type UserBadge struct {
type userBadge struct {
ID int64 `xorm:"pk autoincr"`
BadgeID int64
UserID int64
Expand All @@ -24,8 +24,5 @@ func creatUserBadgesTable(x *xorm.Engine) error {
if err := x.Sync2(new(Badge)); err != nil {
return err
}

if err := x.Sync2(new(UserBadge)); err != nil {
return err
}
return x.Sync2(new(userBadge))
}
5 changes: 2 additions & 3 deletions models/user/badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ type Badge struct {
ImageURL string
}

// UserBadge links users with a badge
type UserBadge struct {
type userBadge struct {
ID int64 `xorm:"pk autoincr"`
BadgeID int64
UserID int64
}

func init() {
db.RegisterModel(new(Badge))
db.RegisterModel(new(UserBadge))
db.RegisterModel(new(userBadge))
}

// GetUserFollowers returns range of user's followers.
Expand Down