Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Late December Update #935

Merged
merged 91 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
6aeef42
Feat(kontres)/add image to bookable item (#785)
eriskjel Mar 23, 2024
c9b5975
Feat(kontres)/add approved by (#786)
eriskjel Apr 6, 2024
28067fa
Create minutes for Codex (#787)
MadsNyl Apr 8, 2024
9e4ff76
Feat(minute)/viewset (#788)
MadsNyl Apr 8, 2024
0544b2f
Feat(kontres)/add notification (#790)
eriskjel Apr 10, 2024
ae483dd
Memberships with fines activated (#791)
MadsNyl Apr 12, 2024
95ef58c
fixed merge
MadsNyl Apr 13, 2024
bfa2299
Feat(user)/user bio (#758)
haruixu Apr 16, 2024
3f56496
Update CHANGELOG.md
MadsNyl Apr 16, 2024
064da8a
added filter for allowed photos for user (#794)
MadsNyl Apr 17, 2024
81a3c5e
Upped payment time when coming from waiting list (#796)
MadsNyl Apr 17, 2024
a583c45
fixed paymenttime saved to db (#798)
MadsNyl Apr 17, 2024
0f24085
fixed bug (#800)
MadsNyl Apr 17, 2024
8a3cfd4
fixed mergeconflict
MadsNyl Apr 17, 2024
e597268
Disallow users to unregister when payment is done (#802)
MadsNyl May 1, 2024
3b84765
update changelog
MadsNyl May 1, 2024
f21e0ab
Added serializer for category in event (#804)
MadsNyl May 2, 2024
e30f102
fixed merge
MadsNyl May 2, 2024
64d717c
Permission middelware (#806)
MadsNyl Jun 9, 2024
ed57afc
Permission refactor of QR Codes (#807)
MadsNyl Jun 9, 2024
ab3cf15
Permissions for payment orders (#808)
MadsNyl Jun 10, 2024
062193d
chore(iac): updated docs and force https (#810)
martcl Jul 26, 2024
23b310a
feat(iac): add terraform guardrails so index don't nuke our infra (#811)
martcl Jul 26, 2024
fa31096
Automatic registration for new users with Feide (#809)
MadsNyl Jul 30, 2024
bef294d
changelog update
MadsNyl Jul 30, 2024
4db63b5
Merge branch 'dev' of https://github.com/TIHLDE/Lepton into dev
MadsNyl Jul 30, 2024
fcce5e8
Feide env variables Terraform (#814)
MadsNyl Jul 31, 2024
514a26b
added delete endpoint for file (#815)
MadsNyl Aug 4, 2024
d3e8e9a
Update CHANGELOG.md
MadsNyl Aug 4, 2024
a02af01
merge conflict
MadsNyl Aug 4, 2024
c9bf357
format
MadsNyl Aug 4, 2024
1a7dff4
format
MadsNyl Aug 4, 2024
f086ac2
fixed permission for committee leaders for group forms
MadsNyl Aug 18, 2024
ec03558
updated csv for forms (#818)
MadsNyl Aug 18, 2024
0526f02
Permission for group forms and news (#820)
MadsNyl Aug 21, 2024
39f7cd0
merge and changelog
MadsNyl Aug 21, 2024
f40fba0
Update reservation_seralizer.py (#822)
MindChirp Aug 27, 2024
1f03c30
Group ownership of Minutes (#847)
MadsNyl Sep 14, 2024
d7e9b91
Changed endpoint response (#846)
MindChirp Sep 14, 2024
b574fdc
updated changelog.md
MadsNyl Sep 14, 2024
8b83718
Merge branch 'dev' of https://github.com/TIHLDE/Lepton into dev
MadsNyl Sep 14, 2024
bf42e7a
merge
MadsNyl Sep 14, 2024
99ba049
finished events now appear in the correct order (newest first) (#849)
EmilJohns1 Sep 17, 2024
a17c46d
Implement Swagger (#858)
MadsNyl Sep 20, 2024
496d536
Swagger GitHub Action (#860)
MadsNyl Sep 21, 2024
0c1de71
Add new app (#862)
MadsNyl Sep 23, 2024
9a19163
Upgrade all dependencies to latest (#857)
Tmpecho Sep 23, 2024
f991cec
Allow HS members to create a new group (#864)
Tmpecho Sep 23, 2024
1166728
App Script Fix (#875)
MadsNyl Sep 24, 2024
0771f2d
Event registration payment orders (#876)
MadsNyl Sep 24, 2024
5b06e4e
chore(deps): update python-dotenv requirement from ~=0.21.1 to ~=1.0.…
dependabot[bot] Sep 24, 2024
01fdcc3
Chore(deps): Bump sentry-sdk from 1.14.0 to 2.8.0 (#866)
dependabot[bot] Sep 24, 2024
192e7ee
Codex Course (#852)
MadsNyl Sep 24, 2024
26fb8d1
merge conflict and update CHANGELOG.md
MadsNyl Sep 25, 2024
7d5c0f1
fixed filtering of groups and made tests
MadsNyl Sep 25, 2024
20aabb4
merge conflict
MadsNyl Sep 25, 2024
edb007f
fixed list endpoint for cheatsheets
MadsNyl Sep 25, 2024
9236863
trigger
MadsNyl Sep 25, 2024
3b9004e
format
MadsNyl Sep 25, 2024
527d0c2
Endpoint for sending email (#883)
EmilJohns1 Sep 26, 2024
d0a0c07
chore(deps): bump black from 24.3.0 to 24.8.0 (#869)
dependabot[bot] Sep 27, 2024
81f7c7e
chore(deps): Bump azure-storage-blob from 12.13.1 to 12.23.1 (#885)
dependabot[bot] Sep 30, 2024
019d273
Added admin.py to root in new app, and added app dir to tests (#892)
MadsNyl Oct 1, 2024
14edd06
Description to forms (#894)
MadsNyl Oct 1, 2024
1a49b08
Bug report system (#865)
josefinearntsen Oct 11, 2024
1393885
Renaming of index app to feedback (#901)
MadsNyl Oct 11, 2024
c44e910
chore(deps): bump django from 4.2.16 to 5.1.1 (#889)
dependabot[bot] Oct 11, 2024
17b2483
Event registration race condition (#902)
MadsNyl Oct 11, 2024
119bbdb
upadted CHANGELOG.md
MadsNyl Oct 11, 2024
0e053d4
Feat(registration)/filter participants (#895)
yazanzarka1 Oct 28, 2024
07a2ab5
Feat(registration)/filter participants (#915)
yazanzarka1 Oct 28, 2024
ef656d3
Fix issue where full error is exposed to external users (#914)
Tmpecho Oct 28, 2024
02bb209
chore(deps): Bump sentry-sdk from 2.8.0 to 2.14.0 (#893)
dependabot[bot] Oct 28, 2024
e690181
Refactor/minor code cleanup (#884)
Tmpecho Oct 28, 2024
2bff09a
Add default detail to custom exceptions (#916)
Tmpecho Oct 28, 2024
ca5eb3a
chore(deps): bump uvicorn from 0.30.6 to 0.32.0 (#908)
dependabot[bot] Oct 29, 2024
95965cb
chore(deps): Bump pre-commit from 3.8.0 to 4.0.1 (#899)
dependabot[bot] Oct 29, 2024
b5670f0
Feat(registration)/filter participants (#917)
yazanzarka1 Oct 29, 2024
a2185c6
merge
MadsNyl Nov 4, 2024
246ad2a
Upload files (#906)
EmilJohns1 Nov 4, 2024
0a177b0
Refactor/ Fixed sorting in albums (#910)
LeMiTam Nov 11, 2024
fc4b78b
made it possible for members and leader of the organizing group to ad…
EmilJohns1 Nov 11, 2024
a9f32b4
Fix feeedback serializer on list (#927)
MadsNyl Nov 11, 2024
2940849
added description to serializer for bug and idea
MadsNyl Nov 11, 2024
94e5635
Move file upload and deletion to content from files (#928)
Tmpecho Nov 11, 2024
c8669eb
Feedback V2 (#926)
MadsNyl Nov 13, 2024
b1cc7ea
removed max limit from group description (#934)
MadsNyl Dec 26, 2024
c0cfb02
merge conflict
MadsNyl Dec 26, 2024
4fc66d7
Merge branch 'dev' of https://github.com/TIHLDE/Lepton into dev
MadsNyl Dec 26, 2024
7aa2de1
format
MadsNyl Dec 26, 2024
9620224
removed duplicat fixture
MadsNyl Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

## Neste versjon

## Versjon 2024.12.26
- ✨ **Filopplasting**. Det er nå mulig for admin brukere å laste opp- og slette filer.
- ✨ **Mail endepunkt**. Det er nå laget et endepunkt for å sende mailer.

## Versjon 2024.11.04
- 🎨**Overordnet**. Endret variabel og funksjonsnavn til å følge konvensjoner og andre små endringer.
- ✨ **Filtrering**. Admin kan nå filtere deltakere av et arrangement på studie, studieår, om deltakere har allergier, (om deltakere godtar å bli tatt bilde av, om deltakere har ankommet), i tillegg til søk på fornavn og etternavn.
Expand Down
2 changes: 2 additions & 0 deletions app/common/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ class BaseModelSerializer(serializers.ModelSerializer):
def update(self, instance, validated_data):
if hasattr(instance, "image") and "image" in validated_data:
replace_file(instance.image, validated_data.get("image", None))
if hasattr(instance, "file") and "file" in validated_data:
replace_file(instance.file, validated_data.get("file", None))
return super().update(instance, validated_data)
6 changes: 4 additions & 2 deletions app/communication/models/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ def send(self, connection):
return is_success

def __str__(self):
return (f"\"{self.subject}\", to {self.users.all()[0] if self.users.count() == 1 else f'{self.users.count()} users'}, "
f"{'sent' if self.sent else 'eta'} {self.eta}")
return (
f"\"{self.subject}\", to {self.users.all()[0] if self.users.count() == 1 else f'{self.users.count()} users'}, "
f"{'sent' if self.sent else 'eta'} {self.eta}"
)
2 changes: 2 additions & 0 deletions app/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@
SLACK_BEDPRES_OG_KURS_CHANNEL_ID = "C01DCSJ8X2Q"
SLACK_ARRANGEMENTER_CHANNEL_ID = "C01LFEFJFV3"

MAX_GALLERY_SIZE = 50

# TODO: Create api-urls as constants which then can be used in for example tests and urls.py files
5 changes: 2 additions & 3 deletions app/content/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
UserCalendarEvents,
UserViewSet,
accept_form,
delete,
register_with_feide,
send_email,
upload,
)
from app.files.views.upload import delete, upload

router = routers.DefaultRouter()

Expand Down Expand Up @@ -54,8 +53,8 @@
re_path(r"", include(router.urls)),
path("accept-form/", accept_form),
path("upload/", upload),
path("send-email/", send_email),
path("delete-file/<str:container_name>/<str:blob_name>/", delete),
path("send-email/", send_email),
path("feide/", register_with_feide),
re_path(r"users/(?P<user_id>[^/.]+)/events.ics", UserCalendarEvents()),
]
2 changes: 1 addition & 1 deletion app/content/util/event_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from app.content.exceptions import RefundFailedError
from app.payment.tasks import check_if_has_paid
from app.payment.util.payment_utils import (
check_access_token,
initiate_payment,
refund_payment,
check_access_token
)


Expand Down
1 change: 0 additions & 1 deletion app/content/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from app.content.views.news import NewsViewSet
from app.content.views.page import PageViewSet
from app.content.views.short_link import ShortLinkViewSet
from app.content.views.upload import upload, delete
from app.content.views.strike import StrikeViewSet
from app.content.views.toddel import ToddelViewSet
from app.content.views.qr_code import QRCodeViewSet
Expand Down
8 changes: 5 additions & 3 deletions app/content/views/accept_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ def accept_form(request):
if len(types) == 1 and types[0].lower() == "annonse"
else MAIL_NOK_LEADER
)
title = (f"{body['info']['bedrift']} vil ha {', '.join(types[:-1])}"
f"{' og ' if len(types) > 1 else ''}{', '.join(types[-1:])}, "
f"{', '.join(times[:-1])}{' og ' if len(times) > 1 else ''}{', '.join(times[-1:])}")
title = (
f"{body['info']['bedrift']} vil ha {', '.join(types[:-1])}"
f"{' og ' if len(types) > 1 else ''}{', '.join(types[-1:])}, "
f"{', '.join(times[:-1])}{' og ' if len(times) > 1 else ''}{', '.join(times[-1:])}"
)

is_success = send_html_email(
to_mails=[to_mail],
Expand Down
24 changes: 17 additions & 7 deletions app/content/views/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from app.common.pagination import BasePagination
from app.common.permissions import (
BasicViewPermission,
check_has_access,
is_admin_group_user,
is_admin_user,
)
Expand Down Expand Up @@ -157,20 +158,29 @@ def _admin_unregister(self, registration):
def add_registration(self, request, *_args, **_kwargs):
"""Add registration to event for admins"""

if not is_admin_group_user(request):
event_id = self.kwargs.get("event_id", None)
user_id = request.data["user"]

event = get_object_or_404(Event, id=event_id)
user = get_object_or_404(User, user_id=user_id)

organizing_group = event.organizer

is_member_or_leader_of_organizing_group = check_has_access(
[organizing_group], request
)

if (
not is_admin_group_user(request)
and not is_member_or_leader_of_organizing_group
):
return Response(
{
"detail": "Du har ikke tillatelse til å opprette en påmelding på dette arrangementet"
},
status=status.HTTP_403_FORBIDDEN,
)

event_id = self.kwargs.get("event_id", None)
user_id = request.data["user"]

event = get_object_or_404(Event, id=event_id)
user = get_object_or_404(User, user_id=user_id)

if not user.accepts_event_rules:
return Response(
{
Expand Down
4 changes: 1 addition & 3 deletions app/content/views/user_bio.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,4 @@ def update(self, request, *args, **kwargs):

def destroy(self, request, *args, **kwargs):
super().destroy(request, *args, **kwargs)
return Response(
{"detail": "Brukerbio ble slettet"}, status=status.HTTP_200_OK
)
return Response({"detail": "Brukerbio ble slettet"}, status=status.HTTP_200_OK)
2 changes: 1 addition & 1 deletion app/content/views/user_calendar_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __call__(self, request, *args, **kwargs):
return JsonResponse(
{
"detail": "Denne brukeren har skrudd av offentlig deling av påmeldinger til arrangementer. "
"Du kan derfor ikke hente ut brukerens arrangementer som .ics-fil"
"Du kan derfor ikke hente ut brukerens arrangementer som .ics-fil"
},
status=status.HTTP_403_FORBIDDEN,
)
Expand Down
4 changes: 4 additions & 0 deletions app/feedback/factories/bug_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ class Meta:

title = factory.Sequence(lambda n: f"Bug{n}")
author = factory.SubFactory(UserFactory)
description = factory.Faker("text")
url = factory.Faker("url")
platform = factory.Faker("word")
browser = factory.Faker("word")
1 change: 1 addition & 0 deletions app/feedback/factories/idea_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ class Meta:

title = factory.Sequence(lambda n: f"Idea{n}")
author = factory.SubFactory(UserFactory)
description = factory.Faker("text")
46 changes: 46 additions & 0 deletions app/feedback/filters/feedback.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from django.db.models import Q
from django_filters import rest_framework as filters
from django_filters.rest_framework import OrderingFilter

from app.feedback.models import Feedback
from app.feedback.models.bug import Bug
from app.feedback.models.idea import Idea


class FeedbackFilter(filters.FilterSet):
feedback_type = filters.CharFilter(
method="filter_feedback_type", label="List of feedback type"
)

status = filters.CharFilter(
method="filter_status",
label="List of feedback status",
)

ordering = OrderingFilter(
fields=(
"created_at",
"updated_at",
)
)

def filter_feedback_type(self, queryset, _name, feedback_type):
if feedback_type == "Idea":
return queryset.filter(Q(instance_of=Idea))
elif feedback_type == "Bug":
return queryset.filter(Q(instance_of=Bug))
else:
return queryset

def filter_status(self, queryset, _name, value):
return queryset.filter(status=value)

class Meta:
model = Feedback
fields = [
"title",
"author",
"status",
"created_at",
"updated_at",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.2.5 on 2024-10-21 18:04

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("feedback", "0001_initial"),
]

operations = [
migrations.AlterModelOptions(
name="feedback",
options={"ordering": ("-created_at",)},
),
migrations.AddField(
model_name="bug",
name="Browser",
field=models.CharField(default="", max_length=200),
),
migrations.AddField(
model_name="bug",
name="Platform",
field=models.CharField(default="", max_length=200),
),
migrations.AddField(
model_name="bug",
name="Url",
field=models.URLField(blank=True, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.5 on 2024-10-21 22:18

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("feedback", "0002_alter_feedback_options_bug_browser_bug_platform_and_more"),
]

operations = [
migrations.RenameField(
model_name="bug",
old_name="Browser",
new_name="browser",
),
migrations.RenameField(
model_name="bug",
old_name="Platform",
new_name="platform",
),
migrations.RenameField(
model_name="bug",
old_name="Url",
new_name="url",
),
]
6 changes: 5 additions & 1 deletion app/feedback/models/bug.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from django.db import models

from app.feedback.models.feedback import Feedback


class Bug(Feedback):
pass
url = models.URLField(max_length=200, blank=True, null=True)
browser = models.CharField(max_length=200, default="")
platform = models.CharField(max_length=200, default="")
2 changes: 1 addition & 1 deletion app/feedback/models/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __str__(self):
return f"{self.title} - {self.status}"

class Meta:
ordering = ("created_at",)
ordering = ("-created_at",)

@classmethod
def has_read_permission(cls, request):
Expand Down
12 changes: 10 additions & 2 deletions app/feedback/serializers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from app.feedback.serializers.bug import BugListSerializer
from app.feedback.serializers.idea import IdeaListSerializer
from app.feedback.serializers.bug import (
BugDetailSerializer,
BugCreateSerializer,
BugUpdateSerializer,
)
from app.feedback.serializers.idea import (
IdeaDetailSerializer,
IdeaCreateSerializer,
IdeaUpdateSerializer,
)
from app.feedback.serializers.feedback import FeedbackListPolymorphicSerializer
49 changes: 48 additions & 1 deletion app/feedback/serializers/bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from app.feedback.models.bug import Bug


class BugListSerializer(BaseModelSerializer):
class BugSerializer(BaseModelSerializer):
author = SimpleUserSerializer(read_only=True)

class Meta:
Expand All @@ -14,4 +14,51 @@ class Meta:
"status",
"created_at",
"author",
"description",
)


class BugCreateSerializer(BaseModelSerializer):
class Meta:
model = Bug
fields = (
"title",
"description",
)

def create(self, validated_data):
user = self.context["request"].user
validated_data["author"] = user

return super().create(validated_data)


class BugUpdateSerializer(BaseModelSerializer):
class Meta:
model = Bug
fields = (
"title",
"description",
"status",
)

def update(self, instance, validated_data):
return super().update(instance, validated_data)


class BugDetailSerializer(BaseModelSerializer):
author = SimpleUserSerializer(read_only=True)

class Meta:
model = Bug
fields = (
"id",
"title",
"description",
"status",
"created_at",
"author",
"url",
"platform",
"browser",
)
Loading
Loading