wikitree / wikitree-dynamic-tree

Dynamically generated and browsed graphical family tree
MIT License
26 stars 20 forks source link

Some Views break when the user is not signed into the API or blocked by Privacy #79

Open bcaseyrls opened 2 years ago

bcaseyrls commented 2 years ago

Describe the bug Some of the views require the user to be signed in for them to work properly. For example the "Family Anniversaries" calendar requests the user's watchlist. That's only defined if the use is signed in. If I try displaying that view when not signed in, I get an infinitely spinning tree image, with no error message. The Ancestor Webs view also halts after saying "please wait". Several views, including the base dynamic tree and the Family Group view display "undefined" in the header for the name of the profile and then crash with nothing showing up in the view container.

The same thing happens if you are signed in but try to display a view for a profile that is private and does not have you on the Trusted List. Basically, we're not catching cases where the starting profile is bad/inaccessible for one reason or another. We're catching completely invalid profiles in ViewRegistry.onPersonDataReceived. If you put in garbage for the WikiTree ID in the form and click "Go" you correctly get an error status saying the profile is invalid. This does not happen for valid profiles which the viewing user does not have (full) access to.

I think the fix is in onPersonDataReceived() instead of just checking that we got a "person" data element back, we need to make sure that element has more than the ID in it.

To Reproduce Steps to reproduce the behavior:

  1. Sign out of the API (clear your cookies)
  2. Try displaying a view that requires being signed in, e.g. https://apps.wikitree.com/apps/wikitree-dynamic-tree/#view=calendar

Expected behavior We should provide clear status to the user when we can't init a view.

bcaseyrls commented 2 years ago

I've updated the base, ahnentafel, and surnames views to catch problems with the starting profile. I added showInfoPanel and hideInfoPanel to wtViewRegistry to facilitate.