mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Python formatting
This commit is contained in:
parent
5caac46c31
commit
0d88794f46
2 changed files with 10 additions and 10 deletions
|
@ -47,9 +47,9 @@ class UpdateViews(TestCase):
|
|||
request = self.factory.get("")
|
||||
request.user = self.local_user
|
||||
|
||||
with patch('bookwyrm.activitystreams.ActivityStream.get_unread_count') as mock:
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.get_unread_count") as mock:
|
||||
mock.return_value = 3
|
||||
result = views.get_unread_status_count(request, 'home')
|
||||
result = views.get_unread_status_count(request, "home")
|
||||
|
||||
self.assertIsInstance(result, JsonResponse)
|
||||
data = json.loads(result.getvalue())
|
||||
|
|
|
@ -4,14 +4,16 @@ from django.http import JsonResponse
|
|||
|
||||
from bookwyrm import activitystreams
|
||||
|
||||
|
||||
@login_required
|
||||
def get_notification_count(request):
|
||||
""" any notifications waiting? """
|
||||
return JsonResponse({
|
||||
"count": request.user.notification_set.filter(
|
||||
read=False
|
||||
).count(),
|
||||
})
|
||||
return JsonResponse(
|
||||
{
|
||||
"count": request.user.notification_set.filter(read=False).count(),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
def get_unread_status_count(request, stream):
|
||||
|
@ -19,6 +21,4 @@ def get_unread_status_count(request, stream):
|
|||
stream = activitystreams.streams.get(stream)
|
||||
if not stream:
|
||||
return JsonResponse({})
|
||||
return JsonResponse({
|
||||
"count": stream.get_unread_count(request.user)
|
||||
})
|
||||
return JsonResponse({"count": stream.get_unread_count(request.user)})
|
||||
|
|
Loading…
Reference in a new issue