Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #572 from SELab-2/develop
Browse files Browse the repository at this point in the history
latest changes to main
  • Loading branch information
sevrijss authored May 21, 2023
2 parents 576987f + dfc36e3 commit 76c11b8
Show file tree
Hide file tree
Showing 19 changed files with 214 additions and 9,038 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/django-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- name: Make and compile messages
run: |
cd backend
django-admin makemessages --all --ignore=env
django-admin compilemessages --ignore=env
django-admin makemessages --all
django-admin compilemessages
- name: Commit translation changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
6 changes: 3 additions & 3 deletions backend/authentication/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def validate(self, data):
raise auth_serializers.ValidationError(
{
"email": _(
f"{data['email']} has no entry in the lobby, you must contact an admin to gain access to the platform"
),
"{data} has no entry in the lobby, you must contact an admin to gain access to the platform"
).format(email=data["email"])
}
)
# check if the verification code is valid
if lobby_instance.verification_code != data["verification_code"]:
raise auth_serializers.ValidationError({"verification_code": _(f"invalid verification code")})
raise auth_serializers.ValidationError({"verification_code": _("invalid verification code")})
# add role to the validated data
data["role"] = lobby_instance.role_id
# check if passwords match
Expand Down
5 changes: 0 additions & 5 deletions backend/config/secrets.py

This file was deleted.

6 changes: 3 additions & 3 deletions backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
SPECTACULAR_SETTINGS = {
"TITLE": "Dr-Trottoir API",
"DESCRIPTION": "This is the documentation for the Dr-Trottoir API. You can access this API directly by using port "
"2002.",
"2002.",
"VERSION": "1.0.0",
"SERVE_INCLUDE_SCHEMA": False,
# OTHER SETTINGS
Expand Down Expand Up @@ -139,13 +139,13 @@
"config.middleware.CommonMiddlewareAppendSlashWithoutRedirect",
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"language.DefaultLanguageMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
# "django.middleware.clickjacking.XFrameOptionsMiddleware",
"csp.middleware.CSPMiddleware",
"django.middleware.locale.LocaleMiddleware",
]

LOCALE_PATHS = [
Expand Down
7 changes: 4 additions & 3 deletions backend/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-19 22:50+0000\n"
"POT-Creation-Date: 2023-05-20 13:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -23,9 +23,10 @@ msgid "a user is already registered with this e-mail address"
msgstr ""

#: authentication/serializers.py:51
#, python-brace-format
msgid ""
"{data['email']} has no entry in the lobby, you must contact an admin to gain "
"access to the platform"
"{data} has no entry in the lobby, you must contact an admin to gain access "
"to the platform"
msgstr ""

#: authentication/serializers.py:57
Expand Down
Binary file modified backend/locale/nl/LC_MESSAGES/django.mo
Binary file not shown.
133 changes: 6 additions & 127 deletions backend/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-19 22:50+0000\n"
"POT-Creation-Date: 2023-05-20 13:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -23,12 +23,13 @@ msgid "a user is already registered with this e-mail address"
msgstr "een gebruiker is al geregistreerd met dit e-mailadres"

#: authentication/serializers.py:51
#, python-brace-format
msgid ""
"{data['email']} has no entry in the lobby, you must contact an admin to gain "
"access to the platform"
"{data} has no entry in the lobby, you must contact an admin to gain access "
"to the platform"
msgstr ""
"{data['email']} zit niet in de lobby, u moet contact opnemen met een "
"beheerder om toegang te krijgen tot het platform"
"{data} zit niet in de lobby, u moet contact opnemen met een beheerder om "
"toegang te krijgen tot het platform"

#: authentication/serializers.py:57
msgid "invalid verification code"
Expand Down Expand Up @@ -406,125 +407,3 @@ msgid ""
msgstr ""
"de startdatum van de periode waarnaar je wilt kopiëren moet, op zijn minst, "
"in de week direct volgend na de einddatum van de originele periode liggen"

#~ msgid "Enter a valid value."
#~ msgstr "Vul een geldige waarde in"

#~ msgid "Enter a valid URL."
#~ msgstr "Vul een geldige URL in"

#~ msgid "Enter a valid integer."
#~ msgstr "Vul een geldig getal in"

#~ msgid "Enter a valid email address."
#~ msgstr "Vul een geldig e-mailadres in"

#, fuzzy
#~| msgid "Enter a valid email address."
#~ msgid "Enter a valid IPv4 address."
#~ msgstr "Vul een geldig e-mailadres in"

#, fuzzy
#~| msgid "Enter a valid email address."
#~ msgid "Enter a valid IPv6 address."
#~ msgstr "Vul een geldig e-mailadres in"

#, fuzzy
#~| msgid "Enter a valid email address."
#~ msgid "Enter a valid IPv4 or IPv6 address."
#~ msgstr "Vul een geldig e-mailadres in"

#~ msgid "Enter a number."
#~ msgstr "Vul een nummer in"

#, fuzzy, python-format
#~| msgid "A building with this address already exists."
#~ msgid "%(model_name)s with this %(field_labels)s already exists."
#~ msgstr "Er bestaat al een gebouw met dit adres."

#~ msgid "This field cannot be null."
#~ msgstr "Dit veld mag niet null zijn"

#~ msgid "This field cannot be blank."
#~ msgstr "dit veld mag niet leeg zijn"

#, fuzzy, python-format
#~| msgid "The name for this template already exists."
#~ msgid "%(model_name)s with this %(field_label)s already exists."
#~ msgstr "De naam van deze template bestaat al."

#, fuzzy
#~| msgid "Enter a number."
#~ msgid "Decimal number"
#~ msgstr "Vul een nummer in"

#, fuzzy
#~| msgid "Enter a valid email address."
#~ msgid "Email address"
#~ msgstr "Vul een geldig e-mailadres in"

#, fuzzy
#~| msgid "Email is required"
#~ msgid "This field is required."
#~ msgstr "E-mail is vereist"

#, fuzzy
#~| msgid "Enter a number."
#~ msgid "Enter a whole number."
#~ msgstr "Vul een nummer in"

#, fuzzy
#~| msgid "Enter a valid value."
#~ msgid "Enter a valid date."
#~ msgstr "Vul een geldige waarde in"

#, fuzzy
#~| msgid "Enter a valid integer."
#~ msgid "Enter a valid time."
#~ msgstr "Vul een geldig getal in"

#, fuzzy
#~| msgid "Enter a valid integer."
#~ msgid "Enter a valid date/time."
#~ msgstr "Vul een geldig getal in"

#, fuzzy
#~| msgid "Enter a valid integer."
#~ msgid "Enter a valid duration."
#~ msgstr "Vul een geldig getal in"

#, fuzzy
#~| msgid "Enter a valid value."
#~ msgid "Enter a list of values."
#~ msgstr "Vul een geldige waarde in"

#, fuzzy
#~| msgid "Enter a valid value."
#~ msgid "Enter a complete value."
#~ msgstr "Vul een geldige waarde in"

#, fuzzy
#~| msgid "Enter a valid URL."
#~ msgid "Enter a valid UUID."
#~ msgstr "Vul een geldige URL in"

#, fuzzy
#~| msgid "Enter a valid URL."
#~ msgid "Enter a valid JSON."
#~ msgstr "Vul een geldige URL in"

#, fuzzy, python-format
#~| msgid "Enter a valid value."
#~ msgid "“%(pk)s” is not a valid value."
#~ msgstr "Vul een geldige waarde in"

#, fuzzy
#~| msgid "Enter a valid email address."
#~ msgid "This is not a valid IPv6 address."
#~ msgstr "Vul een geldig e-mailadres in"

#~ msgid "No bus"
#~ msgstr "Geen bus"

#~ msgid "successfully copied the garbage collections"
#~ msgstr "de vuilnisophalingen zijn succesvol gekopieerd"
1 change: 1 addition & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dj-rest-auth==3.0.0
django-allauth==0.54.0
django-cors-headers==4.0.0
django-csp==3.7
django-default-language==0.0.1
django-nose==1.4.7
django-phonenumber-field==7.1.0
django-random-id-model==0.1.1
Expand Down
4 changes: 2 additions & 2 deletions backend/util/request_response_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def get_id_param(request, name, required=False):
param = request.GET.get(name, None)
if param:
if not param.isdigit():
raise BadRequest(_(f"The query parameter {name} should be an integer"))
raise BadRequest(_("The query parameter {name} should be an integer").format(name=name))
else:
if required:
raise BadRequest(_(f"The query parameter {name} is required"))
raise BadRequest(_("The query parameter {name} is required").format(name=name))
return param


Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ services:
context: ./frontend
dockerfile: Dockerfile
environment:
WATCHPACK_POLLING: true
WATCHPACK_POLLING: "true"
command: sh -c 'if [ "${ENVIRONMENT}" = "production" ]; then npm start; else npm run dev; fi'
expose:
- 3000
Expand Down
10 changes: 5 additions & 5 deletions frontend/__tests__/logout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ describe("Logout", () => {

it("renders without crashing", () => {
render(<Logout />);
expect(screen.getByText("Log out")).toBeInTheDocument();
expect(screen.getByText("Log uit")).toBeInTheDocument();
});

it("opens modal on logout click", () => {
render(<Logout />);
fireEvent.click(screen.getByText("Log out"));
expect(screen.getByText("Are you sure you want to log out?")).toBeInTheDocument();
fireEvent.click(screen.getByText("Log uit"));
expect(screen.getByText("Zeker dat je wil uitloggen?")).toBeInTheDocument();
});

it("calls logout and router push on modal logout click", async () => {
Expand All @@ -37,8 +37,8 @@ describe("Logout", () => {
push: pushMock,
});
render(<Logout />);
fireEvent.click(screen.getByText("Log out")); // open the modal
fireEvent.click(screen.getByText("Log out", { selector: "button" })); // click on the logout button in the modal
fireEvent.click(screen.getByText("Log uit")); // open the modal
fireEvent.click(screen.getByText("Log uit", { selector: "button" })); // click on the logout button in the modal
expect(logout).toHaveBeenCalled();

// Use waitFor for asynchronous assertions
Expand Down
5 changes: 4 additions & 1 deletion frontend/__tests__/student/fileList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ describe("FileList", () => {
const file = new File(["hello"], "hello.png", { type: "image/png" });
render(<FileList files={files} setFiles={mockSetFiles} optional={false} editable={true} />);

const input = screen.getByTestId("upload-label");
const uploadButton = screen.getByText("Upload foto's");
fireEvent.click(uploadButton);

const input = screen.getByTestId("photos");
await userEvent.upload(input, file);

await waitFor(() => expect(mockSetFiles).toHaveBeenCalled());
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/admin/editEmailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export default function ({
</div>
<div className="form-outline mb-4">
<label className="form-label">Template: </label>
<br/>
<label className="form-label small">{`*mogelijke variabelen in de template zijn {{name}} en {{address}}`}</label>
<br />
<label className="form-label small">{`*mogelijke variabelen in de template zijn {{name}}`}</label>
<textarea
rows={12}
className={`form-control form-control-lg`}
Expand Down
16 changes: 10 additions & 6 deletions frontend/components/footer/syndicFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import React from "react";

const SyndicFooter = () => {
return (
<footer className="navbar navbar-expand-sm navbar-dark bg-dark"
style={{position: "relative", bottom: "0", width: "100%"}}>
<div className="container-fluid"
style={{color: 'yellow', display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
<footer
className="navbar navbar-expand-sm navbar-dark bg-dark"
style={{ position: "relative", bottom: "0", width: "100%" }}
>
<div
className="container-fluid"
style={{ color: "yellow", display: "flex", alignItems: "center", justifyContent: "center" }}
>
<label>
Vragen? Contacteer:
<a style={{color: "yellow", textDecoration: "underline"}} href="mailto:[email protected]">
Vragen? Contacteer:&nbsp;
<a style={{ color: "yellow", textDecoration: "underline" }} href="mailto:[email protected]">
[email protected]
</a>
</label>
Expand Down
1 change: 1 addition & 0 deletions frontend/components/student/fileList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function FileList({
onChange={handleFileAdd}
accept="image/*"
className="custom-file-input"
data-testid="photos"
/>
</div>
)}
Expand Down
Loading

0 comments on commit 76c11b8

Please sign in to comment.