Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TAS-324] ✨ Add suggested follow list #1328

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

AuroraHuang22
Copy link
Contributor

截圖 2023-09-15 上午12 36 42
2023-09-15.12.04.24.mov

src/util/api/index.js Outdated Show resolved Hide resolved
src/server/api/routes/users/v2/follow.js Outdated Show resolved Hide resolved
src/store/modules/wallet.js Outdated Show resolved Hide resolved
currentFollowees[currentIndex]
);

const followSuggestions = [...followees, ...pastFollowees].filter(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not suggest pastFollowees to users

Comment on lines +44 to +55
while (suggestedSet.size < 3 && currentIndex < currentFollowees.length) {
// eslint-disable-next-line no-await-in-loop
const { followees = [], pastFollowees = [] } = await getUserFollowees(
currentFollowees[currentIndex]
);

const followSuggestions = [...followees, ...pastFollowees].filter(
f => !currentFolloweesSet.has(f)
);

followSuggestions.forEach(suggestion => suggestedSet.add(suggestion));
currentIndex += 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would want avoid just leaking the whole follower list of currentIndex to user. Thus we should limit and perform some randomization of the output

  • Size of currentFollowees must be larger than a number, say 3, otherwise following 1 user would always yield result from that particular list
  • currentFollowees should contain some followees that are not already in currentFolloweesSet in order to be counted towards to the size limit above
  • We should randomly draw from currentFollowees instead of using currentIndex

If the above conditions are not met, we should just return default suggestions/nothing.

Also note these rules are still not perfect, a better idea would be to use public information for suggestions, instead of non-public information like follower list i.e. use creators of NFT owned by a user

Comment on lines +688 to +691
// Cache check and return cached result if it's valid
if (
state.suggestedFollowList.length &&
!currentFollowees.some(user => state.suggestedFollowList.includes(user))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove entry from suggestedFollowList if user click follow in suggested list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants