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"
|
||||
@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: ->
|
||||
@log "Opened"
|
||||
@scrollable()
|
||||
|
@ -417,19 +436,7 @@ class Sidebar extends Class
|
|||
|
||||
# Delete site
|
||||
@tag.find("#button-delete").off("click touchend").on "click touchend", =>
|
||||
@wrapper.displayConfirm "Are you sure?", ["Delete this site", "Blacklist"], (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")
|
||||
|
||||
|
||||
@handleSiteDeleteClick()
|
||||
return false
|
||||
|
||||
# Owned checkbox
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
|
||||
}).call(this);
|
||||
|
||||
|
||||
/* ---- Console.coffee ---- */
|
||||
|
||||
|
||||
|
@ -354,7 +353,6 @@
|
|||
|
||||
}).call(this);
|
||||
|
||||
|
||||
/* ---- Menu.coffee ---- */
|
||||
|
||||
|
||||
|
@ -437,7 +435,6 @@
|
|||
|
||||
}).call(this);
|
||||
|
||||
|
||||
/* ---- RateLimit.coffee ---- */
|
||||
|
||||
|
||||
|
@ -466,7 +463,6 @@
|
|||
|
||||
}).call(this);
|
||||
|
||||
|
||||
/* ---- Scrollable.js ---- */
|
||||
|
||||
|
||||
|
@ -983,6 +979,35 @@ window.initScrollable = function () {
|
|||
})(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() {
|
||||
var menu;
|
||||
this.log("Opened");
|
||||
|
@ -1073,22 +1098,7 @@ window.initScrollable = function () {
|
|||
})(this));
|
||||
this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) {
|
||||
return function() {
|
||||
_this.wrapper.displayConfirm("Are you sure?", ["Delete this site", "Blacklist"], 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.handleSiteDeleteClick();
|
||||
return false;
|
||||
};
|
||||
})(this));
|
||||
|
|
Loading…
Reference in a new issue