diff --git a/system/service/role.go b/system/service/role.go index 545f54967..01a69e152 100644 --- a/system/service/role.go +++ b/system/service/role.go @@ -595,7 +595,7 @@ func (svc role) Unarchive(ctx context.Context, roleID uint64) (err error) { return RoleErrNotAllowedToUndelete() } - r.ArchivedAt = nil + upd.ArchivedAt = nil if err = store.UpdateRole(ctx, svc.store, upd); err != nil { return } diff --git a/tests/system/role_test.go b/tests/system/role_test.go index ceaf399c3..036ec1310 100644 --- a/tests/system/role_test.go +++ b/tests/system/role_test.go @@ -13,7 +13,7 @@ import ( "github.com/cortezaproject/corteza-server/system/service" "github.com/cortezaproject/corteza-server/system/types" "github.com/cortezaproject/corteza-server/tests/helpers" - "github.com/steinfletcher/apitest-jsonpath" + jsonpath "github.com/steinfletcher/apitest-jsonpath" "github.com/stretchr/testify/require" ) @@ -375,7 +375,12 @@ func TestRoleUnarchive(t *testing.T) { h := newHelper(t) helpers.AllowMe(h, types.RoleRbacResource(0), "delete") - res := h.repoMakeRole() + n := time.Now() + res := h.createRole(&types.Role{ + Name: "test_role", + Handle: "test_role", + ArchivedAt: &n, + }) h.apiInit(). Post(fmt.Sprintf("/roles/%d/unarchive", res.ID)).