diff --git a/isso/js/embed.js b/isso/js/embed.js index 680880b..73da853 100644 --- a/isso/js/embed.js +++ b/isso/js/embed.js @@ -27,14 +27,19 @@ require(["app/lib/ready", "app/config", "app/i18n", "app/api", "app/isso", "app/ return console.log("abort, #isso-thread is missing"); } - $("#isso-thread").append($.new('h4')); - $("#isso-thread").append(new isso.Postbox(null)); - $("#isso-thread").append('
'); api.fetch($("#isso-thread").getAttribute("data-isso-id"), config["max-comments-top"], config["max-comments-nested"]).then( function(rv) { + for (var setting in rv.config) { + config[setting] = rv.config[setting] + } + + $("#isso-thread").append($.new('h4')); + $("#isso-thread").append(new isso.Postbox(null)); + $("#isso-thread").append('
'); + if (rv.total_replies === 0) { $("#isso-thread > h4").textContent = i18n.translate("no-comments"); return; diff --git a/isso/views/comments.py b/isso/views/comments.py index 0272fa3..afb96ba 100644 --- a/isso/views/comments.py +++ b/isso/views/comments.py @@ -102,6 +102,11 @@ class API(object): self.conf = isso.conf.section("general") self.moderated = isso.conf.getboolean("moderation", "enabled") + # These configuration records can be read out by client + self.public_conf = {} + self.public_conf["reply-to-self"] = isso.conf.getboolean("guard", "reply-to-self") + self.public_conf["require-email"] = isso.conf.getboolean("guard", "require-email") + self.guard = isso.db.guard self.threads = isso.db.threads self.comments = isso.db.comments @@ -397,7 +402,8 @@ class API(object): 'id' : root_id, 'total_replies' : reply_counts[root_id], 'hidden_replies' : reply_counts[root_id] - len(root_list), - 'replies' : self._process_fetched_list(root_list, plain) + 'replies' : self._process_fetched_list(root_list, plain), + 'config' : self.public_conf } # We are only checking for one level deep comments if root_id is None: