Adapt to confId -> event_id change

See indico/indico#4676
This commit is contained in:
Adrian Moennich 2021-01-29 18:39:20 +01:00
parent d2c619a45d
commit 63213dc04f
8 changed files with 18 additions and 14 deletions

View File

@ -10,8 +10,10 @@ from indico.core.plugins import IndicoPluginBlueprint
from indico_payment_paypal.controllers import RHPaypalCancel, RHPaypalIPN, RHPaypalSuccess
blueprint = IndicoPluginBlueprint('payment_paypal', __name__,
url_prefix='/event/<confId>/registrations/<int:reg_form_id>/payment/response/paypal')
blueprint = IndicoPluginBlueprint(
'payment_paypal', __name__,
url_prefix='/event/<int:event_id>/registrations/<int:reg_form_id>/payment/response/paypal'
)
blueprint.add_url_rule('/cancel', 'cancel', RHPaypalCancel, methods=('GET', 'POST'))
blueprint.add_url_rule('/success', 'success', RHPaypalSuccess, methods=('GET', 'POST'))

View File

@ -94,7 +94,7 @@ def test_ipn_process(mocker, fail):
rh.registration.getTotal.return_value = 10.00
payment_status = {'fail': 'Failed', 'refund': 'Refunded', 'status': 'Foobar'}.get(fail, 'Completed')
amount = '-10.00' if fail == 'negative' else '10.00'
request.view_args = {'confId': rh.event.id}
request.view_args = {'event_id': rh.event.id}
request.args = {'registrantId': '1'}
request.form = {'payment_status': payment_status, 'txn_id': '12345', 'mc_gross': amount,
'mc_currency': 'EUR', 'business': 'foo@bar.com'}

View File

@ -100,7 +100,7 @@ $(function() {
*/
const get_api_params = function() {
const params = {
confId: $('#confId').val(),
event_id: $('#eventId').val(),
start_date: $('#statsFilterStartDate').val(),
end_date: $('#statsFilterEndDate').val(),
};

View File

@ -95,10 +95,8 @@ class PiwikPlugin(IndicoPlugin):
if not self.settings.get('enabled_for_events') or not site_id_events:
return {}
params = {'site_id_events': site_id_events}
if request.blueprint in ('event', 'events', 'contributions') and 'confId' in request.view_args:
if not str(request.view_args['confId']).isdigit():
return {}
params['event_id'] = request.view_args['confId']
if request.blueprint in ('event', 'events', 'contributions') and 'event_id' in request.view_args:
params['event_id'] = request.view_args['event_id']
contrib_id = request.view_args.get('contrib_id')
if contrib_id is not None and str(contrib_id).isdigit():
contribution = Contribution.query.filter_by(event_id=params['event_id'], id=contrib_id).first()
@ -115,7 +113,7 @@ class PiwikPlugin(IndicoPlugin):
return url.netloc + url.path
blueprint = IndicoPluginBlueprint('piwik', __name__, url_prefix='/event/<confId>/manage/statistics')
blueprint = IndicoPluginBlueprint('piwik', __name__, url_prefix='/event/<int:event_id>/manage/statistics')
blueprint.add_url_rule('/', 'view', RHStatistics)
blueprint.add_url_rule('/material', 'material', RHApiMaterial, methods=('GET', 'POST'))
blueprint.add_url_rule('/data/downloads', 'data_downloads', RHApiDownloads, methods=('GET', 'POST'))

View File

@ -31,7 +31,7 @@
id="statsFilterEndDate"
data-default="{{ report.end_date }}"
value="{{ report.end_date }}">
<input type="hidden" id="confId" value="{{ report.event_id }}">
<input type="hidden" id="eventId" value="{{ report.event_id }}">
<input type="hidden" id="contribId" value="{{ report.contrib_id }}">
</div>
<div class="statsFilterOption">

View File

@ -13,5 +13,5 @@ from indico_ursh.controllers import RHCustomShortURLPage, RHGetShortURL, RHShort
blueprint = IndicoPluginBlueprint('ursh', 'indico_ursh')
blueprint.add_url_rule('/ursh', 'get_short_url', RHGetShortURL, methods=('POST',))
blueprint.add_url_rule('/url-shortener', 'shorten_url', RHShortURLPage)
blueprint.add_url_rule('/event/<confId>/manage/short-url', 'shorten_event_url', RHCustomShortURLPage,
blueprint.add_url_rule('/event/<int:event_id>/manage/short-url', 'shorten_event_url', RHCustomShortURLPage,
methods=('GET', 'POST'))

View File

@ -15,5 +15,9 @@ blueprint = IndicoPluginBlueprint('vc_vidyo', 'indico_vc_vidyo')
# Room management
# using any(vidyo) instead of defaults since the event vc room locator
# includes the service and normalization skips values provided in 'defaults'
blueprint.add_url_rule('/event/<confId>/manage/videoconference/<any(vidyo):service>/<int:event_vc_room_id>/room-owner',
'set_room_owner', RHVidyoRoomOwner, methods=('POST',))
blueprint.add_url_rule(
'/event/<int:event_id>/manage/videoconference/<any(vidyo):service>/<int:event_vc_room_id>/room-owner',
'set_room_owner',
RHVidyoRoomOwner,
methods=('POST',)
)

View File

@ -16,7 +16,7 @@ blueprint = IndicoPluginBlueprint('vc_zoom', 'indico_vc_zoom')
# using any(zoom) instead of defaults since the event vc room locator
# includes the service and normalization skips values provided in 'defaults'
blueprint.add_url_rule(
'/event/<confId>/manage/videoconference/<any(zoom):service>/<int:event_vc_room_id>/make-me-alt-host',
'/event/<int:event_id>/manage/videoconference/<any(zoom):service>/<int:event_vc_room_id>/make-me-alt-host',
'make_me_alt_host',
RHRoomAlternativeHost,
methods=('POST',)