Ver código fonte

Drops deleted workspaces from home page dashboard tabs (#420)

algooapy 7 anos atrás
pai
commit
203b781671

+ 6 - 1
tracim/tracim/lib/content.py Ver arquivo

@@ -735,7 +735,10 @@ class ContentApi(object):
735 735
         assert content_type is not None# DYN_REMOVE
736 736
         assert isinstance(content_type, str) # DYN_REMOVE
737 737
 
738
-        resultset = self._base_query(workspace).order_by(desc(Content.updated))
738
+        resultset = self._base_query(workspace) \
739
+            .filter(Content.workspace_id == Workspace.workspace_id) \
740
+            .filter(Workspace.is_deleted.is_(False)) \
741
+            .order_by(desc(Content.updated))
739 742
 
740 743
         if content_type!=ContentType.Any:
741 744
             resultset = resultset.filter(Content.type==content_type)
@@ -773,6 +776,8 @@ class ContentApi(object):
773 776
 
774 777
         not_read_revisions = self._revisions_base_query(workspace) \
775 778
             .filter(~ContentRevisionRO.revision_id.in_(read_revision_ids)) \
779
+            .filter(ContentRevisionRO.workspace_id == Workspace.workspace_id) \
780
+            .filter(Workspace.is_deleted.is_(False)) \
776 781
             .subquery()
777 782
 
778 783
         not_read_content_ids_query = DBSession.query(

+ 1 - 0
tracim/tracim/model/serializers.py Ver arquivo

@@ -996,6 +996,7 @@ def serialize_workspace_in_list_for_one_user(workspace: Workspace, context: Cont
996 996
     result = DictLikeClass()
997 997
     result['id'] = workspace.workspace_id
998 998
     result['name'] = workspace.label
999
+    result['is_deleted'] = workspace.is_deleted
999 1000
 
1000 1001
     return result
1001 1002
 

+ 2 - 0
tracim/tracim/templates/home.mak Ver arquivo

@@ -137,7 +137,9 @@
137 137
                             </tr>
138 138
                         </thead>
139 139
                         % for role in fake_api.current_user.roles:
140
+                            % if not role.workspace.is_deleted:
140 141
                             ${TABLE_ROW.USER_ROLE_IN_WORKSPACE(fake_api.current_user, role, show_id=False, enable_link='/user/me/workspaces/{workspace}/enable_notifications?next_url=/home', disable_link='/user/me/workspaces/{workspace}/disable_notifications?next_url=/home', base_link='/workspaces/{workspace}')}
142
+                            % endif
141 143
                         % endfor
142 144
                     </table>
143 145
                 % endif