@@ -22,7 +22,11 @@ func TestUpdateUser(t *testing.T) {
2222admin := unittest .AssertExistsAndLoadBean (t ,& user_model.User {ID :1 })
2323
2424assert .Error (t ,UpdateUser (db .DefaultContext ,admin ,& UpdateOptions {
25- IsAdmin :optional .Some (false ),
25+ IsAdmin :UpdateOptionFieldFromValue (false ),
26+ }))
27+
28+ assert .NoError (t ,UpdateUser (db .DefaultContext ,admin ,& UpdateOptions {
29+ IsAdmin :UpdateOptionFieldFromSync (false ),
2630}))
2731
2832user := unittest .AssertExistsAndLoadBean (t ,& user_model.User {ID :28 })
@@ -38,7 +42,7 @@ func TestUpdateUser(t *testing.T) {
3842MaxRepoCreation :optional .Some (10 ),
3943IsRestricted :optional .Some (true ),
4044IsActive :optional .Some (false ),
41- IsAdmin :optional . Some (true ),
45+ IsAdmin :UpdateOptionFieldFromValue (true ),
4246Visibility :optional .Some (structs .VisibleTypePrivate ),
4347KeepActivityPrivate :optional .Some (true ),
4448Language :optional .Some ("lang" ),
@@ -60,7 +64,7 @@ func TestUpdateUser(t *testing.T) {
6064assert .Equal (t ,opts .MaxRepoCreation .Value (),user .MaxRepoCreation )
6165assert .Equal (t ,opts .IsRestricted .Value (),user .IsRestricted )
6266assert .Equal (t ,opts .IsActive .Value (),user .IsActive )
63- assert .Equal (t ,opts .IsAdmin .Value (),user .IsAdmin )
67+ assert .Equal (t ,opts .IsAdmin .Value (). FieldValue ,user .IsAdmin )
6468assert .Equal (t ,opts .Visibility .Value (),user .Visibility )
6569assert .Equal (t ,opts .KeepActivityPrivate .Value (),user .KeepActivityPrivate )
6670assert .Equal (t ,opts .Language .Value (),user .Language )
@@ -80,7 +84,7 @@ func TestUpdateUser(t *testing.T) {
8084assert .Equal (t ,opts .MaxRepoCreation .Value (),user .MaxRepoCreation )
8185assert .Equal (t ,opts .IsRestricted .Value (),user .IsRestricted )
8286assert .Equal (t ,opts .IsActive .Value (),user .IsActive )
83- assert .Equal (t ,opts .IsAdmin .Value (),user .IsAdmin )
87+ assert .Equal (t ,opts .IsAdmin .Value (). FieldValue ,user .IsAdmin )
8488assert .Equal (t ,opts .Visibility .Value (),user .Visibility )
8589assert .Equal (t ,opts .KeepActivityPrivate .Value (),user .KeepActivityPrivate )
8690assert .Equal (t ,opts .Language .Value (),user .Language )