Преглед изворни кода

add is_active to role/workspace_member

Guénaël Muller пре 6 година
родитељ
комит
79239ba09d

+ 4 - 0
tracim/models/context_models.py Прегледај датотеку

@@ -299,6 +299,10 @@ class UserRoleWorkspaceInContext(object):
299 299
         return WorkspaceRoles.get_role_from_level(self.user_role.role).slug
300 300
 
301 301
     @property
302
+    def is_active(self) -> bool:
303
+        return self.user.is_active
304
+
305
+    @property
302 306
     def user(self) -> UserInContext:
303 307
         """
304 308
         User who has this role, with context data

+ 1 - 0
tracim/tests/functional/test_workspaces.py Прегледај датотеку

@@ -164,6 +164,7 @@ class TestWorkspaceMembersEndpoint(FunctionalTest):
164 164
         assert user_role['workspace']['slug'] == 'business'
165 165
         assert user_role['user']['public_name'] == 'Global manager'
166 166
         assert user_role['user']['user_id'] == 1
167
+        assert user_role['is_active'] is True
167 168
         # TODO - G.M - 24-05-2018 - [Avatar] Replace
168 169
         # by correct value when avatar feature will be enabled
169 170
         assert user_role['user']['avatar_url'] is None

+ 1 - 0
tracim/views/core_api/schemas.py Прегледај датотеку

@@ -236,6 +236,7 @@ class WorkspaceMemberSchema(marshmallow.Schema):
236 236
     workspace = marshmallow.fields.Nested(
237 237
         WorkspaceDigestSchema(exclude=('sidebar_entries',))
238 238
     )
239
+    is_active = marshmallow.fields.Bool()
239 240
 
240 241
     class Meta:
241 242
         description = 'Workspace Member information'