wearethoughtfox / amnesty-facebook

0 stars 0 forks source link

App doesn’t handle the user having no Facebook friends #48

Closed pauldwaite closed 7 years ago

pauldwaite commented 7 years ago

Steps to reproduce

  1. Log into Facebook as a test user with no friends assigned.
  2. Visit the app
  3. Click on the “Nominate with Facebook” button.
  4. Authorise the app.
  5. Check the console.

Expected behaviour

The app tactfully mentions that the user has no Facebook friends, and there are no errors in the console.

Actual behaviour

The app fails, and throws a couple of errors:

TypeError: response.paging is undefined  friends.js:23:1
TypeError: response.location is undefined person.js:35:13
pauldwaite commented 7 years ago

Ah yes, so: in the Facebook App settings area, go to Roles > Test Users:

https://developers.facebook.com/apps/158409844687300/roles/test-users/

Here, you can create test user accounts for the app. When created, these user accounts have no friends. To use them:

  1. Visit the URL above, and log in as yourself.
  2. Click on the “Edit” link next to a user, and click on “Log in as this test user”
  3. Click through the two confirmation screens.
  4. In the same browser, visit the app.

You can set a password for each test user too, in case you want to test logging in as them normally, but these passwords appear to be subject to Facebook’s usual password rules (and the e-mail addresses for the test users are fairly tricky to type in), so you might want to use a password manager.

pauldwaite commented 7 years ago

After authorizing the app as a test user with no friends, I currently see an empty friends list box, and I don’t get the response.paging error in the console any more.

(I still get the response.location one, but that’s been fixed separately.)

robertocarroll commented 7 years ago

I don't think I'd fixed this before but now I think I have here:

https://github.com/wearethoughtfox/amnesty-facebook/commit/c094a12d02fcced6d66ee98582274deff05a2c9d

See what you think.

robertocarroll commented 7 years ago

Fixed in https://github.com/wearethoughtfox/amnesty-facebook/pull/56