import src.lib as lib from config import user_config from src.services.callback import Callback class CommentCreationCallbacks(Callback): """ Check config for blacklists, moderation behavior and notification delivery. """ def __init__(self, comment): self._comment = comment def run_callbacks(self): self._moderate() self._deliver_notification() return self._comment def _moderate(self): if user_config['Env']['moderation'] == 'strict': self._comment.approved = False return if lib.contains_forbidden_term(self._comment.content): if user_config['Env']['blacklist_match_action'] == 'reject': self._comment.approved = False