Forráskód Böngészése

Converted ShowSponsors to ShowAds

Yoginth 7 éve
szülő
commit
c50346a54c
7 módosított fájl, 29 hozzáadás és 29 törlés
  1. 7 7
      cmd/admin.go
  2. 1 1
      models/user.go
  3. 5 5
      pkg/auth/auth.go
  4. 1 1
      pkg/form/user.go
  5. 7 7
      routes/admin/users.go
  6. 6 6
      routes/user/auth.go
  7. 2 2
      routes/user/setting.go

+ 7 - 7
cmd/admin.go

@@ -130,13 +130,13 @@ func runCreateUser(c *cli.Context) error {
 	models.SetEngine()
 
 	if err := models.CreateUser(&models.User{
-		Name:         c.String("name"),
-		Email:        c.String("email"),
-		Passwd:       c.String("password"),
-		ThemeColor:   "#161616",
-		IsActive:     true,
-		ShowSponsors: true,
-		IsAdmin:      c.Bool("admin"),
+		Name:       c.String("name"),
+		Email:      c.String("email"),
+		Passwd:     c.String("password"),
+		ThemeColor: "#161616",
+		IsActive:   true,
+		ShowAds:    true,
+		IsAdmin:    c.Bool("admin"),
 	}); err != nil {
 		return fmt.Errorf("CreateUser: %v", err)
 	}

+ 1 - 1
models/user.go

@@ -77,7 +77,7 @@ type User struct {
 	IsActive         bool // Activate primary email
 	PrivateEmail     bool
 	IsBeta           bool
-	ShowSponsors     bool
+	ShowAds          bool
 	IsStaff          bool
 	IsIntern         bool
 	IsAdmin          bool

+ 5 - 5
pkg/auth/auth.go

@@ -97,11 +97,11 @@ func SignedInUser(ctx *macaron.Context, sess session.Store) (*models.User, bool)
 					// Check if enabled auto-registration.
 					if setting.Service.EnableReverseProxyAutoRegister {
 						u := &models.User{
-							Name:         webAuthUser,
-							Email:        gouuid.NewV4().String() + "@localhost",
-							Passwd:       webAuthUser,
-							ShowSponsors: true,
-							IsActive:     true,
+							Name:     webAuthUser,
+							Email:    gouuid.NewV4().String() + "@localhost",
+							Passwd:   webAuthUser,
+							ShowAds:  true,
+							IsActive: true,
 						}
 						if err = models.CreateUser(u); err != nil {
 							// FIXME: should I create a system notice?

+ 1 - 1
pkg/form/user.go

@@ -83,7 +83,7 @@ type UpdateProfile struct {
 	Status       string `binding:"MaxSize(25)"`
 	ThemeColor   string
 	IsBeta       bool
-	ShowSponsors bool
+	ShowAds      bool
 	PrivateEmail bool
 }
 

+ 7 - 7
routes/admin/users.go

@@ -72,13 +72,13 @@ func NewUserPost(c *context.Context, f form.AdminCrateUser) {
 	}
 
 	u := &models.User{
-		Name:         f.UserName,
-		Email:        f.Email,
-		Passwd:       f.Password,
-		ThemeColor:   "#161616",
-		IsActive:     true,
-		ShowSponsors: true,
-		LoginType:    models.LOGIN_PLAIN,
+		Name:       f.UserName,
+		Email:      f.Email,
+		Passwd:     f.Password,
+		ThemeColor: "#161616",
+		IsActive:   true,
+		ShowAds:    true,
+		LoginType:  models.LOGIN_PLAIN,
 	}
 
 	if len(f.LoginType) > 0 {

+ 6 - 6
routes/user/auth.go

@@ -335,12 +335,12 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
 	}
 
 	u := &models.User{
-		Name:         f.UserName,
-		Email:        f.Email,
-		Passwd:       f.Password,
-		ThemeColor:   "#161616",
-		ShowSponsors: true,
-		IsActive:     !setting.Service.RegisterEmailConfirm,
+		Name:       f.UserName,
+		Email:      f.Email,
+		Passwd:     f.Password,
+		ThemeColor: "#161616",
+		ShowAds:    true,
+		IsActive:   !setting.Service.RegisterEmailConfirm,
 	}
 	if err := models.CreateUser(u); err != nil {
 		switch {

+ 2 - 2
routes/user/setting.go

@@ -55,7 +55,7 @@ func Settings(c *context.Context) {
 	c.Data["status"] = c.User.Status
 	c.Data["themecolor"] = c.User.ThemeColor
 	c.Data["is_beta"] = c.User.IsBeta
-	c.Data["show_sponsors"] = c.User.ShowSponsors
+	c.Data["show_ads"] = c.User.ShowAds
 	c.Data["private_email"] = c.User.PrivateEmail
 	c.Success(SETTINGS_PROFILE)
 }
@@ -112,7 +112,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 	c.User.Status = f.Status
 	c.User.ThemeColor = f.ThemeColor
 	c.User.IsBeta = f.IsBeta
-	c.User.ShowSponsors = f.ShowSponsors
+	c.User.ShowAds = f.ShowAds
 	c.User.PrivateEmail = f.PrivateEmail
 
 	if err := models.UpdateUser(c.User); err != nil {