- Backend: added width/height fields to MessageAttachment model with Pillow auto-extraction - Migration: 0021_add_image_dimensions + populate_image_dimensions management command - API: serialize width/height in messageAttachmentSerializer and consumers.py - Frontend: switched from CSS aspect-ratio to explicit pixel calculation (Telegram approach) * messageRendererV2.js: calculate exact dimensions (maxWidth=500px, proportional height) * Fixes scroll jump issue: images now reserve exact space before loading * Debug logging added to validate dimension rendering - Testing: 18/18 images populated successfully with dimensions This prevents scroll position shifts when images load after initial positioning, implementing the same approach as Telegram Web. Related: scroll positioning, image preloading, chat UX
80 lines
2.7 KiB
Python
80 lines
2.7 KiB
Python
from django.urls import include, path
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .calendar.views import CalendarEventsViewSet
|
|
from .employees.views import (DepartmentRoleViewSet, DepartmentViewSet,
|
|
EmployeeActionViewSet, EmployeeViewSet,
|
|
GroupViewSet, PositionViewSet,
|
|
RegisterAPIView, ResendEmailAPIView,
|
|
SkillViewSet, VerifyEmailAPIView)
|
|
from .feed.views import CommentViewSet, PostViewSet
|
|
from .documents.views import DocumentViewSet
|
|
from .requests_app.views import RequestViewSet
|
|
|
|
# NEW: Импорт ViewSets для Communications
|
|
from .communications.viewsets import ChatViewSet, MessageViewSet, PollViewSet
|
|
|
|
# OLD: Function-based views (постепенно удалим)
|
|
from .communications.views import get_available_reactions
|
|
|
|
app_name = "v1"
|
|
|
|
router = DefaultRouter()
|
|
|
|
router.register(r"calendar/events", CalendarEventsViewSet, basename="events")
|
|
|
|
router.register(r"documents", DocumentViewSet, basename="documents")
|
|
|
|
router.register(r"requests", RequestViewSet, basename="request")
|
|
|
|
router.register(r"departments", DepartmentViewSet, basename="departments")
|
|
router.register(r"employees", EmployeeViewSet, basename="employees")
|
|
router.register(
|
|
r"employee-actions",
|
|
EmployeeActionViewSet,
|
|
basename="employee-actions",
|
|
)
|
|
router.register(r"positions", PositionViewSet, basename="positions")
|
|
router.register(
|
|
r"department-roles",
|
|
DepartmentRoleViewSet,
|
|
basename="department-roles",
|
|
)
|
|
router.register(r"skills", SkillViewSet, basename="skills")
|
|
router.register(r"posts", PostViewSet, basename="posts")
|
|
router.register(r"comments", CommentViewSet, basename="comments")
|
|
router.register(r"groups", GroupViewSet, basename="groups")
|
|
|
|
# NEW: Communications ViewSets
|
|
router.register(r"communications/chats", ChatViewSet, basename="chats")
|
|
router.register(r"communications/messages", MessageViewSet, basename="messages")
|
|
router.register(r"communications/polls", PollViewSet, basename="polls")
|
|
|
|
|
|
urlpatterns = [
|
|
path("auth/register/", RegisterAPIView.as_view(), name="register"),
|
|
path(
|
|
"auth/resend-email/",
|
|
ResendEmailAPIView.as_view(),
|
|
name="resend-email",
|
|
),
|
|
path(
|
|
"auth/verify-email/",
|
|
VerifyEmailAPIView.as_view(),
|
|
name="verify-email",
|
|
),
|
|
|
|
# Communications: доступные реакции (для обратной совместимости)
|
|
path(
|
|
"communications/reactions/available/",
|
|
get_available_reactions,
|
|
name="available_reactions"
|
|
),
|
|
|
|
# Notifications API
|
|
path("notifications/", include("api.v1.notifications.urls")),
|
|
|
|
# Router URLs (включая все ViewSets)
|
|
path("", include(router.urls)),
|
|
]
|