diff --git a/dmoj/settings.py b/dmoj/settings.py index 5c1b97bda..9c8893417 100644 --- a/dmoj/settings.py +++ b/dmoj/settings.py @@ -129,6 +129,9 @@ DMOJ_THEME_DEFAULT_ACE_THEME = { } DMOJ_SELECT2_THEME = 'dmoj' +DMOJ_ENABLE_COMMENTS = True +DMOJ_ENABLE_SOCIAL = True + MARKDOWN_STYLES = {} MARKDOWN_DEFAULT_STYLE = {} diff --git a/judge/views/blog.py b/judge/views/blog.py index d71d43555..df09839b9 100644 --- a/judge/views/blog.py +++ b/judge/views/blog.py @@ -107,6 +107,8 @@ class PostView(TitleMixin, CommentedDetailView): self.object.summary or self.object.content, 'blog') context['meta_description'] = metadata[0] context['og_image'] = self.object.og_image or metadata[1] + context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS + context['enable_social'] = settings.DMOJ_ENABLE_SOCIAL return context diff --git a/judge/views/contests.py b/judge/views/contests.py index 880e128f7..25d357562 100644 --- a/judge/views/contests.py +++ b/judge/views/contests.py @@ -293,6 +293,8 @@ class ContestDetail(ContestMixin, TitleMixin, CommentedDetailView): problem_count=Count('id'), ), ) + context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS + context['enable_social'] = settings.DMOJ_ENABLE_SOCIAL return context diff --git a/judge/views/problem.py b/judge/views/problem.py index 3fb2365f4..20be48b6d 100644 --- a/judge/views/problem.py +++ b/judge/views/problem.py @@ -127,6 +127,7 @@ class ProblemSolution(SolvedProblemMixin, ProblemMixin, TitleMixin, CommentedDet raise Http404() context['solution'] = solution context['has_solved_problem'] = self.object.id in self.get_completed_problems() + context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS return context def get_comment_page(self): @@ -201,6 +202,7 @@ class ProblemDetail(ProblemMixin, SolvedProblemMixin, CommentedDetailView): context['description'], 'problem') context['meta_description'] = self.object.summary or metadata[0] context['og_image'] = self.object.og_image or metadata[1] + context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS context['vote_perm'] = self.object.vote_permission_for_user(user) if context['vote_perm'].can_vote(): diff --git a/resources/libs b/resources/libs index 399f213b1..2681309a5 160000 --- a/resources/libs +++ b/resources/libs @@ -1 +1 @@ -Subproject commit 399f213b192a267dd6783c0ba257392081dd37e9 +Subproject commit 2681309a5ddd3482e699761488c75d9a62a626ec diff --git a/templates/blog/content.html b/templates/blog/content.html index 062e19e7c..6c5a77672 100644 --- a/templates/blog/content.html +++ b/templates/blog/content.html @@ -35,12 +35,18 @@ {% endcache %} -