liberapay / liberapay.com

Source code of the recurrent donations platform Liberapay
https://liberapay.com/
1.64k stars 207 forks source link

Donation suggestions based on social network connections #1021

Open Changaco opened 6 years ago

Changaco commented 6 years ago

I've figured out how we can present good suggestions to donors as soon as they connect their elsewhere accounts (Mastodon, Twitter, etc).

Our current social explorer is based on browsing the list of accounts the donor follows, but we can't fetch this full list in a few seconds (related issue: #787). So we need to reverse our process: instead of asking the elsewhere platform who the new donor follows, we should ask it continuously in the background who our users who accept donations are followed by, and store the information in our database. That way when a donor connects an elsewhere account we can know instantly if they follow others who have accounts on Liberapay, because this data will already be in our database. Moreover this would also allow us to notify donors when someone they follow joins Liberapay (we currently only do that if the donor had set up a pledge).

Implementing this has the potential to give Liberapay the network effect it currently lacks.

Privacy impact assessment: lists of followers are usually public so simply storing and querying them shouldn't create any significant risk.

trebmuh commented 6 years ago

Sounds really nice!

Changaco commented 5 years ago

I've started working on this. Once the first stage is deployed it will take a while to load all the lists of followers and stargazers from the APIs, by beginning this week we should be able to deploy the second stage next month.

Changaco commented 5 years ago

GitLab supports neither following a user nor getting a list of a repository's stargazers, so we won't be able to provide instant suggestions for this platform.

Changaco commented 5 years ago

Here's what we can get:

Changaco commented 5 years ago

I'm worried about the storage cost of my original approach. In order to avoid bloating our database (#1299) we'll have to limit ourselves to storing only a partial list of the relations between elsewhere accounts.

To illustrate the problem: take a look at the repo explorer, the top one has more than 100k stars. If we stored all stargazers of the GitHub repositories we currently have in our database, then that hypothetical stargazers table would have more than 1 million rows, making it the largest table of our DB by far.

Instead of trying too hard to provide instantaneous suggestions we can work on good email notifications to send when we detect a social connection between two Liberapay users who aren't already connected by a donation in our system.