diff --git a/pkg/server/app/users.go b/pkg/server/app/users.go index 2c80a107..707fcd42 100644 --- a/pkg/server/app/users.go +++ b/pkg/server/app/users.go @@ -81,9 +81,6 @@ func (a *App) CreateUser(email, password string, passwordConfirmation string) (d return database.User{}, pkgErrors.Wrap(err, "hashing password") } - // Grant all privileges if self-hosting - var pro = true - uuid, err := helpers.GenUUID() if err != nil { tx.Rollback() @@ -91,8 +88,7 @@ func (a *App) CreateUser(email, password string, passwordConfirmation string) (d } user := database.User{ - UUID: uuid, - Cloud: pro, + UUID: uuid, } if err = tx.Save(&user).Error; err != nil { tx.Rollback() diff --git a/pkg/server/app/users_test.go b/pkg/server/app/users_test.go index 4c6945e6..80d867a1 100644 --- a/pkg/server/app/users_test.go +++ b/pkg/server/app/users_test.go @@ -44,7 +44,6 @@ func TestCreateUser_ProValue(t *testing.T) { testutils.MustExec(t, db.First(&userRecord), "finding user") assert.Equal(t, userCount, int64(1), "book count mismatch") - assert.Equal(t, userRecord.Cloud, true, "user pro mismatch") } diff --git a/pkg/server/controllers/users_test.go b/pkg/server/controllers/users_test.go index a1bed17f..e49fab6b 100644 --- a/pkg/server/controllers/users_test.go +++ b/pkg/server/controllers/users_test.go @@ -108,7 +108,6 @@ func TestJoin(t *testing.T) { var user database.User testutils.MustExec(t, db.Where("id = ?", account.UserID).First(&user), "finding user") - assert.Equal(t, user.Cloud, true, "Cloud mismatch") assert.Equal(t, user.MaxUSN, 0, "MaxUSN mismatch") // welcome email diff --git a/pkg/server/database/models.go b/pkg/server/database/models.go index 7fb5e13f..595e1260 100644 --- a/pkg/server/database/models.go +++ b/pkg/server/database/models.go @@ -68,7 +68,6 @@ type User struct { Account Account `gorm:"foreignKey:UserID"` LastLoginAt *time.Time `json:"-"` MaxUSN int `json:"-" gorm:"default:0"` - Cloud bool `json:"-" gorm:"default:false"` } // Account is a model for an account diff --git a/pkg/server/session/session.go b/pkg/server/session/session.go index 5ad92fec..8c55549c 100644 --- a/pkg/server/session/session.go +++ b/pkg/server/session/session.go @@ -27,14 +27,12 @@ type Session struct { UUID string `json:"uuid"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` - Pro bool `json:"pro"` } // New returns a new session for the given user func New(user database.User, account database.Account) Session { return Session{ UUID: user.UUID, - Pro: user.Cloud, Email: account.Email.String, EmailVerified: account.EmailVerified, } diff --git a/pkg/server/session/session_test.go b/pkg/server/session/session_test.go index 967053e1..107dacfe 100644 --- a/pkg/server/session/session_test.go +++ b/pkg/server/session/session_test.go @@ -27,36 +27,32 @@ import ( ) func TestNew(t *testing.T) { - u1 := database.User{UUID: "0f5f0054-d23f-4be1-b5fb-57673109e9cb", Cloud: true} + u1 := database.User{UUID: "0f5f0054-d23f-4be1-b5fb-57673109e9cb"} a1 := database.Account{Email: database.ToNullString("alice@example.com"), EmailVerified: false} - u2 := database.User{UUID: "718a1041-bbe6-496e-bbe4-ea7e572c295e", Cloud: false} + u2 := database.User{UUID: "718a1041-bbe6-496e-bbe4-ea7e572c295e"} a2 := database.Account{Email: database.ToNullString("bob@example.com"), EmailVerified: false} testCases := []struct { - user database.User - account database.Account - expectedPro bool + user database.User + account database.Account }{ { - user: u1, - account: a1, - expectedPro: true, + user: u1, + account: a1, }, { - user: u2, - account: a2, - expectedPro: false, + user: u2, + account: a2, }, } - for _, tc := range testCases { - t.Run(fmt.Sprintf("user pro %t", tc.expectedPro), func(t *testing.T) { + for idx, tc := range testCases { + t.Run(fmt.Sprintf("user %d", idx), func(t *testing.T) { // Execute got := New(tc.user, tc.account) expected := Session{ UUID: tc.user.UUID, - Pro: tc.expectedPro, Email: tc.account.Email.String, EmailVerified: tc.account.EmailVerified, } diff --git a/pkg/server/testutils/main.go b/pkg/server/testutils/main.go index 37388d15..b8519581 100644 --- a/pkg/server/testutils/main.go +++ b/pkg/server/testutils/main.go @@ -113,8 +113,7 @@ func SetupUserData(db *gorm.DB) database.User { } user := database.User{ - UUID: uuid, - Cloud: true, + UUID: uuid, } if err := db.Save(&user).Error; err != nil { diff --git a/pkg/server/views/templates/users/settings_about.gohtml b/pkg/server/views/templates/users/settings_about.gohtml index bba9a8f0..3252b9de 100644 --- a/pkg/server/views/templates/users/settings_about.gohtml +++ b/pkg/server/views/templates/users/settings_about.gohtml @@ -27,27 +27,6 @@ - {{if ne .Standalone "true"}} -
-
-
-

Support

-
- -
- {{if .User.Cloud}} - - support@getdnote.com - - {{else}} - Not eligible - {{end}} -
-
-
- {{else}} - - {{end}} diff --git a/pkg/server/views/view.go b/pkg/server/views/view.go index 75a9aa92..2b0e57a9 100644 --- a/pkg/server/views/view.go +++ b/pkg/server/views/view.go @@ -119,9 +119,6 @@ func (v *View) Render(w http.ResponseWriter, r *http.Request, data *Data, status vd.Yield["EmailVerified"] = vd.Account.EmailVerified vd.Yield["EmailVerified"] = vd.Account.EmailVerified } - if vd.User != nil { - vd.Yield["Cloud"] = vd.User.Cloud - } vd.Yield["CurrentPath"] = r.URL.Path vd.Yield["Standalone"] = buildinfo.Standalone