mirror of
https://github.com/pretix/pretix.git
synced 2026-06-11 01:25:13 +00:00
Remove media_exchange_supported-Flag: Checkin will always be denied if media needs to be exchanged; apps will fall back to explanation text
This commit is contained in:
committed by
Raphael Michel
parent
4522dd25b0
commit
1f4189d539
@@ -85,7 +85,6 @@ class CheckinRPCRedeemInputSerializer(serializers.Serializer):
|
||||
ignore_unpaid = serializers.BooleanField(default=False, required=False)
|
||||
questions_supported = serializers.BooleanField(default=True, required=False)
|
||||
use_order_locale = serializers.BooleanField(default=False, required=False)
|
||||
media_exchange_supported = serializers.BooleanField(default=False, required=False)
|
||||
nonce = serializers.CharField(required=False, allow_null=True)
|
||||
datetime = serializers.DateTimeField(required=False, allow_null=True)
|
||||
answers = serializers.JSONField(required=False, allow_null=True)
|
||||
|
||||
@@ -455,8 +455,7 @@ def _checkin_list_position_queryset(checkinlists, ignore_status=False, ignore_pr
|
||||
|
||||
def _redeem_process(*, checkinlists, raw_barcode, answers_data, datetime, force, checkin_type, ignore_unpaid, nonce,
|
||||
untrusted_input, user, auth, expand, pdf_data, request, questions_supported, canceled_supported,
|
||||
media_exchange_supported, source_type='barcode', legacy_url_support=False, simulate=False,
|
||||
gate=None, use_order_locale=False):
|
||||
source_type='barcode', legacy_url_support=False, simulate=False, gate=None, use_order_locale=False):
|
||||
if not checkinlists:
|
||||
raise ValidationError('No check-in list passed.')
|
||||
|
||||
@@ -814,7 +813,6 @@ def _redeem_process(*, checkinlists, raw_barcode, answers_data, datetime, force,
|
||||
datetime=datetime,
|
||||
questions_supported=questions_supported,
|
||||
canceled_supported=canceled_supported,
|
||||
media_exchange_supported=media_exchange_supported,
|
||||
user=user,
|
||||
auth=auth,
|
||||
type=checkin_type,
|
||||
@@ -995,7 +993,6 @@ class CheckinListPositionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
pdf_data=self.request.query_params.get('pdf_data', 'false').lower() == 'true',
|
||||
questions_supported=self.request.data.get('questions_supported', True),
|
||||
canceled_supported=self.request.data.get('canceled_supported', False),
|
||||
media_exchange_supported=self.request.data.get('media_exchange_supported', False),
|
||||
request=self.request, # this is not clean, but we need it in the serializers for URL generation
|
||||
legacy_url_support=True,
|
||||
)
|
||||
@@ -1032,7 +1029,6 @@ class CheckinRPCRedeemView(views.APIView):
|
||||
questions_supported=s.validated_data['questions_supported'],
|
||||
use_order_locale=s.validated_data['use_order_locale'],
|
||||
canceled_supported=True,
|
||||
media_exchange_supported=s.validated_data.get('media_exchange_supported', False),
|
||||
request=self.request, # this is not clean, but we need it in the serializers for URL generation
|
||||
legacy_url_support=False,
|
||||
)
|
||||
|
||||
@@ -948,7 +948,7 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
|
||||
ignore_unpaid=False, nonce=None, datetime=None, questions_supported=True,
|
||||
user=None, auth=None, canceled_supported=False, type=Checkin.TYPE_ENTRY,
|
||||
raw_barcode=None, raw_source_type=None, from_revoked_secret=False, simulate=False,
|
||||
gate=None, media_exchange_supported=False, reusable_media=None):
|
||||
gate=None, reusable_media=None):
|
||||
"""
|
||||
Create a checkin for this particular order position and check-in list. Fails with CheckInError if the check in is
|
||||
not valid at this time.
|
||||
@@ -960,8 +960,6 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
|
||||
questions are not filled out.
|
||||
:param ignore_unpaid: When set to True, this will succeed even when the order is unpaid.
|
||||
:param questions_supported: When set to False, questions are ignored
|
||||
:param media_exchange_supported: When set to False, required media exchanges are ignored; but access will still be
|
||||
denied
|
||||
:param nonce: A random nonce to prevent race conditions.
|
||||
:param datetime: The datetime of the checkin, defaults to now.
|
||||
:param simulate: If true, the check-in is not saved.
|
||||
@@ -1117,18 +1115,12 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
|
||||
linked_media = op.linked_media
|
||||
if not reusable_media and required_media_policy and required_media_type and not force:
|
||||
if not linked_media.exists():
|
||||
if media_exchange_supported:
|
||||
raise RequiredMediaExchangeError(
|
||||
_('Ticket needs to be exchanged to a suitable medium.'),
|
||||
'exchange',
|
||||
required_media_policy,
|
||||
required_media_type
|
||||
)
|
||||
else:
|
||||
raise CheckInError(
|
||||
_('Ticket needs to be exchanged to a suitable medium.'),
|
||||
'product'
|
||||
)
|
||||
raise RequiredMediaExchangeError(
|
||||
_('Ticket needs to be exchanged to a suitable medium.'),
|
||||
'exchange',
|
||||
required_media_policy,
|
||||
required_media_type
|
||||
)
|
||||
elif op.organizer.settings.reusable_media_usage_enforced:
|
||||
raise CheckInError(
|
||||
_('This ticket has already been exchanged for a reusable medium that now needs to be used instead.'),
|
||||
|
||||
@@ -192,11 +192,6 @@ class CheckinListSimulatorForm(forms.Form):
|
||||
initial=True,
|
||||
required=False,
|
||||
)
|
||||
media_exchange_supported = forms.BooleanField(
|
||||
label=_("Support for media exchange"),
|
||||
initial=True,
|
||||
required=False,
|
||||
)
|
||||
gate = SafeModelChoiceField(
|
||||
label=_('Gate'),
|
||||
empty_label=_('All gates'),
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
{% bootstrap_field form.gate layout="control" %}
|
||||
{% bootstrap_field form.ignore_unpaid layout="control" %}
|
||||
{% bootstrap_field form.questions_supported layout="control" %}
|
||||
{% bootstrap_field form.media_exchange_supported layout="control" %}
|
||||
<div class="row">
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
|
||||
@@ -553,7 +553,6 @@ class CheckInListSimulator(EventPermissionRequiredMixin, FormView):
|
||||
pdf_data=False,
|
||||
questions_supported=form.cleaned_data["questions_supported"],
|
||||
canceled_supported=False,
|
||||
media_exchange_supported=form.cleaned_data["media_exchange_supported"],
|
||||
request=self.request, # this is not clean, but we need it in the serializers for URL generation
|
||||
legacy_url_support=False,
|
||||
simulate=True,
|
||||
|
||||
Reference in New Issue
Block a user