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

Individual reactions #3520

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions lego/apps/meetings/serializers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from lego.apps.reactions.models import Reaction
from rest_framework import serializers
from rest_framework.fields import CharField

Expand Down Expand Up @@ -36,6 +37,16 @@ class Meta:
fields = ("status",)


class ReactionsSerializer(serializers.ModelSerializer):


Bestem0r marked this conversation as resolved.
Show resolved Hide resolved
author = PublicUserSerializer(read_only=True, source="created_by")
class Meta:
model = Reaction
fields = ("id", "emoji", "created_by", "created_at", "author")
Bestem0r marked this conversation as resolved.
Show resolved Hide resolved
read_only = True


class MeetingGroupInvite(serializers.Serializer):
group = PrimaryKeyRelatedFieldNoPKOpt(queryset=AbakusGroup.objects.all())

Expand Down Expand Up @@ -63,6 +74,7 @@ class MeetingDetailSerializer(BasisModelSerializer):
comments = CommentSerializer(read_only=True, many=True)
content_target = CharField(read_only=True)
reactions_grouped = serializers.SerializerMethodField()
reactions = ReactionsSerializer(many=True, read_only=True)

def get_reactions_grouped(self, obj):
user = self.context["request"].user
Expand All @@ -85,6 +97,7 @@ class Meta:
"content_target",
"mazemap_poi",
"reactions_grouped",
"reactions",
)
read_only = True

Expand Down