{"action":"created","issue":{"url":"https://api.github.com/repos/OpenBazaar/openbazaar-go/issues/90","repository_url":"https://api.github.com/repos/OpenBazaar/openbazaar-go","labels_url":"https://api.github.com/repos/OpenBazaar/openbazaar-go/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/OpenBazaar/openbazaar-go/issues/90/comments","events_url":"https://api.github.com/repos/OpenBazaar/openbazaar-go/issues/90/events","html_url":"https://github.com/OpenBazaar/openbazaar-go/issues/90","id":172504467,"number":90,"title":"GET followers / following API offset ID does not handle scenario where the offset ID is unfollowed.","user":{"login":"rmisio","id":794517,"avatar_url":"https://avatars.githubusercontent.com/u/794517?v=3","gravatar_id":"","url":"https://api.github.com/users/rmisio","html_url":"https://github.com/rmisio","followers_url":"https://api.github.com/users/rmisio/followers","following_url":"https://api.github.com/users/rmisio/following{/other_user}","gists_url":"https://api.github.com/users/rmisio/gists{/gist_id}","starred_url":"https://api.github.com/users/rmisio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmisio/subscriptions","organizations_url":"https://api.github.com/users/rmisio/orgs","repos_url":"https://api.github.com/users/rmisio/repos","events_url":"https://api.github.com/users/rmisio/events{/privacy}","received_events_url":"https://api.github.com/users/rmisio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OpenBazaar/openbazaar-go/labels/bug","name":"bug","color":"ee0701"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-22T17:07:00Z","updated_at":"2016-10-20T16:43:49Z","closed_at":null,"body":"GET followers / following API offset ID does not handle scenario where the guid represented by the offset ID is un-followed, or where that guid is un-followed and then re-followed (resulting in it's position moving to the top of the list).\r\n\r\nScenario 1:\r\n- fetch a page of followers. for example, the last follower in the page has an guid of 'abc'.\r\n- before you fetch the next page, user `abc` un-follows you.\r\n- fetch the second page using 'abc' as the offsetId.\r\n- haven't test this, but based on our discussion, I think the API may bomb or return nothing because the guid referenced by the offsetID is no longer in the list.\r\n\r\nExpected results:\r\nThe proper second page of the results is returned starting from 'abc's position when the first page was fetched.\r\n\r\nScenario 2:\r\n- fetch a page of followers. for example, the last follower in the page has a guid of 'abc'.\r\n- before you fetch the next page, user `abc` un-follows you and then re-follows you which moves his position from last in page 1 to first of page 1.\r\n- fetch the second page using 'abc' as the offsetId.\r\n- haven't test this, but based on our discussion, I think the API will return page 1 again, albeit with user 'abc' in the first position instead of the last position.\r\n\r\nExpected results:\r\nThe proper second page of the results is returned starting from 'abc's position when the first page was fetched.\r\n\r\n@cpacia as per our discussion, perhaps a way to solve this is to have the offsetId reference a \"follow\" record as opposed to a GUID and, upon an un-follow, the record is logically deleted (i.e. status becomes deleted)."},"comment":{"url":"https://api.github.com/repos/OpenBazaar/openbazaar-go/issues/comments/255161179","html_url":"https://github.com/OpenBazaar/openbazaar-go/issues/90#issuecomment-255161179","issue_url":"https://api.github.com/repos/OpenBazaar/openbazaar-go/issues/90","id":255161179,"user":{"login":"rmisio","id":794517,"avatar_url":"https://avatars.githubusercontent.com/u/794517?v=3","gravatar_id":"","url":"https://api.github.com/users/rmisio","html_url":"https://github.com/rmisio","followers_url":"https://api.github.com/users/rmisio/followers","following_url":"https://api.github.com/users/rmisio/following{/other_user}","gists_url":"https://api.github.com/users/rmisio/gists{/gist_id}","starred_url":"https://api.github.com/users/rmisio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmisio/subscriptions","organizations_url":"https://api.github.com/users/rmisio/orgs","repos_url":"https://api.github.com/users/rmisio/repos","events_url":"https://api.github.com/users/rmisio/events{/privacy}","received_events_url":"https://api.github.com/users/rmisio/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T16:43:49Z","updated_at":"2016-10-20T16:43:49Z","body":"There's an alternate way we could do this that wouldn't require \"soft\" deleting records and therefore growing the DB. Instead of paginating from an `offsetId`, we could make it timestamp based, e.g. `/ob/following?before=<timestamp> &limit=10` which would return the ten records with a createdAt timestamp older than the passed in timestamp.\r\n\r\nIf we went this route, it would require that the API return the createdAt timestamp for each record, instead of just the guid:\r\n\r\n```\r\n[\r\n  {\r\n    guid: 123,\r\n    createdAt: <timestamp>\r\n  },\r\n  {\r\n    guid: 124,\r\n    createdAt: <timestamp>\r\n  },\r\n]\r\n```\r\n\r\nAlso, in the `follow` socket, we would also need the timestamp provided as well."}}
{"actor":{"display_login":"rmisio"}}