Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow unpin of etherpads even if user is not in group #138

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions mafiasi/etherpad/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django import forms
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Group
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import redirect
from django.template.response import TemplateResponse
Expand Down Expand Up @@ -159,18 +160,10 @@ def pin_pad(request, group_name, pad_name):
@require_POST
def unpin_pad(request, group_name, pad_name):
try:
group = request.user.groups.get(name=group_name)
group = Group.objects.get(name=group_name)
PinnedEtherpad.objects.filter(user=request.user, group_name=group, pad_name=pad_name).delete()
except ObjectDoesNotExist:
return TemplateResponse(
request,
"etherpad/forbidden-notingroup.html",
{
"group_name": group_name,
},
status=403,
)

PinnedEtherpad.objects.filter(user=request.user, group_name=group, pad_name=pad_name).delete()
pass
# redirect to pad overview
return redirect("ep_index")

Expand Down