Do not show 'reply' if nesting-level is 0

This commit is contained in:
Steffen Prince 2015-11-02 14:07:24 -08:00
parent 64b5b4b97b
commit f36f3eb771
2 changed files with 26 additions and 23 deletions

View File

@ -151,27 +151,29 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
text = $("#isso-" + comment.id + " > .text-wrapper > .text");
var form = null; // XXX: probably a good place for a closure
$("a.reply", footer).toggle("click",
function(toggler) {
// Check if this new reply will result in a nesting level over
// the limit, and if so, associate the reply with the parent of
// the comment being replied to.
if (config["nesting-level"] !== "inf"
&& el.get_level() >= config["nesting-level"]) {
form = footer.insertAfter(new Postbox(comment.parent));
}
else {
form = footer.insertAfter(new Postbox(comment.id));
}
form.onsuccess = function() { toggler.next(); };
$(".textarea", form).focus();
$("a.reply", footer).textContent = i18n.translate("comment-close");
},
function() {
form.remove();
$("a.reply", footer).textContent = i18n.translate("comment-reply");
}
);
if (config["nesting-level"] >= 1) {
$("a.reply", footer).toggle("click",
function(toggler) {
// Check if this new reply will result in a nesting level over
// the limit, and if so, associate the reply with the parent of
// the comment being replied to.
if (config["nesting-level"] !== "inf"
&& el.get_level() >= config["nesting-level"]) {
form = footer.insertAfter(new Postbox(comment.parent));
}
else {
form = footer.insertAfter(new Postbox(comment.id));
}
form.onsuccess = function() { toggler.next(); };
$(".textarea", form).focus();
$("a.reply", footer).textContent = i18n.translate("comment-close");
},
function() {
form.remove();
$("a.reply", footer).textContent = i18n.translate("comment-reply");
}
);
};
if (config.vote) {
// update vote counter, but hide if votes sum to 0
@ -314,7 +316,7 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
}
};
if (! config["reply-to-self"] && utils.cookie("isso-" + comment.id)) {
if (config["nesting-level"] >= 1 && config["reply-to-self"] && utils.cookie("isso-" + comment.id)) {
show($("a.reply", footer).detach());
}

View File

@ -31,7 +31,8 @@ div(class='isso-comment' id='isso-#{comment.id}')
span(class='spacer') |
a(class='downvote' href='#')
!= svg['arrow-down']
a(class='reply' href='#') #{i18n('comment-reply')}
if conf["nesting-level"] >= 1
a(class='reply' href='#') #{i18n('comment-reply')}
a(class='edit' href='#') #{i18n('comment-edit')}
a(class='delete' href='#') #{i18n('comment-delete')}