瀏覽代碼

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):