-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
142 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
from totem.utils.hash import basic_hash | ||
from totem.utils.utils import is_ajax | ||
|
||
from .actions import AttendCircleAction, JoinCircleAction, SubscribeAction | ||
from .actions import JoinCircleAction, SubscribeAction | ||
from .filters import ( | ||
all_upcoming_recommended_circles, | ||
upcoming_events_by_author, | ||
|
@@ -53,19 +53,19 @@ def _circle_detail(request: HttpRequest, user: User, circle: Circle, event: Circ | |
if not circle.published and not user.is_staff: | ||
raise PermissionDenied | ||
|
||
if user.is_authenticated and request.session.get(AUTO_RSVP_SESSION_KEY) and event: | ||
event_slug = request.session[AUTO_RSVP_SESSION_KEY] | ||
del request.session[AUTO_RSVP_SESSION_KEY] | ||
if event_slug == event.slug: | ||
try: | ||
_add_or_remove_attendee(user, event, True) | ||
messages.info(request, "Your spot in this Circle has been reserved.") | ||
except CircleEventException as e: | ||
messages.error(request, str(e)) | ||
# if user.is_authenticated and request.session.get(AUTO_RSVP_SESSION_KEY) and event: | ||
# event_slug = request.session[AUTO_RSVP_SESSION_KEY] | ||
# del request.session[AUTO_RSVP_SESSION_KEY] | ||
# if event_slug == event.slug: | ||
# try: | ||
# _add_or_remove_attendee(user, event, True) | ||
# messages.info(request, "Your spot in this Circle has been reserved.") | ||
# except CircleEventException as e: | ||
# messages.error(request, str(e)) | ||
|
||
token = request.GET.get("token") | ||
if token and event: | ||
_resolve_event_action(request, user, event, token) | ||
# token = request.GET.get("token") | ||
# if token and event: | ||
# _resolve_event_action(request, user, event, token) | ||
|
||
attending = False | ||
joinable = False | ||
|
@@ -92,26 +92,26 @@ def _circle_detail(request: HttpRequest, user: User, circle: Circle, event: Circ | |
) | ||
|
||
|
||
def _resolve_event_action(request: HttpRequest, user: User, event: CircleEvent, token: str): | ||
try: | ||
token_user, params = AttendCircleAction.resolve(token) | ||
if user.is_authenticated and user != token_user: | ||
return | ||
token_event_slug = params["event_slug"] | ||
if token_event_slug != event.slug: | ||
print("Invalid event slug") | ||
raise PermissionDenied | ||
try: | ||
event.add_attendee(token_user) | ||
except CircleEventException as e: | ||
messages.error(request, f"{str(e)}") | ||
return | ||
messages.success(request, "You have successfully reserved a spot to this session.") | ||
except Exception as e: | ||
capture_exception(e) | ||
messages.error( | ||
request, "Invalid or expired link. If you think this is an error, please contact us: [email protected]." | ||
) | ||
# def _resolve_event_action(request: HttpRequest, user: User, event: CircleEvent, token: str): | ||
# try: | ||
# token_user, params = AttendCircleAction.resolve(token) | ||
# if user.is_authenticated and user != token_user: | ||
# return | ||
# token_event_slug = params["event_slug"] | ||
# if token_event_slug != event.slug: | ||
# print("Invalid event slug") | ||
# raise PermissionDenied | ||
# try: | ||
# event.add_attendee(token_user) | ||
# except CircleEventException as e: | ||
# messages.error(request, f"{str(e)}") | ||
# return | ||
# messages.success(request, "You have successfully reserved a spot to this session.") | ||
# except Exception as e: | ||
# capture_exception(e) | ||
# messages.error( | ||
# request, "Invalid or expired link. If you think this is an error, please contact us: [email protected]." | ||
# ) | ||
|
||
|
||
def ics_hash(slug, user_ics_key): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters