diff --git a/README.md b/README.md index 05c871e..ae36af5 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,6 @@ Support plagiarism detection via [Stanford MOSS](https://theory.stanford.edu/~ai Most of the setup are the same as DMOJ installations. You can view the installation guide of DMOJ here: https://docs.dmoj.ca/#/site/installation. There is one minor change: Instead of `git clone https://github.com/DMOJ/site.git`, you clone this repo `git clone https://github.com/LQDJudge/online-judge.git`. -### Additional Steps in Production: - -1. To use newsletter (email sending), go to admin and create a newsletter. -2. Change the domain name and website name in Admin page: Navigation Bars/Sites - ### Some frequent difficulties when installation: 1. Missing the `local_settings.py`. You need to copy the `local_settings.py` in order to pass the check. @@ -100,7 +95,7 @@ Most of the steps are similar to Django tutorials. Here are two usual steps: Leaderboard with information about contest rating, performance points and real name of all users. -![](https://i.imgur.com/ampxHXM.png) +![](https://i.imgur.com/SeUiXKQ.png) ### Admin dashboard @@ -118,4 +113,4 @@ You can write the problems' statement in Markdown with LaTeX figures and formula Users can communicate with each other and can see who's online. -![](https://i.imgur.com/y9SGCgl.png) +![](https://i.imgur.com/wvOjlLx.png) diff --git a/dmoj/settings.py b/dmoj/settings.py index aa21ee7..076ab39 100644 --- a/dmoj/settings.py +++ b/dmoj/settings.py @@ -98,7 +98,6 @@ MATHOID_CACHE_URL = False TEXOID_GZIP = False TEXOID_META_CACHE = "default" TEXOID_META_CACHE_TTL = 86400 -DMOJ_NEWSLETTER_ID_ON_REGISTER = 1 BAD_MAIL_PROVIDERS = () BAD_MAIL_PROVIDER_REGEX = () @@ -244,7 +243,6 @@ INSTALLED_APPS += ( "impersonate", "django_jinja", "chat_box", - "newsletter", "django.forms", ) @@ -468,17 +466,6 @@ FILE_UPLOAD_PERMISSIONS = 0o644 MESSAGES_TO_LOAD = 15 -NEWSLETTER_CONFIRM_EMAIL = False - -# Amount of seconds to wait between each email. Here 100ms is used. -NEWSLETTER_EMAIL_DELAY = 0.1 - -# Amount of seconds to wait between each batch. Here one minute is used. -NEWSLETTER_BATCH_DELAY = 60 - -# Number of emails in one batch -NEWSLETTER_BATCH_SIZE = 100 - ML_OUTPUT_PATH = None try: diff --git a/dmoj/urls.py b/dmoj/urls.py index 6292098..aa77765 100644 --- a/dmoj/urls.py +++ b/dmoj/urls.py @@ -1146,7 +1146,5 @@ handler404 = "judge.views.error.error404" handler403 = "judge.views.error.error403" handler500 = "judge.views.error.error500" -if "newsletter" in settings.INSTALLED_APPS: - urlpatterns.append(url(r"^newsletter/", include("newsletter.urls"))) if "impersonate" in settings.INSTALLED_APPS: urlpatterns.append(url(r"^impersonate/", include("impersonate.urls"))) diff --git a/judge/forms.py b/judge/forms.py index 7ca8f29..7eef5d1 100644 --- a/judge/forms.py +++ b/judge/forms.py @@ -34,7 +34,7 @@ from judge.models import ( BlogPost, ContestProblem, ) -from judge.utils.subscription import newsletter_id + from judge.widgets import ( HeavyPreviewPageDownWidget, MathJaxPagedownWidget, @@ -65,10 +65,6 @@ class UserForm(ModelForm): class ProfileForm(ModelForm): - if newsletter_id is not None: - newsletter = forms.BooleanField( - label=_("Subscribe to contest updates"), initial=False, required=False - ) test_site = forms.BooleanField( label=_("Enable experimental features"), initial=False, required=False ) diff --git a/judge/utils/subscription.py b/judge/utils/subscription.py deleted file mode 100644 index 883d905..0000000 --- a/judge/utils/subscription.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.conf import settings - -if "newsletter" in settings.INSTALLED_APPS: - from newsletter.models import Subscription -else: - Subscription = None - -newsletter_id = ( - None if Subscription is None else settings.DMOJ_NEWSLETTER_ID_ON_REGISTER -) diff --git a/judge/views/register.py b/judge/views/register.py index b305808..76e8267 100644 --- a/judge/views/register.py +++ b/judge/views/register.py @@ -17,7 +17,6 @@ from sortedm2m.forms import SortedMultipleChoiceField from judge.models import Language, Organization, Profile, TIMEZONE from judge.utils.recaptcha import ReCaptchaField, ReCaptchaWidget -from judge.utils.subscription import Subscription, newsletter_id from judge.widgets import Select2MultipleWidget, Select2Widget valid_id = re.compile(r"^\w+$") @@ -51,11 +50,6 @@ class CustomRegistrationForm(RegistrationForm): widget=Select2MultipleWidget(attrs={"style": "width:100%"}), ) - if newsletter_id is not None: - newsletter = forms.BooleanField( - label=_("Subscribe to newsletter?"), initial=True, required=False - ) - if ReCaptchaField is not None: captcha = ReCaptchaField(widget=ReCaptchaWidget()) @@ -124,9 +118,6 @@ class RegistrationView(OldRegistrationView): profile.language = cleaned_data["language"] profile.organizations.add(*cleaned_data["organizations"]) profile.save() - - #if newsletter_id is not None and cleaned_data["newsletter"]: - # Subscription(user=user, newsletter_id=newsletter_id, subscribed=True).save() return user def get_initial(self, *args, **kwargs): diff --git a/judge/views/user.py b/judge/views/user.py index 7cb98ec..769b8f2 100644 --- a/judge/views/user.py +++ b/judge/views/user.py @@ -35,14 +35,13 @@ from django.views.generic import DetailView, ListView, TemplateView from django.template.loader import render_to_string from reversion import revisions -from judge.forms import UserForm, ProfileForm, newsletter_id +from judge.forms import UserForm, ProfileForm from judge.models import Profile, Rating, Submission, Friend from judge.performance_points import get_pp_breakdown from judge.ratings import rating_class, rating_progress from judge.tasks import import_users from judge.utils.problems import contest_completed_ids, user_completed_ids from judge.utils.ranker import ranker -from judge.utils.subscription import Subscription from judge.utils.unicode import utf8text from judge.utils.views import ( DiggPaginatorMixin, @@ -416,26 +415,6 @@ def edit_profile(request): revisions.set_user(request.user) revisions.set_comment(_("Updated on site")) - if newsletter_id is not None: - try: - subscription = Subscription.objects.get( - user=request.user, newsletter_id=newsletter_id - ) - except Subscription.DoesNotExist: - if form.cleaned_data["newsletter"]: - Subscription( - user=request.user, - newsletter_id=newsletter_id, - subscribed=True, - ).save() - else: - if subscription.subscribed != form.cleaned_data["newsletter"]: - subscription.update( - ("unsubscribe", "subscribe")[ - form.cleaned_data["newsletter"] - ] - ) - perm = Permission.objects.get( codename="test_site", content_type=ContentType.objects.get_for_model(Profile), @@ -449,15 +428,6 @@ def edit_profile(request): else: form_user = UserForm(instance=request.user) form = ProfileForm(instance=profile, user=request.user) - if newsletter_id is not None: - try: - subscription = Subscription.objects.get( - user=request.user, newsletter_id=newsletter_id - ) - except Subscription.DoesNotExist: - form.fields["newsletter"].initial = False - else: - form.fields["newsletter"].initial = subscription.subscribed form.fields["test_site"].initial = request.user.has_perm("judge.test_site") tzmap = settings.TIMEZONE_MAP diff --git a/requirements.txt b/requirements.txt index 2852a22..5000705 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,6 @@ packaging celery ansi2html @ git+https://github.com/DMOJ/ansi2html.git sqlparse -django-newsletter netaddr redis lupa diff --git a/templates/newsletter/common.html b/templates/newsletter/common.html deleted file mode 100644 index 8b97e39..0000000 --- a/templates/newsletter/common.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -
-Newsletter | -
---|
{{ newsletter.title }} | -
- Due to a technical error we were not able to submit your confirmation email. - This could be because your email address is invalid. -
- {% else %} - - {% endif %} -{% endblock %} \ No newline at end of file diff --git a/templates/newsletter/subscription_subscribe_activated.html b/templates/newsletter/subscription_subscribe_activated.html deleted file mode 100644 index 4b9f50b..0000000 --- a/templates/newsletter/subscription_subscribe_activated.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Newsletter {{ newsletter.title }} {{ action }} activate{% endblock %} -{% block body %} -Your subscription has successfully been activated.
-{% endblock %} \ No newline at end of file diff --git a/templates/newsletter/subscription_subscribe_email_sent.html b/templates/newsletter/subscription_subscribe_email_sent.html deleted file mode 100644 index 84e5ca5..0000000 --- a/templates/newsletter/subscription_subscribe_email_sent.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} -{% block title %}Newsletter subscribe{% endblock %} - -{% block body %} -Your subscription request was successfully received and an activation email has been sent to you. In that email - you will find a link which you need to follow in order to activate your subscription.
-{% endblock %} \ No newline at end of file diff --git a/templates/newsletter/subscription_subscribe_user.html b/templates/newsletter/subscription_subscribe_user.html deleted file mode 100644 index 5f13a79..0000000 --- a/templates/newsletter/subscription_subscribe_user.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Newsletter subscribe{% endblock %} - -{% block body %} -Welcome, {{ request.user }}!
- {% if messages %} -Due to a technical error we were not able to submit your confirmation email. - This could be because your email address is invalid.
- {% else %} - - {% endif %} -{% endblock %} \ No newline at end of file diff --git a/templates/newsletter/subscription_unsubscribe_activated.html b/templates/newsletter/subscription_unsubscribe_activated.html deleted file mode 100644 index baafefd..0000000 --- a/templates/newsletter/subscription_unsubscribe_activated.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "newsletter/common.html" %} - -{% block title %}{{ _('Newsletter') }} {{ newsletter.title }} {{ action }} {{ _('activate') }}{% endblock title %} - -{% block body %} -{{ _('You have successfully been unsubscribed.') }}
-{% endblock body %} diff --git a/templates/newsletter/subscription_unsubscribe_email_sent.html b/templates/newsletter/subscription_unsubscribe_email_sent.html deleted file mode 100644 index 4a1d4c8..0000000 --- a/templates/newsletter/subscription_unsubscribe_email_sent.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "newsletter/common.html" %} - -{% block title %}{{ _('Newsletter unsubscribe') }}{% endblock title %} - -{% block body %} -{{ _('Your unsubscription request has successfully been received. An email has been sent to you with a link you need to follow in order to confirm your unsubscription.') }}
-{% endblock body %} diff --git a/templates/newsletter/subscription_unsubscribe_user.html b/templates/newsletter/subscription_unsubscribe_user.html deleted file mode 100644 index ee905b7..0000000 --- a/templates/newsletter/subscription_unsubscribe_user.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "newsletter/common.html" %} - -{% block title %}{{ _('Newsletter unsubscribe') }}{% endblock title %} - -{% block body %} -Welcome, {{ request.user }}!
- - {% if messages %} -{{ _('Due to a technical error we were not able to submit your confirmation email. This could be because your email address is invalid.') }}
- {% else %} - - {% endif %} -{% endblock body %} diff --git a/templates/newsletter/subscription_update_activated.html b/templates/newsletter/subscription_update_activated.html deleted file mode 100644 index 5707711..0000000 --- a/templates/newsletter/subscription_update_activated.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "newsletter/common.html" %} - -{% block title %}{{ _('Newsletter') }} {{ newsletter.title }} {{ action }} {{ _('activate') }}{% endblock title %} - -{% block body %} -{{ _('Your subscription has successfully been updated.') }}
-{% endblock body %} diff --git a/templates/newsletter/subscription_update_email_sent.html b/templates/newsletter/subscription_update_email_sent.html deleted file mode 100644 index ea03d6b..0000000 --- a/templates/newsletter/subscription_update_email_sent.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "newsletter/common.html" %} - -{% block title %}{{ _('Newsletter update') }}{% endblock title %} - -{% block body %} -{{ _('Your update request was successfully received and an activation email has been sent to you. In that email you will find a link which you need to follow in order to update your subscription.') }}
-{% endblock body %} diff --git a/templates/user/edit-profile.html b/templates/user/edit-profile.html index a8039bd..96fe35e 100644 --- a/templates/user/edit-profile.html +++ b/templates/user/edit-profile.html @@ -127,16 +127,6 @@