mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-28 18:21:00 +00:00
8b3106b852
Fixes #377
21 lines
712 B
Python
21 lines
712 B
Python
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.decorators import identity_required
|
|
from users.models import Announcement
|
|
from users.services import AnnouncementService
|
|
|
|
|
|
@method_decorator(identity_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("")
|