takahe/users/views/announcements.py
Andrew Godwin 8f57aa5f37
UI/Domains Refactor
Redoes the UI to remove timelines, promote domains, and a lot of other things to support the refactor.
2023-05-03 22:42:37 -06:00

21 lines
720 B
Python

from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django.views.generic import View
from users.models import Announcement
from users.services import AnnouncementService
@method_decorator(login_required, name="dispatch")
class AnnouncementDismiss(View):
"""
Dismisses an announcement for the current user
"""
def post(self, request, id):
announcement = get_object_or_404(Announcement, pk=id)
AnnouncementService(request.user).mark_seen(announcement)
# In the UI we replace it with nothing anyway
return HttpResponse("")