Skip to content

Commit 066cd7e

Browse files
committed
Improve handling of blocked user list when importing friends from Facebook.
1 parent 8ed4f76 commit 066cd7e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
1919

2020
### Fixed
2121
- Runtime module loading now correctly handles paths on non-UNIX environments.
22+
- Correctly handle blocked user list when importing friends from Facebook.
2223

2324
## [2.0.2] - 2018-07-09
2425
### Added

server/core_authenticate.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -626,17 +626,25 @@ func importFacebookFriends(logger *zap.Logger, db *sql.DB, messageRouter Message
626626
}
627627
return err
628628
}
629-
defer rows.Close()
630629

631630
var id string
631+
possibleFriendIDs := make([]uuid.UUID, 0)
632632
for rows.Next() {
633-
position := time.Now().UTC().UnixNano()
634633
err = rows.Scan(&id)
635634
if err != nil {
636635
// Error scanning the ID, try to skip this user and move on.
637636
continue
638637
}
639-
friendID := uuid.FromStringOrNil(id)
638+
friendID, err := uuid.FromString(id)
639+
if err != nil {
640+
continue
641+
}
642+
possibleFriendIDs = append(possibleFriendIDs, friendID)
643+
}
644+
rows.Close()
645+
646+
for _, friendID := range possibleFriendIDs {
647+
position := time.Now().UTC().UnixNano()
640648

641649
var r *sql.Rows
642650
r, err = tx.Query("SELECT state FROM user_edge WHERE source_id = $1 AND destination_id = $2 AND state = 3", userID, friendID)

0 commit comments

Comments
 (0)