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

View File

@ -31,7 +31,8 @@ div(class='isso-comment' id='isso-#{comment.id}')
span(class='spacer') | span(class='spacer') |
a(class='downvote' href='#') a(class='downvote' href='#')
!= svg['arrow-down'] != 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='edit' href='#') #{i18n('comment-edit')}
a(class='delete' href='#') #{i18n('comment-delete')} a(class='delete' href='#') #{i18n('comment-delete')}