- Закомментирован RunPython для избежания pending trigger events
- Добавлена команда kill_db_connections для завершения соединений БД
- Data migration нужно выполнить отдельно после применения схемы
- Изменено событие на длительность до конца дня вместо 2 дней
- Все ДР теперь добавляются в общий календарь '🎂 Дни рождения'
- Убрана логика личных календарей для каждого сотрудника
- Добавлен DocumentMetadataEditor для редактирования метаданных
- Добавлен TagColorPicker для выбора цветов тегов
- Добавлен TagForm для создания/редактирования тегов
- Добавлен TagManagementModal для управления тегами
- Добавлена миграция 0011 для удаления FSM полей и добавления is_published
- Добавлена миграция 0012 для удаления is_published (не нужно)
- Добавлена миграция 0013 для удаления document_type
- Добавлена команда migrate_documents_storage для миграции файлов в django-filer
- Удалены ссылки на document_type из DocumentUploadForm
- Удалены фильтры по статусам из DocumentRelated
- Удалены статистика статусов из DocumentsDashboard
- Обновлены экспорты компонентов (удалены устаревшие)
- Добавлены экспорты для новых компонентов тегов
- Удален DocumentStatusBadge (больше нет статусов)
- Удален DocumentWorkflowButtons (нет FSM workflow)
- Удален DocumentVersionHistory (дубль, есть другая реализация)
- Удален AdvancedSearch (заменен на фильтры)
- Удалена папка versions/ с компонентами истории версий
- Добавлена конфигурация django-filer в settings.py
- Настроены URL для filer admin
- Обновлен admin.py для работы с FilerFileField
- Обновлен индекс поиска для новой структуры
- Удалены поля document_type, status, published_at из модели Document
- Упрощены разрешения и правила доступа
- Удалены endpoint'ы для работы со статусами
- Удалены тесты FSM workflow
- Обновлены serializers для новой структуры модели
Доработан DocumentDetailModal:
- Добавлен встроенный предпросмотр PDF и изображений
- Добавлен полноэкранный режим для предпросмотра (desktop)
- Добавлены вкладки: Предпросмотр, Информация, Активность, Ознакомления, Комментарии, Связанные
- Добавлены пропсы: onEditMetadata, onViewReport, onNavigateToRelated
- Интегрированы DocumentComments и DocumentRelated
- Улучшена шапка с полной информацией о документе на мобильных
Desktop layout:
- Split-view: предпросмотр слева (60%), вкладки справа
- Кнопка полноэкранного режима
Mobile layout:
- Вкладочная навигация
- Все метаданные видны в шапке (имя файла, размер, дата, автор)
Оптимизация page.tsx:
- Заменен встроенный модал (270 строк) на компонент DocumentDetailModal
- Удалены ненужные импорты DocumentAcknowledgement, DocumentComments, DocumentRelated
- Уменьшен размер с 1199 до 952 строк (-247 строк, -21%)
- Удалено текстовое поле для комментариев в DocumentAcknowledgement
- Удален параметр notes из acknowledgeDocument API метода
- Удалено поле notes из интерфейса DocumentAcknowledgement
- Упрощена форма подтверждения прочтения до простой кнопки
- Изменено поле document → document_id для соответствия backend
- Изменено поле parent → parent_id для соответствия backend
- Исправлена ошибка 400 при создании комментариев к документам
Added:
- is_not_document_uploader predicate
- Specific FSM action permissions (approve_document, publish_document, etc.)
- Tests for author cannot approve/publish own documents
Note: This is work in progress and will be reviewed/simplified after comparing with develop branch
- Added TestAuthorCanSubmitOwnDocument class with 3 tests
- test_author_can_submit_own_document_without_model_permission: verifies authors can submit their own documents via is_document_uploader predicate
- test_regular_user_cannot_submit_others_document: ensures users cannot submit others' documents
- test_author_can_edit_own_draft_document: confirms authors can edit their drafts
Benefits:
- Validates django-rules integration (is_document_uploader predicate)
- Ensures proper separation: authors manage own documents, not others'
- No model permissions required for basic author operations
All 91 tests passing ✅
- Modified DocumentReadOrModelPerms to allow 'create' action for all authenticated users
- Documents are created in DRAFT status by default (FSM workflow ensures control)
- Updated test_regular_user_access_according_to_policy to expect 201 instead of 403
- Added new test test_regular_user_can_create_document_in_draft
- Updated policy documentation in test file
Benefits:
- Encourages employee engagement in document management
- FSM workflow (draft → review → approve → publish) maintains quality control
- Approval/publish still requires change_document permission
- Regular users only see PUBLISHED documents (except their own)
All 88 tests passing ✅
- Added check for :memory: and test in DB name
- Prevents calendar_app → django-scheduler migration from running during tests
- Test DB name: file:memorydb_default?mode=memory&cache=shared
- Saves ~10 seconds per test run and eliminates migration output spam
Previously showed ~80 lines of migration logs on every test run.
- Changed return type from bool to Optional[Notification]
- In EAGER mode (tests), query and return created Notification
- In fallback mode, return created Notification object
- Fixes integration tests where code expected Notification object
Previously returned True/False which broke code expecting notification.id
attribute. Now properly returns the created Notification instance or None.
- Created test suite for all new ViewSets:
* DocumentTagViewSet (3 tests)
* DocumentTypeViewSet (2 tests)
* CabinetViewSet (4 tests)
* DocumentCommentViewSet (5 tests)
- Tests for related documents management (4 tests)
- Tests for django-reversion endpoints (2 tests)
- Integration test for complex document with all features
- Total: 21 test cases covering all new functionality
Tests use pytest fixtures for clean test data setup.
Tests cover CRUD operations, permissions, and edge cases.
- Added related_documents ManyToMany field to Document model
- Created DocumentComment model with threading support (parent/replies)
- Created DocumentCommentViewSet with CRUD and permission checks
- Added endpoints for related documents:
* GET /documents/{id}/related/ - list related documents
* POST /documents/{id}/add_related/ - add related document
* POST /documents/{id}/remove_related/ - remove related document
- DocumentComment features:
* Threading support via parent field
* Edit tracking (is_edited flag)
* Author-only deletion (or staff)
* Depth calculation for nested comments
- Created migration 0010 for new fields and model
- Registered DocumentCommentViewSet in router
All medium-priority features complete!
- Created DocumentTagViewSet with CRUD and document listing
- Created DocumentTypeViewSet with CRUD and filtering (active/inactive)
- Created CabinetViewSet for virtual document collections with hierarchy
- Added thumbnail endpoint to DocumentViewSet (GET /documents/{id}/thumbnail/?size=medium)
- Registered all new ViewSets in router:
* /api/v1/document-tags/
* /api/v1/document-types/
* /api/v1/cabinets/
- Thumbnail sizes: admin_thumbnail, small, medium, large
- All ViewSets support search and filtering
- Cabinet ViewSet has add_document/remove_document actions
This completes high-priority missing API endpoints for frontend.
- Added RevisionMiddleware to settings for automatic user tracking
- Created VersionSerializer and ActivityItemSerializer for version history
- Implemented GET /documents/{id}/versions/ endpoint
- Implemented GET /documents/{id}/activity/ endpoint (versions + audit + acknowledgements)
- Implemented POST /documents/{id}/revert/ endpoint for version rollback
- Activity timeline combines data from reversion, audit log, and acknowledgements
- All endpoints properly serialize user data with avatar support
This unblocks the Activity and Versions tabs in DocumentDetailModal.
PROBLEM:
- Document cards had unstructured layout with all elements mixed together
- No clear visual separation between sections
- Poor readability and cluttered appearance
- Actions scattered without logical grouping
SOLUTION:
Completely restructured document cards into 3 distinct sections:
1. HEADER (with light background and border-bottom)
- Checkbox + Title (h3 with semibold)
- Status badges (primary + acknowledgement)
- Quick action buttons (Preview/PDF + Details) on the right
- Improved: Buttons now have solid backgrounds (bg-sky-100, bg-gray-100) for better visibility
2. BODY (main content area)
- Description (only if exists, with better line-height)
- Metadata grid (3 columns on large screens):
• Folder location (sky background with FolderOpen icon)
• Author (gray background with User icon)
• Created date (gray background with Calendar icon)
- Workflow actions (only for draft/review/approved/rejected states)
- Better spacing and visual hierarchy
3. FOOTER (conditional, only when needed)
- Shows only if document has acknowledgement requirement OR is published/archived
- Acknowledgement actions (Ознакомиться + Ведомость buttons)
- Workflow for published/archived states (aligned right)
- Light background matching header
IMPROVEMENTS:
- Clear visual sections with borders and backgrounds
- Metadata in colored pill-shaped cards instead of plain text
- Icons for all metadata fields (folder, user, calendar)
- Removed redundant 'Updated' field (not essential)
- Removed empty description text ('Описание не заполнено')
- Better button hierarchy: primary actions in header, secondary in footer
- Larger, more clickable buttons (px-3 py-1.5 instead of px-2.5 py-1)
- Consistent rounded-lg instead of mix of rounded-full/rounded-lg
- Better hover states (bg-sky-200 instead of bg-sky-100)
- Conditional rendering: footer only appears when necessary
VISUAL DESIGN:
- Header: bg-gray-50/50 with border-bottom
- Body: white background, clean content area
- Footer: bg-gray-50/50 with border-top
- Metadata cards: colored backgrounds (sky-50 for folder, gray-50 for others)
- Better border colors: border-gray-200 instead of border-gray-100
This matches the structure of modern DMS systems like Notion, Confluence, and Google Drive where cards have clear header/body/footer separation.
PROBLEM:
- Upload form was minimal, not using full backend capabilities
- Missing: recipients, departments, acknowledgement requirement
- No folder indication when uploading to specific folder
SOLUTION - BACKEND:
- Added 'acknowledgement_required' field to DocumentWriteSerializer
- Now accepts: sent_to_all, department_ids, recipient_ids, acknowledgement_required
SOLUTION - FRONTEND:
Extended DocumentUploadForm with enterprise-grade features:
NEW FIELDS:
1. Sent to All Toggle
- Checkbox to send document to all employees
- When checked, hides recipients/departments selection
2. Recipients Section (when sent_to_all = false)
- Multi-select for departments (with Building2 icon)
- Multi-select for specific employees (with Users icon)
- Live loading from API
- Validation: requires at least one department OR recipient
- Helper text for Ctrl/Cmd multi-select
3. Acknowledgement Required
- Checkbox to require recipients to acknowledge reading
- Clear explanation of what it means
UX IMPROVEMENTS:
- Folder indicator: shows when uploading to specific folder
- Visual sections with dividers and headers
- Icons for each field type
- Warning when no recipients selected (amber alert)
- Better validation messages
- Reset all new fields on successful upload
API CLIENT:
- Updated createDocument signature to include acknowledgement_required
- Properly serializes checkbox values as strings
DATA LOADING:
- useEffect loads departments and employees on mount
- Loading states during fetch
- Handles empty lists gracefully
VALIDATION:
- Requires file and title (unchanged)
- NEW: When sent_to_all=false, requires departments OR recipients
- Shows user-friendly error messages
BENEFITS:
- Full feature parity with backend capabilities
- Professional document management workflow
- Granular control over document distribution
- Acknowledgement tracking from upload stage
- Better UX with progressive disclosure
Fixed React hydration error caused by button nested inside button.
ISSUE:
- Console error: 'In HTML, <button> cannot be a descendant of <button>'
- Folder dropdown button contained a reset filter button inside it
- This is invalid HTML and causes hydration mismatch
SOLUTION:
- Changed inner button to span element
- Added cursor-pointer for visual feedback
- Added role="button" for accessibility
- Added tabIndex={0} for keyboard navigation
- Added onKeyDown handler for Enter/Space key support
- Maintains full functionality and accessibility
LOCATION:
- frontend/src/app/documents/page.tsx:255-267
- Folder filter reset button
The fix ensures proper HTML structure while preserving all interactive functionality and accessibility features.