Explorar el Código

Add pinning notification based on number of files

shortcutme hace 5 años
padre
commit
393c66385f
Se han modificado 1 ficheros con 14 adiciones y 2 borrados
  1. 14 2
      plugins/OptionalManager/UiWebsocketPlugin.py

+ 14 - 2
plugins/OptionalManager/UiWebsocketPlugin.py

@@ -206,15 +206,27 @@ class UiWebsocketPlugin(object):
         return "ok"
 
     def actionOptionalFilePin(self, to, inner_path, address=None):
+        if type(inner_path) is not list:
+            inner_path = [inner_path]
         back = self.setPin(inner_path, 1, address)
+        num_file = len(inner_path)
         if back == "ok":
-            self.cmd("notification", ["done", _["Pinned %s files"] % len(inner_path) if type(inner_path) is list else 1, 5000])
+            if num_file == 1:
+                self.cmd("notification", ["done", _["Pinned %s"] % helper.getFilename(inner_path[0]), 5000])
+            else:
+                self.cmd("notification", ["done", _["Pinned %s files"] % num_file, 5000])
         self.response(to, back)
 
     def actionOptionalFileUnpin(self, to, inner_path, address=None):
+        if type(inner_path) is not list:
+            inner_path = [inner_path]
         back = self.setPin(inner_path, 0, address)
+        num_file = len(inner_path)
         if back == "ok":
-            self.cmd("notification", ["done", _["Removed pin from %s files"] % len(inner_path) if type(inner_path) is list else 1, 5000])
+            if num_file == 1:
+                self.cmd("notification", ["done", _["Removed pin from %s"] % helper.getFilename(inner_path[0]), 5000])
+            else:
+                self.cmd("notification", ["done", _["Removed pin from %s files"] % num_file, 5000])
         self.response(to, back)
 
     def actionOptionalFileDelete(self, to, inner_path, address=None):