Commit 7277e37f authored by Mo Firouz's avatar Mo Firouz
Browse files

Convert friend ID to uuid string instead of cast.

parent fd10c500
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import (

	"github.com/lib/pq"
	"go.uber.org/zap"
	"github.com/satori/go.uuid"
)

func (p *pipeline) querySocialGraph(logger *zap.Logger, filterQuery string, params []interface{}) ([]*User, error) {
@@ -86,7 +87,7 @@ func (p *pipeline) addFacebookFriends(logger *zap.Logger, userID string, handle
	var err error

	ts := nowMs()
	friendUserIDs := make([]interface{}, 0)
	friendUserIDs := make([]string, 0)
	defer func() {
		if err != nil {
			logger.Error("Could not import friends from Facebook", zap.Error(err))
@@ -116,10 +117,9 @@ func (p *pipeline) addFacebookFriends(logger *zap.Logger, userID string, handle

						notifications := make([]*NNotification, len(friendUserIDs))
						for i, friendUserID := range friendUserIDs {
							fid := friendUserID.(string)
							notifications[i] = &NNotification{
								Id:         generateNewId(),
								UserID:     fid,
								UserID:     friendUserID,
								Subject:    subject,
								Content:    content,
								Code:       NOTIFICATION_FRIEND_JOIN_GAME,
@@ -220,7 +220,11 @@ func (p *pipeline) addFacebookFriends(logger *zap.Logger, userID string, handle
	}

	// Track the user IDs to notify their friend has joined the game.
	friendUserIDs = paramsEdge[2:]
	for _, id := range paramsEdge[2:] {
		uid, _ := uuid.FromBytes(id.([]byte))
		friendUserIDs = append(friendUserIDs, uid.String())
	}

}

func (p *pipeline) getFriends(tracker Tracker, filterQuery string, userID string) ([]*Friend, error) {
+1 −1
Original line number Diff line number Diff line
@@ -314,7 +314,7 @@ func (a *authenticationService) configure() {
	if len(sockConfig.SSLCertificate) > 0 && len(sockConfig.SSLPrivateKey) > 0 {
		cer, err := tls.LoadX509KeyPair(sockConfig.SSLCertificate, sockConfig.SSLPrivateKey)
		if err != nil {
			a.logger.Error("Loading SSL certs failed", zap.Error(err))
			a.logger.Fatal("Loading SSL certs failed", zap.Error(err))
		} else {
			a.logger.Info("SSL mode enabled")
			a.httpServer.TLSConfig = &tls.Config{Certificates: []tls.Certificate{cer}}