Damien ACCORSI 9 gadus atpakaļ
vecāks
revīzija
8f75ce798f

+ 4 - 1
tracim/tracim/lib/workspace.py Parādīt failu

45
         workspace.description = description
45
         workspace.description = description
46
 
46
 
47
         # By default, we force the current user to be the workspace manager
47
         # By default, we force the current user to be the workspace manager
48
-        role = RoleApi(self._user).create_one(self._user, workspace, UserRoleInWorkspace.WORKSPACE_MANAGER)
48
+        # And to receive email notifications
49
+        role = RoleApi(self._user).create_one(self._user, workspace,
50
+                                              UserRoleInWorkspace.WORKSPACE_MANAGER,
51
+                                              with_notif=True)
49
 
52
 
50
         DBSession.add(workspace)
53
         DBSession.add(workspace)
51
         DBSession.add(role)
54
         DBSession.add(role)

+ 4 - 0
tracim/tracim/tests/library/test_content_api.py Parādīt failu

342
 
342
 
343
         RoleApi(user1).create_one(user2, workspace,
343
         RoleApi(user1).create_one(user2, workspace,
344
                                   UserRoleInWorkspace.CONTENT_MANAGER,
344
                                   UserRoleInWorkspace.CONTENT_MANAGER,
345
+                                  with_notif=False,
345
                                   flush=True)
346
                                   flush=True)
346
 
347
 
347
         # Test starts here
348
         # Test starts here
405
 
406
 
406
         RoleApi(user1).create_one(user2, workspace,
407
         RoleApi(user1).create_one(user2, workspace,
407
                                   UserRoleInWorkspace.CONTENT_MANAGER,
408
                                   UserRoleInWorkspace.CONTENT_MANAGER,
409
+                                  with_notif=True,
408
                                   flush=True)
410
                                   flush=True)
409
 
411
 
410
         # Test starts here
412
         # Test starts here
471
 
473
 
472
         RoleApi(user1).create_one(user2, workspace,
474
         RoleApi(user1).create_one(user2, workspace,
473
                                   UserRoleInWorkspace.CONTENT_MANAGER,
475
                                   UserRoleInWorkspace.CONTENT_MANAGER,
476
+                                  with_notif=True,
474
                                   flush=True)
477
                                   flush=True)
475
 
478
 
476
         # show archived is used at the top end of the test
479
         # show archived is used at the top end of the test
545
 
548
 
546
         RoleApi(user1).create_one(user2, workspace,
549
         RoleApi(user1).create_one(user2, workspace,
547
                                   UserRoleInWorkspace.CONTENT_MANAGER,
550
                                   UserRoleInWorkspace.CONTENT_MANAGER,
551
+                                  with_notif=True,
548
                                   flush=True)
552
                                   flush=True)
549
 
553
 
550
         # show archived is used at the top end of the test
554
         # show archived is used at the top end of the test

+ 6 - 0
tracim/tracim/tests/library/test_helpers.py Parādīt failu

25
 
25
 
26
         h.CFG.DATA_UPDATE_ALLOWED_DURATION = 0
26
         h.CFG.DATA_UPDATE_ALLOWED_DURATION = 0
27
         item.created = datetime.datetime.now() - datetime.timedelta(0, 10)
27
         item.created = datetime.datetime.now() - datetime.timedelta(0, 10)
28
+
29
+        item.type = DictLikeClass({'id': 5})
30
+        eq_(False, h.is_item_still_editable(item))
31
+
32
+        item.type.id = 'comment'
28
         eq_(False, h.is_item_still_editable(item))
33
         eq_(False, h.is_item_still_editable(item))
29
 
34
 
30
         h.CFG.DATA_UPDATE_ALLOWED_DURATION = -1
35
         h.CFG.DATA_UPDATE_ALLOWED_DURATION = -1
36
+        item.type.id = 'comment'
31
         item.created = datetime.datetime.now() - datetime.timedelta(0, 10)
37
         item.created = datetime.datetime.now() - datetime.timedelta(0, 10)
32
         eq_(True, h.is_item_still_editable(item))
38
         eq_(True, h.is_item_still_editable(item))
33
 
39