Improve chat replies, hubs API & UI

Backend: enrich message reply data (include created_at and media_files) and ensure chat owners are treated as members; tighten/extend permission checks and message query filters; fix hub routers so moderators/tags routes are resolved before hub detail; accept hub id from request.data in hub permission/tag views; add PostHub serializer and expose hub_detail on posts.

Frontend: update generated API models (postHub, replyTo, members_detail, hub_detail); add hub-related pages/routes and components (HubCard, HubHeader, Tags) and a hub posts feed hook; rework message UI and composer to show richer reply previews (media thumbnails, timestamps), adjust video preload to metadata; add tag selection UI to PostComposer and wire hub tags fetching.

Also: minor UI/UX improvements and generated model exports updated to match backend changes.
This commit is contained in:
2026-06-07 00:24:21 +02:00
parent 6422fefe46
commit cb23abeb5f
43 changed files with 1522 additions and 321 deletions

View File

@@ -2,6 +2,7 @@ from django.contrib.auth import get_user_model
from rest_framework import serializers
from .models import Post, PostContent, PostVote, PostSave
from social.hubs.serializers import TagsSerializer
from social.hubs.models import Hub
User = get_user_model()
@@ -21,10 +22,17 @@ class PostContentSerializer(serializers.ModelSerializer):
read_only_fields = ['mime_type']
class PostHubSerializer(serializers.ModelSerializer):
class Meta:
model = Hub
fields = ['id', 'name', 'icon']
class PostSerializer(serializers.ModelSerializer):
contents = PostContentSerializer(many=True, read_only=True)
tags = TagsSerializer(many=True, read_only=True)
author_detail = AuthorMinimalSerializer(source='author', read_only=True)
hub_detail = PostHubSerializer(source='hub', read_only=True)
vote_score = serializers.SerializerMethodField()
user_vote = serializers.SerializerMethodField()
reply_count = serializers.IntegerField(read_only=True, default=0)
@@ -36,7 +44,7 @@ class PostSerializer(serializers.ModelSerializer):
fields = [
'id', 'content', 'created_at', 'updated_at',
'author', 'author_detail',
'hub', 'reply_to',
'hub', 'hub_detail', 'reply_to',
'tags', 'contents',
'vote_score', 'user_vote', 'reply_count', 'is_saved', 'save_count',
]