Add staff-only all comments page and bump versions
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 15s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 47s
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 15s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 47s
- Add new "alle-kommentare" (all comments) view for staff users only - Allows staff to view and manage all user comments across the system - Grouped by document with user information displayed - Staff can delete any comment via the dedicated delete button - Restricts access via user_passes_test decorator - Create all_comments.html template - Based on user_comments template with added username field - Shows comment author, creation time, and edit time - Provides delete functionality for comment management - Update navigation menu - Add "Alle Kommentare" link in user dropdown menu - Link only visible to staff members - Add URL route for alle-kommentare page - Path: /dokumente/alle-kommentare/ - URL name: all_comments - Bump application versions - Update footer version from 0.965 to 0.966 - Update K8s deployment version from 0.917 to 0.918 - ArgoCD deployment already at 0.966 All existing tests pass (148 tests total)
This commit is contained in:
@@ -392,3 +392,31 @@ def user_comments(request):
|
||||
'comments_by_document': comments_by_document,
|
||||
'total_comments': user_comments.count(),
|
||||
})
|
||||
|
||||
|
||||
@login_required
|
||||
@user_passes_test(is_staff_user)
|
||||
def all_comments(request):
|
||||
"""
|
||||
Display all comments from all users, grouped by document.
|
||||
Staff only.
|
||||
"""
|
||||
# Get all comments
|
||||
all_comments_qs = VorgabeComment.objects.select_related(
|
||||
'vorgabe', 'vorgabe__dokument', 'user'
|
||||
).order_by(
|
||||
'vorgabe__dokument__nummer', '-created_at'
|
||||
)
|
||||
|
||||
# Group comments by document
|
||||
comments_by_document = {}
|
||||
for comment in all_comments_qs:
|
||||
dokument = comment.vorgabe.dokument
|
||||
if dokument not in comments_by_document:
|
||||
comments_by_document[dokument] = []
|
||||
comments_by_document[dokument].append(comment)
|
||||
|
||||
return render(request, 'standards/all_comments.html', {
|
||||
'comments_by_document': comments_by_document,
|
||||
'total_comments': all_comments_qs.count(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user