Browse Source

share plugin: fix unshare()

Andrew Dolgov 1 year ago
parent
commit
4036b479f9
1 changed files with 10 additions and 6 deletions
  1. 10 6
      plugins/share/share.js

+ 10 - 6
plugins/share/share.js

@@ -47,17 +47,21 @@ Plugins.Share = {
 			unshare: function () {
 				if (confirm(__("Remove sharing for this article?"))) {
 
-					Notify.progress("Trying to unshare...", true);
-
 					const query = {op: "pluginhandler", plugin: "share", method: "unshare", id: id};
 
 					xhrPost("backend.php", query, () => {
-						notify("Article unshared.");
+						try {
+							const img = $("SHARE-IMG-" + id);
 
-						const img = $("SHARE-IMG-" + id);
-						img.removeClassName("shared");
+							if (img) {
+								img.removeClassName("shared");
+								img.up("div[id*=RROW]").removeClassName("shared");
+							}
 
-						dialog.hide();
+							dialog.hide();
+						} catch (e) {
+							console.error(e);
+						}
 					});
 				}