Compare commits
No commits in common. "78d367337dd0b89a699ba2e4da0c2270165ad283" and "5f63ba5d4f03bf5712d715efb8fbc1f8f33fa9fd" have entirely different histories.
78d367337d
...
5f63ba5d4f
3 changed files with 0 additions and 72 deletions
|
@ -1,7 +0,0 @@
|
||||||
from django.urls import path
|
|
||||||
|
|
||||||
app_name = 'api'
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path('profile/seen_posts/<str:submission_hash>', UserProfileAPIView.seen_post, name='user_seen_post'),
|
|
||||||
]
|
|
|
@ -1,42 +0,0 @@
|
||||||
from django.http import JsonResponse
|
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
|
||||||
|
|
||||||
from apps.user.models import UserProfile, SeenPost
|
|
||||||
|
|
||||||
from apps.sites.models import Submissions
|
|
||||||
|
|
||||||
class UserProfileAPIView(APIView):
|
|
||||||
|
|
||||||
def seen_post(request, submission_hash):
|
|
||||||
|
|
||||||
user = UserProfile.objects.get(user=request.user)
|
|
||||||
|
|
||||||
if request.method == 'GET':
|
|
||||||
try:
|
|
||||||
submission = Submissions.objects.get(submission_hash=submission_hash)
|
|
||||||
|
|
||||||
try:
|
|
||||||
SeenPost.objects.get(user=user, post_id=submission.pk)
|
|
||||||
|
|
||||||
return JsonResponse({'seen': True}, status=status.HTTP_200_OK)
|
|
||||||
|
|
||||||
except SeenPost.DoesNotExist:
|
|
||||||
return JsonResponse({'seen': False}, status=status.HTTP_200_OK)
|
|
||||||
|
|
||||||
except Submissions.DoesNotExist:
|
|
||||||
return JsonResponse({'message': 'Submission not found.'}, status=status.HTTP_404_NOT_FOUND)
|
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'PUT':
|
|
||||||
submission = Submissions.objects.get(submission_hash=submission_hash)
|
|
||||||
|
|
||||||
SeenPost.objects.get_or_create(user=user, post_id=submission.pk)
|
|
||||||
|
|
||||||
return JsonResponse({'seen': True}, status=status.HTTP_200_OK)
|
|
||||||
|
|
||||||
else:
|
|
||||||
return JsonResponse({'message': 'Only GET and PUT requests are allowed.'}, status=status.HTTP_405_METHOD_NOT_ALLOWED)
|
|
||||||
|
|
|
@ -406,29 +406,6 @@ body{
|
||||||
opacity: 1; /* Show the overlay on hover */
|
opacity: 1; /* Show the overlay on hover */
|
||||||
}
|
}
|
||||||
|
|
||||||
.seen-overlay {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 2;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 14px;
|
|
||||||
letter-spacing: .5px;
|
|
||||||
color: #232326;
|
|
||||||
background-color: #414141;
|
|
||||||
border: 1.25px solid #232326;
|
|
||||||
border-radius: 0 1vmin 0 1vmin;
|
|
||||||
white-space: nowrap;
|
|
||||||
padding: 4px 6px 4px;
|
|
||||||
margin: 0 1px 0 0;
|
|
||||||
cursor: pointer;
|
|
||||||
opacity: .8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.seen-overlay[data-seen="false"] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*=================================================================
|
/*=================================================================
|
||||||
Site icon overlay on gallery
|
Site icon overlay on gallery
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue