Ah, I see, the roster-based suggestion only shows up when you're both
online?

So, the use case that I'd like to see work smoothly is:

- User A friends User B, triggering an email invitation
- User B receives the invitation, installs Lantern and logs in
- User B sees a friend suggestion for User A and immediately friends him

It seems nice to be able to close the loop right away rather than having to
wait for a hoped future point in time where we're both online at the same
time.  It also makes it easier to test.


Cheers,
Ox

-----------------------------------------------------------------------------------------

"I love people who harness themselves, an ox to a heavy cart,
who pull like water buffalo, with massive patience,
who strain in the mud and the muck to move things forward,
who do what has to be done, again and again."

- Marge Piercy



On Sun, Jan 12, 2014 at 6:30 PM, myleshorton <notifications@github.com>wrote:

> In src/main/java/org/lantern/friending/Friending.java:
>
> > -                        return success(quota, friends);
> > +                        Set<Friend> uniqueFriends = new HashSet<Friend>(friends);
> > +                        // Find friend relationships referencing this user and add them
> > +                        // to the set of unique Friends as free to friend
> > +                        List<LanternFriend> reverseFriends = new Dao()
> > +                                .withObjectify(new DbCall<List<LanternFriend>>() {
> > +                                    @Override
> > +                                    public List<LanternFriend> call(Objectify ofy) {
> > +                                        return ofy.query(LanternFriend.class)
> > +                                                .filter("email", userEmail)
> > +                                                .filter("status", Status.friend)
> > +                                                .list();
> > +                                    }
> > +                                });
> > +                        for (Friend friend : reverseFriends) {
> > +                            uniqueFriends.add(new LanternFriend(friend.getUserEmail(), userEmail, Status.pending, true));
>
> So the only disadvantage of relying on the roster itself is that you only
> get the suggestion when your friend is online. Then again, though, if
> you're not eventually online at the same time, there's no point, and as
> soon as you are the friend suggestion gets added.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/getlantern/lantern-controller/pull/59/files#r8816209>
> .
>