HyphaApp / hypha

Submission management software for open calls
https://www.hypha.app
BSD 3-Clause "New" or "Revised" License
67 stars 39 forks source link

Visibility fixes for partners that are also applicants #3893

Closed wes-otf closed 3 months ago

wes-otf commented 4 months ago

Fixes #3892. This solution was a bit unruly (especially ugly after linting) but it seemed like the logical approach without refactoring the whole visibility_for to be a normal method rather than a class method. This fix evaluates if the partner/reviewer is the author of the source submission first before evaluating the their role. The reviewer role was also lumped in here because even though I know we advise against a reviewer also being an applicant, it still could happen without oversight.

I tried to keep the code as clean as I could and reuse QuerySets, but let me know if y'all see any way I can optimize!

Test Steps

wes-otf commented 3 months ago

@frjo if you get the time can you give this a test? I'd like to get this patch in soon

frjo commented 3 months ago

Works well in my testing.