Browse Source

add do_notify param + same parent and label case

Guénaël Muller 6 years ago
parent
commit
4e186be67f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      tracim/tracim/lib/content.py

+ 3 - 2
tracim/tracim/lib/content.py View File

866
         new_parent: Content=None,
866
         new_parent: Content=None,
867
         new_label: str=None,
867
         new_label: str=None,
868
         do_save: bool=True,
868
         do_save: bool=True,
869
+        do_notify: bool=True,
869
     ) -> None:
870
     ) -> None:
870
-        if not new_parent and not new_label:
871
+        if (not new_parent and not new_label) or (new_parent == item.parent and new_label == item.label):  # nopep8
871
             # TODO - G.M - 08-03-2018 - Use something else than value error
872
             # TODO - G.M - 08-03-2018 - Use something else than value error
872
             raise ValueError("You can't copy file into itself")
873
             raise ValueError("You can't copy file into itself")
873
         if new_parent:
874
         if new_parent:
899
                     item.depot_file.file
900
                     item.depot_file.file
900
                 )
901
                 )
901
         if do_save:
902
         if do_save:
902
-            self.save(file, ActionDescription.CREATION, do_notify=True)
903
+            self.save(file, ActionDescription.CREATION, do_notify=do_notify)
903
 
904
 
904
     def move_recursively(self, item: Content,
905
     def move_recursively(self, item: Content,
905
                          new_parent: Content, new_workspace: Workspace):
906
                          new_parent: Content, new_workspace: Workspace):