Unverified Commit edc2681d authored by Luke's avatar Luke Committed by GitHub
Browse files

Return third party auth ids from friends graph (#526)

* return third party auth ids from friends graph

* update changelog
parent 68f81008
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Fix some issues around listing tournaments.
- Fix an issue that would prevent the insertion of a record in a tournament with no scheduled reset and end time.
- Ensure the devconsole applies user password updates even if no other fields change.
- Fix third-party authentication ids not getting returned if queried through the friends graph.

## [2.14.1] - 2020-11-02
### Added
+29 −14
Original line number Diff line number Diff line
@@ -110,7 +110,8 @@ func ListFriends(ctx context.Context, logger *zap.Logger, db *sql.DB, tracker Tr
	query := `
SELECT id, username, display_name, avatar_url,
	lang_tag, location, timezone, metadata,
	create_time, users.update_time, user_edge.update_time, state, position
	create_time, users.update_time, user_edge.update_time, state, position,
	facebook_id, google_id, gamecenter_id, steam_id, facebook_instant_game_id, apple_id
FROM users, user_edge WHERE id = destination_id AND source_id = $1`
	params = append(params, userID)
	if state != nil {
@@ -156,8 +157,16 @@ FROM users, user_edge WHERE id = destination_id AND source_id = $1`
		var edgeUpdateTime pgtype.Timestamptz
		var state sql.NullInt64
		var position sql.NullInt64

		if err = rows.Scan(&id, &username, &displayName, &avatarURL, &lang, &location, &timezone, &metadata, &createTime, &updateTime, &edgeUpdateTime, &state, &position); err != nil {
		var facebookID sql.NullString
		var googleID sql.NullString
		var gamecenterID sql.NullString
		var steamID sql.NullString
		var facebookInstantGameID sql.NullString
		var appleID sql.NullString

		if err = rows.Scan(&id, &username, &displayName, &avatarURL, &lang, &location, &timezone, &metadata,
			&createTime, &updateTime, &edgeUpdateTime, &state, &position,
			&facebookID, &googleID, &gamecenterID, &steamID, &facebookInstantGameID, &appleID); err != nil {
			logger.Error("Error retrieving friends.", zap.Error(err))
			return nil, err
		}
@@ -190,6 +199,12 @@ FROM users, user_edge WHERE id = destination_id AND source_id = $1`
			CreateTime:            &timestamp.Timestamp{Seconds: createTime.Time.Unix()},
			UpdateTime:            &timestamp.Timestamp{Seconds: updateTime.Time.Unix()},
			Online:                online,
			FacebookId:            facebookID.String,
			GoogleId:              googleID.String,
			GamecenterId:          gamecenterID.String,
			SteamId:               steamID.String,
			FacebookInstantGameId: facebookInstantGameID.String,
			AppleId:               appleID.String,
		}

		friends = append(friends, &api.Friend{