ソースを参照

add do_notify param + same parent and label case

Guénaël Muller 6 年 前
コミット
4e186be67f
共有1 個のファイルを変更した3 個の追加2 個の削除を含む
  1. 3 2
      tracim/tracim/lib/content.py

+ 3 - 2
tracim/tracim/lib/content.py ファイルの表示

@@ -866,8 +866,9 @@ class ContentApi(object):
866 866
         new_parent: Content=None,
867 867
         new_label: str=None,
868 868
         do_save: bool=True,
869
+        do_notify: bool=True,
869 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 872
             # TODO - G.M - 08-03-2018 - Use something else than value error
872 873
             raise ValueError("You can't copy file into itself")
873 874
         if new_parent:
@@ -899,7 +900,7 @@ class ContentApi(object):
899 900
                     item.depot_file.file
900 901
                 )
901 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 905
     def move_recursively(self, item: Content,
905 906
                          new_parent: Content, new_workspace: Workspace):