diff --git a/files/classes/comment.py b/files/classes/comment.py index 1aef19a69..e69c58479 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -295,6 +295,7 @@ class Comment(Base): return data def award_count(self, kind): + if not FEATURES['AWARDS']: return 0 return len([x for x in self.awards if x.kind == kind]) @property diff --git a/files/classes/submission.py b/files/classes/submission.py index ffb4513bf..657565c5c 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -336,6 +336,7 @@ class Submission(Base): return data def award_count(self, kind): + if not FEATURES['AWARDS']: return 0 return len([x for x in self.awards if x.kind == kind]) @lazy diff --git a/files/classes/user.py b/files/classes/user.py index 84c254dc8..279cf7d21 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -376,7 +376,7 @@ class User(Base): @property @lazy def received_awards(self): - + if not FEATURES['AWARDS']: return [] awards = {} posts_idlist = [x[0] for x in g.db.query(Submission.id).filter_by(author_id=self.id).all()] diff --git a/files/helpers/const.py b/files/helpers/const.py index 687870682..81f81d6ba 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -75,6 +75,10 @@ VIDEO_FORMATS = ['mp4','webm','mov','avi','mkv','flv','m4v','3gp'] AUDIO_FORMATS = ['mp3','wav','ogg','aac','m4a','flac'] NO_TITLE_EXTENSIONS = IMAGE_FORMATS + VIDEO_FORMATS + AUDIO_FORMATS +FEATURES = { + "AWARDS": False, +} + PERMS = { "DEBUG_LOGIN_TO_OTHERS": 3, } diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 6159b3943..6b67004e1 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -130,7 +130,7 @@ {{u.enemies_html | safe}} {% endif %} - {% if u.received_awards %} + {% if FEATURES['AWARDS'] and u.received_awards %}

Awards received

{% for a in u.received_awards %} @@ -379,7 +379,7 @@ {{u.enemies_html | safe}} {% endif %} - {% if u.received_awards %} + {% if FEATURES['AWARDS'] and u.received_awards %}

Awards received

{% for a in u.received_awards %}