-
Notifications
You must be signed in to change notification settings - Fork 510
Flatten attachments #6608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flatten attachments #6608
Conversation
|
@ThiefMaster this is introducing a breaking change, so I'll wait for your input on this. |
|
Is the user supposed to be able to control whether the list is flat or not? I think out of the three options proposed in the linked issue, option 3 sounds the best to me |
@tomasr8 I just implemented that option. I edited the description accordingly. EDIT: never mind, it actually didn't always work. I've been struggling with form submission and JQuery. This is a best-effort, but I'm not sure the cleanest approach. Mind to take a look? |
|
I don't know if this is the best way, but you could pass the diff --git a/indico/modules/events/registration/controllers/management/reglists.py b/indico/modules/events/registration/controllers/management/reglists.py
index 5a64156dda..e843c07620 100644
--- a/indico/modules/events/registration/controllers/management/reglists.py
+++ b/indico/modules/events/registration/controllers/management/reglists.py
@@ -119,7 +119,6 @@ class RHRegistrationsListManage(RHManageRegFormBase):
'attachment',
type='href-custom',
url=url_for('.registrations_attachments_export', regform),
- params={'flatten': False},
weight=60,
extra_classes='js-submit-list-form regform-download-attachments',
),
@@ -127,9 +126,8 @@ class RHRegistrationsListManage(RHManageRegFormBase):
_('Download Attachments (flat)'),
'attachment',
type='href-custom',
- url=url_for('.registrations_attachments_export', regform),
- params={'flatten': True},
- weight=60,
+ url=url_for('.registrations_attachments_export', regform, flatten=True),
+ weight=59,
extra_classes='js-submit-list-form regform-download-attachments',
),
ActionMenuEntry(
@@ -909,7 +907,7 @@ class RHRegistrationsExportAttachments(ZipGeneratorMixin, RHRegistrationsExportB
@use_kwargs({
'flatten': fields.Boolean(load_default=False),
- })
+ }, location='query')
def _process_args(self, flatten):
RHRegistrationsExportBase._process_args(self)
self.flatten = flatten |
This is a POST. AFAIK it's not a good practice to mix both query parameters and body parameters. I don't have an strong opinion against it, and It's fine for me if it solves the issue. I simply thought that wouldn't be accepted. |
|
I don't see a reason against mixing them, especially if it means not adding custom JS. The only reason we use POST there is because the number of IDs may not fit in a query string. |
|
@ThiefMaster OK, all done. Ready for review. |
indico/modules/events/registration/controllers/management/reglists.py
Outdated
Show resolved
Hide resolved
indico/modules/events/registration/controllers/management/reglists.py
Outdated
Show resolved
Hide resolved
26a1031 to
18738fb
Compare
We already use that terminology elsewhere
18738fb to
33ae7e6
Compare
Closes #6536.
This PR flattens the event attachments as described in #6536.
Implementation notes
The endpoint accepts a
flattenboolean field. If set toTrue, it flattens the files as described bellow, while ifFalseit maintains the old behaviour.Please note that a new
Download Attachments (flat)entry has been added.Previously
After the changes in this PR