fix conversations subscribing permissions
This commit is contained in:
parent
22a4346aae
commit
374d7a97cb
|
@ -7,6 +7,7 @@ from django.core.urlresolvers import reverse
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
|
|
||||||
from accounts.models import Participation
|
from accounts.models import Participation
|
||||||
|
from accounts.decorators import orga_required, staff_required
|
||||||
from proposals.models import Talk
|
from proposals.models import Talk
|
||||||
|
|
||||||
from .forms import MessageForm
|
from .forms import MessageForm
|
||||||
|
@ -72,11 +73,9 @@ def correspondents(request):
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@staff_required
|
||||||
def subscribe(request, username):
|
def subscribe(request, username):
|
||||||
|
|
||||||
# TODO check admin
|
|
||||||
|
|
||||||
participation = get_object_or_404(Participation, user__username=username, site=get_current_site(request))
|
participation = get_object_or_404(Participation, user__username=username, site=get_current_site(request))
|
||||||
participation.conversation.subscribers.add(request.user)
|
participation.conversation.subscribers.add(request.user)
|
||||||
messages.success(request, 'Subscribed.')
|
messages.success(request, 'Subscribed.')
|
||||||
|
@ -86,11 +85,9 @@ def subscribe(request, username):
|
||||||
return redirect(next_url)
|
return redirect(next_url)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@staff_required
|
||||||
def unsubscribe(request, username):
|
def unsubscribe(request, username):
|
||||||
|
|
||||||
# TODO check admin
|
|
||||||
|
|
||||||
participation = get_object_or_404(Participation, user__username=username, site=get_current_site(request))
|
participation = get_object_or_404(Participation, user__username=username, site=get_current_site(request))
|
||||||
participation.conversation.subscribers.remove(request.user)
|
participation.conversation.subscribers.remove(request.user)
|
||||||
messages.success(request, 'Unsubscribed.')
|
messages.success(request, 'Unsubscribed.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user