Skip to content

Commit 67e84ec

Browse files
authored
Merge pull request #1111 from thecourseforum/dev
Moderation
2 parents 7a4c1b6 + 23c7034 commit 67e84ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1013
-534
lines changed

.github/workflows/aws.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ jobs:
106106
- name: Deploy Amazon ECS task definition
107107
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
108108
with:
109-
task-definition: ${{ steps.task-def.outputs.task-definition }}
110-
service: ${{ env.ECS_SERVICE }}
111-
cluster: ${{ env.ECS_CLUSTER }}
112-
wait-for-service-stability: true
109+
task-definition: ${{ steps.task-def.outputs.task-definition }}
110+
service: ${{ env.ECS_SERVICE }}
111+
cluster: ${{ env.ECS_CLUSTER }}
112+
wait-for-service-stability: true
113113

114114
- name: Force new deployment
115115
run: |

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11.0
1+
3.11

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
[tool.black]
2-
line-length = 100
3-
[tool.isort]
4-
profile = "black"
5-
[tool.djlint]
6-
profile = "django"
1+
[project]
2+
name = "thecourseforum2"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
"astroid>=3.3.9",
9+
"black>=25.1.0",
10+
"dill>=0.3.9",
11+
"pylint>=3.3.6",
12+
]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ backoff~=2.2.1
44
black~=24.1.1
55
boto3~=1.37.4
66
coverage~=7.3.3
7+
detoxify~=0.5.2
78
django-cachalot~=2.6.1
89
django-environ~=0.11.2
910
django-filter~=23.5

tcf_core/auth_pipeline.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ def create_user(strategy, details, backend, user=None, *args, **kwargs):
141141
return {"is_new": True, "user": strategy.create_user(**fields)}
142142

143143

144-
def check_user_password(strategy, backend, user, is_new=False, password="", *args, **kwargs):
144+
def check_user_password(
145+
strategy, backend, user, is_new=False, password="", *args, **kwargs
146+
):
145147
"""
146148
Saves password to user object if a new user (registering).
147149
Otherwise, validates given password is correct.
@@ -162,7 +164,9 @@ def validate_email(strategy, backend, code, partial_token):
162164
"""
163165
if not code.verified:
164166
url = (
165-
strategy.build_absolute_uri(reverse("social:complete", args=(backend.name,)))
167+
strategy.build_absolute_uri(
168+
reverse("social:complete", args=(backend.name,))
169+
)
166170
+ "?verification_code="
167171
+ code.code
168172
+ "&partial_token="

tcf_core/settings/base.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@
5555
STATIC_URL = "/static/"
5656
STATIC_ROOT = os.path.join(BASE_DIR, "static")
5757

58-
ALLOWED_HOSTS.extend([
59-
"localhost",
60-
".grok.io",
61-
"127.0.0.1"
62-
])
58+
ALLOWED_HOSTS.extend(["localhost", ".grok.io", "127.0.0.1"])
6359

6460
DATABASES = {
6561
"default": {
@@ -80,11 +76,13 @@
8076
AWS_DEFAULT_ACL = None
8177
AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"}
8278

83-
ALLOWED_HOSTS.extend([
84-
"tcf-load-balancer-1374896025.us-east-1.elb.amazonaws.com",
85-
"thecourseforum.com",
86-
"thecourseforumtest.com"
87-
])
79+
ALLOWED_HOSTS.extend(
80+
[
81+
"tcf-load-balancer-1374896025.us-east-1.elb.amazonaws.com",
82+
"thecourseforum.com",
83+
"thecourseforumtest.com",
84+
]
85+
)
8886

8987
STORAGES = {
9088
"default": {
@@ -198,7 +196,9 @@
198196

199197
WHITELISTED_DOMAINS = ["virginia.edu"]
200198

201-
SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_URL = reverse_lazy("social:begin", args=["google-oauth2"])
199+
SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_URL = reverse_lazy(
200+
"social:begin", args=["google-oauth2"]
201+
)
202202
SOCIAL_AUTH_RAISE_EXCEPTIONS = False
203203
SOCIAL_AUTH_PIPELINE = (
204204
"tcf_core.auth_pipeline.password_validation",
@@ -271,3 +271,6 @@
271271

272272
# Required in Django 3.2+ (See https://stackoverflow.com/a/66971803)
273273
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
274+
275+
# Toxicity threshold for filtering reviews
276+
TOXICITY_THRESHOLD = 74

tcf_core/settings/prod.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
ALLOWED_HOSTS = ["*", "thecourseforum.com"]
1717

1818
# CSRF settings to fix form submission issues in production
19-
CSRF_TRUSTED_ORIGINS = ['https://thecourseforum.com', 'https://thecourseforumtest.com']
20-
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
19+
CSRF_TRUSTED_ORIGINS = [
20+
"https://thecourseforum.com",
21+
"https://thecourseforumtest.com",
22+
]
23+
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
2124

2225
# Use secure connection for database access
2326
DATABASES["default"]["OPTIONS"] = {"sslmode": "require"}

tcf_core/settings/record_middleware.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ def __call__(self, request):
2323
previous_paths_titles = []
2424

2525
response = self.get_response(request)
26-
if check_path(request.path) and request.session.get("instructor_fullname") is not None:
26+
if (
27+
check_path(request.path)
28+
and request.session.get("instructor_fullname") is not None
29+
):
2730
previous_paths.insert(0, request.build_absolute_uri())
2831
previous_paths = list(dict.fromkeys(previous_paths))
2932

tcf_website/admin.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ def get_queryset(self, request):
6767

6868
class SectionTimeAdmin(admin.ModelAdmin):
6969
list_display = ["section", "get_days_display", "start_time", "end_time"]
70-
list_filter = ["monday", "tuesday", "wednesday", "thursday", "friday", "start_time", "end_time"]
70+
list_filter = [
71+
"monday",
72+
"tuesday",
73+
"wednesday",
74+
"thursday",
75+
"friday",
76+
"start_time",
77+
"end_time",
78+
]
7179
search_fields = [
7280
"section__course__subdepartment__mnemonic",
7381
"section__course__number",

0 commit comments

Comments
 (0)