datamade / bga-payroll

💰 How much do your public officials make?
4 stars 4 forks source link

Vary cached employer pages on authentication cookie #579

Open hancush opened 2 years ago

hancush commented 2 years ago

We do a little do-si-do in the employer views to show the standardized export button conditional on whether a user is authenticated. Unfortunately, we cache those views, so this dance is not repeated for each viewer, but rather the first viewer to visit the uncached page.

We should vary the cache based on the authentication cookie. Django docs on:

It looks from analytics like a lot of traffic comes through person pages, i.e., a not insubstantial amount of employer views may be accessed for the first time by an unauthenticated user, because they aren't coming to the site through search, hiding the standardized data download, even for authenticated users. I don't think this is dire because the source document containing the same information is available to all users, regardless of authentication status, but wanted to note.

If we don't want to go down this rabbit hole, we could:

fgregg commented 2 years ago

I'd like to unconditionally show the standardized data download button until we have evidence that it is causing a problem.

fgregg commented 2 years ago

@smcalilly, can you make that change

smcalilly commented 2 years ago

@fgregg yep, doing it now