Skip to content

Commit

Permalink
Add co-speaker feature broken (#130)
Browse files Browse the repository at this point in the history
* send invitation for additional speaker input
* fix code review
  • Loading branch information
lcduong authored Jul 20, 2024
1 parent 238234e commit a378967
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pretalx/cfp/views/user.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import textwrap
import urllib
import logging

from csp.decorators import csp_update
from django.contrib import messages
Expand Down Expand Up @@ -29,13 +30,16 @@
from pretalx.common.middleware.event import get_login_redirect
from pretalx.common.phrases import phrases
from pretalx.common.views import is_form_bound
from pretalx.common.exceptions import SendMailException
from pretalx.person.forms import LoginInfoForm, SpeakerProfileForm
from pretalx.person.permissions import person_can_view_information
from pretalx.schedule.forms import AvailabilitiesFormMixin
from pretalx.submission.forms import InfoForm, QuestionsForm, ResourceForm
from pretalx.submission.models import Resource, Submission, SubmissionStates


logger = logging.getLogger(__name__)

@method_decorator(csp_update(IMG_SRC="https://www.gravatar.com"), name="dispatch")
class ProfileView(LoggedInEventPageMixin, TemplateView):
template_name = "cfp/event/user_profile.html"
Expand Down Expand Up @@ -397,6 +401,14 @@ def form_valid(self, form):
form.instance.update_duration()
if form.instance.pk and "track" in form.changed_data:
form.instance.update_review_scores()
if form.instance.pk and "additional_speaker" in form.changed_data:
try:
form.instance.send_invite(to=[form.cleaned_data.get('additional_speaker')],
_from=self.request.user)
except SendMailException as exception:
logger.warning('Failed to send email with error: %s', exception)
messages.warning(self.request,
phrases.cfp.submission_email_fail)
form.instance.log_action(
"pretalx.submission.update", person=self.request.user
)
Expand Down
1 change: 1 addition & 0 deletions src/pretalx/sso_provider/providers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests
from urllib.parse import urlencode

from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
from allauth.socialaccount.providers.base import AuthAction, ProviderAccount
Expand Down

0 comments on commit a378967

Please sign in to comment.