Skip to content

Commit 492316f

Browse files
authored
Merge pull request #2060 from codalab/email_updates
Email - Added CONTACT_EMAIL
2 parents 2511954 + a1699fa commit 492316f

File tree

6 files changed

+9
-4
lines changed

6 files changed

+9
-4
lines changed

.env_sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ SELENIUM_HOSTNAME=selenium
4545
#DEFAULT_FROM_EMAIL="Codabench <[email protected]>"
4646
4747

48+
# Contact Email
49+
4850

4951
# -----------------------------------------------------------------------------
5052
# Storage

src/apps/api/views/competitions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,12 +739,12 @@ def rerun_submissions(self, request, pk):
739739
# Codabemch public queue
740740
if comp.queue is None:
741741
can_re_run_submissions = False
742-
error_message = f"You cannot rerun more than {settings.RERUN_SUBMISSION_LIMIT} submissions on Codabench public queue! Contact us on `[email protected]` to request a rerun."
742+
error_message = f"You cannot rerun more than {settings.RERUN_SUBMISSION_LIMIT} submissions on Codabench public queue! Contact us on `{settings.CONTACT_EMAIL}` to request a rerun."
743743

744744
# Other queue where user is not owner and not organizer
745745
elif request.user != comp.queue.owner and request.user not in comp.queue.organizers.all():
746746
can_re_run_submissions = False
747-
error_message = f"You cannot rerun more than {settings.RERUN_SUBMISSION_LIMIT} submissions on a queue which is not yours! Contact us on `[email protected]` to request a rerun."
747+
error_message = f"You cannot rerun more than {settings.RERUN_SUBMISSION_LIMIT} submissions on a queue which is not yours! Contact us on `{settings.CONTACT_EMAIL}` to request a rerun."
748748

749749
# User can rerun submissions where he is owner or organizer
750750
else:

src/apps/pages/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from competitions.models import Submission
66
from announcements.models import Announcement, NewsPost
77

8+
from django.conf import settings
89
from django.shortcuts import render
910
from utils.data import pretty_bytes
1011

@@ -20,6 +21,7 @@ def get_context_data(self, *args, **kwargs):
2021

2122
news_posts = NewsPost.objects.all().order_by('-id')
2223
context['news_posts'] = news_posts
24+
context['CONTACT_EMAIL'] = settings.CONTACT_EMAIL
2325

2426
return context
2527

src/apps/profiles/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ class CustomPasswordResetView(auth_views.PasswordResetView):
347347
We have to use app:view_name syntax in templates like " {% url 'accounts:password_reset_confirm'%} "
348348
Therefore we need to tell this view to find the right success_url with that syntax or django won't be
349349
able to find the view.
350-
3. from_email: We want to set the from_email to [email protected] - may eventually put in .env file.
350+
3. from_email: We want to use SERVER_EMAIL already set in the .env
351351
# The other commented sections are the defaults for other attributes in auth_views.PasswordResetView.
352352
They are in here in case someone wants to customize in the future. All attributes show up in the order
353353
shown in the docs.

src/settings/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ def setup_celery_logging(**kwargs):
452452
DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL', 'Codabench <[email protected]>')
453453
SERVER_EMAIL = os.environ.get('SERVER_EMAIL', '[email protected]')
454454

455+
CONTACT_EMAIL = os.environ.get('CONTACT_EMAIL', '[email protected]')
455456

456457
# Django-Su (User impersonation)
457458
SU_LOGIN_CALLBACK = 'profiles.admin.su_login_callback'

src/templates/pages/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h3 class="ui icon header">
8181
Contribute
8282
</h3>
8383
<div>
84-
<p>Interested in joining the development team? Join us on <a href="https://github.com/codalab/codabench">Github</a> or <a href="mailto:[email protected]">contact us</a> directly.</p>
84+
<p>Interested in joining the development team? Join us on <a href="https://github.com/codalab/codabench">Github</a> or <a href="mailto:{{CONTACT_EMAIL}}">contact us</a> directly.</p>
8585
</div>
8686
</div>
8787
</div>

0 commit comments

Comments
 (0)