fix: sync contact phone privacy disclosure
This commit is contained in:
parent
0e2fcdf9c8
commit
e1a95c7318
19 changed files with 789 additions and 50 deletions
|
|
@ -138,9 +138,6 @@ func (s *ContactStore) Upsert(_ context.Context, userID int64, input domain.Cont
|
|||
contact.User.EmojiStatusUntil = existing.User.EmojiStatusUntil
|
||||
contact.CloseFriend = existing.CloseFriend
|
||||
contact.User.CloseFriend = existing.CloseFriend || existing.User.CloseFriend
|
||||
if contact.Phone == "" {
|
||||
contact.User.Phone = existing.User.Phone
|
||||
}
|
||||
if contact.FirstName == "" {
|
||||
contact.User.FirstName = existing.User.FirstName
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1597,7 +1597,6 @@ func storyViewerMatchesQuery(viewerID int64, query string, profile domain.User,
|
|||
profile.LastName,
|
||||
strings.TrimSpace(profile.FirstName + " " + profile.LastName),
|
||||
profile.Username,
|
||||
profile.Phone,
|
||||
strconv.FormatInt(viewerID, 10),
|
||||
}
|
||||
if isContact {
|
||||
|
|
@ -1610,7 +1609,6 @@ func storyViewerMatchesQuery(viewerID int64, query string, profile domain.User,
|
|||
contact.User.LastName,
|
||||
strings.TrimSpace(contact.User.FirstName+" "+contact.User.LastName),
|
||||
contact.User.Username,
|
||||
contact.User.Phone,
|
||||
)
|
||||
}
|
||||
for _, candidate := range candidates {
|
||||
|
|
|
|||
|
|
@ -1627,6 +1627,33 @@ func TestStoryStoreListStoryViewsFiltersByContactsAndQuery(t *testing.T) {
|
|||
t.Fatalf("username query = %+v, want viewer 2002", stranger)
|
||||
}
|
||||
|
||||
hiddenAccountPhone, err := store.ListStoryViews(ctx, domain.StoryViewListRequest{
|
||||
ViewerUserID: owner.ID,
|
||||
Owner: owner,
|
||||
StoryID: 1,
|
||||
Limit: 10,
|
||||
Query: "155502",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("list query hidden account phone: %v", err)
|
||||
}
|
||||
if hiddenAccountPhone.Count != 0 || len(hiddenAccountPhone.Views) != 0 {
|
||||
t.Fatalf("hidden account phone query = %+v, want no match", hiddenAccountPhone)
|
||||
}
|
||||
knownContactPhone, err := store.ListStoryViews(ctx, domain.StoryViewListRequest{
|
||||
ViewerUserID: owner.ID,
|
||||
Owner: owner,
|
||||
StoryID: 1,
|
||||
Limit: 10,
|
||||
Query: "7001",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("list query known contact phone: %v", err)
|
||||
}
|
||||
if knownContactPhone.Count != 1 || len(knownContactPhone.Views) != 1 || knownContactPhone.Views[0].ViewerID != 2001 {
|
||||
t.Fatalf("known contact phone query = %+v, want viewer 2001", knownContactPhone)
|
||||
}
|
||||
|
||||
intersection, err := store.ListStoryViews(ctx, domain.StoryViewListRequest{
|
||||
ViewerUserID: owner.ID,
|
||||
Owner: owner,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue