summaryrefslogtreecommitdiff
path: root/src/services/callback.py
blob: 60383d649a2f0a0bef8c45e730009ab14c25d31c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from config import user_config
import src.lib as lib


class Callbacks:
    def __init__(self, object):
        self._object = object

    def run_callbacks(self):
        self._moderate()
        self._deliver_notification()

        return self._object

    def _moderate(self):
        if self._moderation_setting == 'strict':
            self._object.approved = False
            return

        if lib.contains_forbidden_term(self._object.content):
            if user_config['Env']['blacklist_match_action'] == 'reject':
                self._object.approved = False

    # TODO: Email notifications.
    def _deliver_notification(self):
        pass