OpenTreeMap is a collaborative platform for crowdsourced tree inventory, ecosystem services calculations, urban forestry analysis, and community engagement.
There are three tree photo upload situations where we do not want to show a social media sharing dialog after POSTing the image to the server.
The instance is private.
The image file was invalid.
The image file was too big.
Private instances are not handled by not rendering the dialog markup on the page unless the instance is public.
Invalid images are handled by checking the markup returned from the response for the presence of an error element. This is not ideal, but is easier that changing the way failures are reported vs. loading updated carousel markup.
Large images are intended to be blocked by Nginx before reaching Django. If they reach Django they will trigger a validation error, which will be handled the same way invalid images are handled.
Testing
Create 2 instances, 1 public and 1 private
Verify that uploading a valid photo to the public instance shows the share dialog.
Verify that uploading a valid photo to the private instance does not show the share dialog.
Verify that uploading a non-image to the public instance shows the share dialog.
Verify that uploading a too large image to the public instance shows the share dialog.
large.png.zip
Coverage remained the same at 83.904% when pulling a856ae9990bf22fc2fe7094b25d5b68b43ad45f9 on jwalgran:feature/skip-photo-share into f342ae25eb71dea0a0c2153a6da43c2419fbdfe4 on OpenTreeMap:develop.
There are three tree photo upload situations where we do not want to show a social media sharing dialog after POSTing the image to the server.
Private instances are not handled by not rendering the dialog markup on the page unless the instance is public.
Invalid images are handled by checking the markup returned from the response for the presence of an error element. This is not ideal, but is easier that changing the way failures are reported vs. loading updated carousel markup.
Large images are intended to be blocked by Nginx before reaching Django. If they reach Django they will trigger a validation error, which will be handled the same way invalid images are handled.
Testing
Connects to #2930