politeiagui
politeiagui copied to clipboard
[cms] Invoice page pulling too much info
- Invoice page (at
/invoices/{token}
) is making a batch request for all proposals it needs to show line items. - The response contains an overkill amount of info about the proposals, including proposal files.
- The more proposals are used in the invoice, and the more and bigger files they have, the bigger the download will be. As a real example, invoice using 4 text-only proposals pulls 40K (18K compressed) batch response. This can get much worse if attachments are not filtered for this call (I didn't test it with a proposal that has attachments).
- All that is currently needed for display is proposal tokens and their titles.
- In the future it may be needed to fetch some extra metadata for proposal owner's review (like proposal validity period and budget limit).
- In any case, it shouldn't pull more than ~2-3K of JSON data in most cases.
- I suggest to start from removing the biggest offender - not putting base64-encoded proposal files into the response.
- Ideally, remove more unneeded data from the response like keys/sigs/censorshiprecord/etc.
- And then I recommend to specify and freeze what should be in the batch response for this page to prevent unwanted fields creeping in in the future.