Browse Source

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

algooapy 7 years ago
parent
commit
203b781671

+ 6 - 1
tracim/tracim/lib/content.py View File

735
         assert content_type is not None# DYN_REMOVE
735
         assert content_type is not None# DYN_REMOVE
736
         assert isinstance(content_type, str) # DYN_REMOVE
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
         if content_type!=ContentType.Any:
743
         if content_type!=ContentType.Any:
741
             resultset = resultset.filter(Content.type==content_type)
744
             resultset = resultset.filter(Content.type==content_type)
773
 
776
 
774
         not_read_revisions = self._revisions_base_query(workspace) \
777
         not_read_revisions = self._revisions_base_query(workspace) \
775
             .filter(~ContentRevisionRO.revision_id.in_(read_revision_ids)) \
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
             .subquery()
781
             .subquery()
777
 
782
 
778
         not_read_content_ids_query = DBSession.query(
783
         not_read_content_ids_query = DBSession.query(

+ 1 - 0
tracim/tracim/model/serializers.py View File

996
     result = DictLikeClass()
996
     result = DictLikeClass()
997
     result['id'] = workspace.workspace_id
997
     result['id'] = workspace.workspace_id
998
     result['name'] = workspace.label
998
     result['name'] = workspace.label
999
+    result['is_deleted'] = workspace.is_deleted
999
 
1000
 
1000
     return result
1001
     return result
1001
 
1002
 

+ 2 - 0
tracim/tracim/templates/home.mak View File

137
                             </tr>
137
                             </tr>
138
                         </thead>
138
                         </thead>
139
                         % for role in fake_api.current_user.roles:
139
                         % for role in fake_api.current_user.roles:
140
+                            % if not role.workspace.is_deleted:
140
                             ${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}')}
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
                         % endfor
143
                         % endfor
142
                     </table>
144
                     </table>
143
                 % endif
145
                 % endif