Skip to content

Commit

Permalink
Auto-approve authors if configured
Browse files Browse the repository at this point in the history
  • Loading branch information
charl botha committed Nov 10, 2019
1 parent c5cd128 commit 44d9aa0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions isso/views/comments.py
Expand Up @@ -132,6 +132,8 @@ def __init__(self, isso, hasher):

self.conf = isso.conf.section("general")
self.moderated = isso.conf.getboolean("moderation", "enabled")
# this is similar to the wordpress setting "Comment author must have a previously approved comment"
self.activate_if_email_previously_approved = isso.conf.getboolean("moderation", "activate-if-email-previously-approved")

self.guard = isso.db.guard
self.threads = isso.db.threads
Expand Down Expand Up @@ -294,6 +296,12 @@ def new(self, environ, request, uri):
raise Forbidden(reason)

with self.isso.lock:
# if email-based auto-moderation enabled, check for previously approved author
# right before approval.
if self.activate_if_email_previously_approved and \
self.comments.is_previously_approved_author(data['email']):
data['mode'] = 1

rv = self.comments.add(uri, data)

# notify extension, that the new comment has been successfully saved
Expand Down

0 comments on commit 44d9aa0

Please sign in to comment.