Warning about deleting private key for owned sites
This commit is contained in:
parent
ea6016d004
commit
4eb50377c3
2 changed files with 50 additions and 33 deletions
|
@ -346,6 +346,25 @@ class Sidebar extends Class
|
||||||
if res == "ok"
|
if res == "ok"
|
||||||
@wrapper.notifications.add "sign", "done", "#{inner_path} Signed and published!", 5000
|
@wrapper.notifications.add "sign", "done", "#{inner_path} Signed and published!", 5000
|
||||||
|
|
||||||
|
handleSiteDeleteClick: ->
|
||||||
|
if @wrapper.site_info.privatekey
|
||||||
|
question = "Are you sure?<br>This site has a saved private key"
|
||||||
|
options = ["Forget private key and delete site"]
|
||||||
|
else
|
||||||
|
question = "Are you sure?"
|
||||||
|
options = ["Delete this site", "Blacklist"]
|
||||||
|
@wrapper.displayConfirm question, options, (confirmed) =>
|
||||||
|
if confirmed == 1
|
||||||
|
@tag.find("#button-delete").addClass("loading")
|
||||||
|
@wrapper.ws.cmd "siteDelete", @wrapper.site_info.address, ->
|
||||||
|
document.location = $(".fixbutton-bg").attr("href")
|
||||||
|
else if confirmed == 2
|
||||||
|
@wrapper.displayPrompt "Blacklist this site", "text", "Delete and Blacklist", "Reason", (reason) =>
|
||||||
|
@tag.find("#button-delete").addClass("loading")
|
||||||
|
@wrapper.ws.cmd "siteblockAdd", [@wrapper.site_info.address, reason]
|
||||||
|
@wrapper.ws.cmd "siteDelete", @wrapper.site_info.address, ->
|
||||||
|
document.location = $(".fixbutton-bg").attr("href")
|
||||||
|
|
||||||
onOpened: ->
|
onOpened: ->
|
||||||
@log "Opened"
|
@log "Opened"
|
||||||
@scrollable()
|
@scrollable()
|
||||||
|
@ -417,19 +436,7 @@ class Sidebar extends Class
|
||||||
|
|
||||||
# Delete site
|
# Delete site
|
||||||
@tag.find("#button-delete").off("click touchend").on "click touchend", =>
|
@tag.find("#button-delete").off("click touchend").on "click touchend", =>
|
||||||
@wrapper.displayConfirm "Are you sure?", ["Delete this site", "Blacklist"], (confirmed) =>
|
@handleSiteDeleteClick()
|
||||||
if confirmed == 1
|
|
||||||
@tag.find("#button-delete").addClass("loading")
|
|
||||||
@wrapper.ws.cmd "siteDelete", @wrapper.site_info.address, ->
|
|
||||||
document.location = $(".fixbutton-bg").attr("href")
|
|
||||||
else if confirmed == 2
|
|
||||||
@wrapper.displayPrompt "Blacklist this site", "text", "Delete and Blacklist", "Reason", (reason) =>
|
|
||||||
@tag.find("#button-delete").addClass("loading")
|
|
||||||
@wrapper.ws.cmd "siteblockAdd", [@wrapper.site_info.address, reason]
|
|
||||||
@wrapper.ws.cmd "siteDelete", @wrapper.site_info.address, ->
|
|
||||||
document.location = $(".fixbutton-bg").attr("href")
|
|
||||||
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
# Owned checkbox
|
# Owned checkbox
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
|
||||||
/* ---- Console.coffee ---- */
|
/* ---- Console.coffee ---- */
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,7 +353,6 @@
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
|
||||||
/* ---- Menu.coffee ---- */
|
/* ---- Menu.coffee ---- */
|
||||||
|
|
||||||
|
|
||||||
|
@ -437,7 +435,6 @@
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
|
||||||
/* ---- RateLimit.coffee ---- */
|
/* ---- RateLimit.coffee ---- */
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,7 +463,6 @@
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
|
||||||
/* ---- Scrollable.js ---- */
|
/* ---- Scrollable.js ---- */
|
||||||
|
|
||||||
|
|
||||||
|
@ -983,6 +979,35 @@ window.initScrollable = function () {
|
||||||
})(this));
|
})(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Sidebar.prototype.handleSiteDeleteClick = function() {
|
||||||
|
var options, question;
|
||||||
|
if (this.wrapper.site_info.privatekey) {
|
||||||
|
question = "Are you sure?<br>This site has a saved private key";
|
||||||
|
options = ["Forget private key and delete site"];
|
||||||
|
} else {
|
||||||
|
question = "Are you sure?";
|
||||||
|
options = ["Delete this site", "Blacklist"];
|
||||||
|
}
|
||||||
|
return this.wrapper.displayConfirm(question, options, (function(_this) {
|
||||||
|
return function(confirmed) {
|
||||||
|
if (confirmed === 1) {
|
||||||
|
_this.tag.find("#button-delete").addClass("loading");
|
||||||
|
return _this.wrapper.ws.cmd("siteDelete", _this.wrapper.site_info.address, function() {
|
||||||
|
return document.location = $(".fixbutton-bg").attr("href");
|
||||||
|
});
|
||||||
|
} else if (confirmed === 2) {
|
||||||
|
return _this.wrapper.displayPrompt("Blacklist this site", "text", "Delete and Blacklist", "Reason", function(reason) {
|
||||||
|
_this.tag.find("#button-delete").addClass("loading");
|
||||||
|
_this.wrapper.ws.cmd("siteblockAdd", [_this.wrapper.site_info.address, reason]);
|
||||||
|
return _this.wrapper.ws.cmd("siteDelete", _this.wrapper.site_info.address, function() {
|
||||||
|
return document.location = $(".fixbutton-bg").attr("href");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})(this));
|
||||||
|
};
|
||||||
|
|
||||||
Sidebar.prototype.onOpened = function() {
|
Sidebar.prototype.onOpened = function() {
|
||||||
var menu;
|
var menu;
|
||||||
this.log("Opened");
|
this.log("Opened");
|
||||||
|
@ -1073,22 +1098,7 @@ window.initScrollable = function () {
|
||||||
})(this));
|
})(this));
|
||||||
this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) {
|
this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
_this.wrapper.displayConfirm("Are you sure?", ["Delete this site", "Blacklist"], function(confirmed) {
|
_this.handleSiteDeleteClick();
|
||||||
if (confirmed === 1) {
|
|
||||||
_this.tag.find("#button-delete").addClass("loading");
|
|
||||||
return _this.wrapper.ws.cmd("siteDelete", _this.wrapper.site_info.address, function() {
|
|
||||||
return document.location = $(".fixbutton-bg").attr("href");
|
|
||||||
});
|
|
||||||
} else if (confirmed === 2) {
|
|
||||||
return _this.wrapper.displayPrompt("Blacklist this site", "text", "Delete and Blacklist", "Reason", function(reason) {
|
|
||||||
_this.tag.find("#button-delete").addClass("loading");
|
|
||||||
_this.wrapper.ws.cmd("siteblockAdd", [_this.wrapper.site_info.address, reason]);
|
|
||||||
return _this.wrapper.ws.cmd("siteDelete", _this.wrapper.site_info.address, function() {
|
|
||||||
return document.location = $(".fixbutton-bg").attr("href");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
|
|
Loading…
Reference in a new issue