Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ## [Unreleased] ### Fixed - Correctly report execution mode in Lua runtime after hooks. - Use correct parameter type for creator ID in group update queries. ## [2.2.1] - 2018-11-20 ### Added Loading server/api_group.go +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ func (s *ApiServer) UpdateGroup(ctx context.Context, in *api.UpdateGroupRequest) } } err = UpdateGroup(ctx, s.logger, s.db, groupID, userID, nil, in.GetName(), in.GetLangTag(), in.GetDescription(), in.GetAvatarUrl(), nil, in.GetOpen(), -1) err = UpdateGroup(ctx, s.logger, s.db, groupID, userID, uuid.Nil, in.GetName(), in.GetLangTag(), in.GetDescription(), in.GetAvatarUrl(), nil, in.GetOpen(), -1) if err != nil { if err == ErrGroupPermissionDenied { return nil, status.Error(codes.NotFound, "Group not found or you're not allowed to update.") Loading server/core_group.go +4 −4 Original line number Diff line number Diff line Loading @@ -144,7 +144,7 @@ RETURNING id, creator_id, name, description, avatar_url, state, edge_count, lang return group, nil } func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID, creatorID []byte, name, lang, desc, avatar, metadata *wrappers.StringValue, open *wrappers.BoolValue, maxCount int) error { func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID, creatorID uuid.UUID, name, lang, desc, avatar, metadata *wrappers.StringValue, open *wrappers.BoolValue, maxCount int) error { if !uuid.Equal(uuid.Nil, userID) { allowedUser, err := groupCheckUserPermission(ctx, logger, db, groupID, userID, 1) if err != nil { Loading @@ -168,7 +168,7 @@ func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uu } if lang != nil { statements = append(statements, "lang = $"+strconv.Itoa(index)) statements = append(statements, "lang_tag = $"+strconv.Itoa(index)) params = append(params, lang.GetValue()) index++ } Loading Loading @@ -215,8 +215,8 @@ func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uu index++ } if creatorID != nil { statements = append(statements, "creator_id = $"+strconv.Itoa(index)+"::UUID") if creatorID != uuid.Nil { statements = append(statements, "creator_id = $"+strconv.Itoa(index)) params = append(params, creatorID) } Loading server/runtime_go_nakama.go +4 −4 Original line number Diff line number Diff line Loading @@ -1414,13 +1414,13 @@ func (n *RuntimeGoNakamaModule) GroupUpdate(ctx context.Context, id, name, creat nameWrapper = &wrappers.StringValue{Value: name} } var creatorIDByte []byte creator := uuid.Nil if creatorID != "" { cuid, err := uuid.FromString(creatorID) var err error creator, err = uuid.FromString(creatorID) if err != nil { return errors.New("expects creator ID to be a valid identifier") } creatorIDByte = cuid.Bytes() } var langTagWrapper *wrappers.StringValue Loading Loading @@ -1454,7 +1454,7 @@ func (n *RuntimeGoNakamaModule) GroupUpdate(ctx context.Context, id, name, creat maxCountValue = maxCount } return UpdateGroup(ctx, n.logger, n.db, groupID, uuid.Nil, creatorIDByte, nameWrapper, langTagWrapper, descriptionWrapper, avatarUrlWrapper, metadataWrapper, openWrapper, maxCountValue) return UpdateGroup(ctx, n.logger, n.db, groupID, uuid.Nil, creator, nameWrapper, langTagWrapper, descriptionWrapper, avatarUrlWrapper, metadataWrapper, openWrapper, maxCountValue) } func (n *RuntimeGoNakamaModule) GroupDelete(ctx context.Context, id string) error { Loading server/runtime_lua_nakama.go +3 −3 Original line number Diff line number Diff line Loading @@ -4450,14 +4450,14 @@ func (n *RuntimeLuaNakamaModule) groupUpdate(l *lua.LState) int { } creatorIDStr := l.OptString(3, "") var creatorID []byte creatorID := uuid.Nil if creatorIDStr != "" { cuid, err := uuid.FromString(creatorIDStr) var err error creatorID, err = uuid.FromString(creatorIDStr) if err != nil { l.ArgError(3, "expects creator ID to be a valid identifier") return 0 } creatorID = cuid.Bytes() } langStr := l.OptString(4, "") Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ## [Unreleased] ### Fixed - Correctly report execution mode in Lua runtime after hooks. - Use correct parameter type for creator ID in group update queries. ## [2.2.1] - 2018-11-20 ### Added Loading
server/api_group.go +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ func (s *ApiServer) UpdateGroup(ctx context.Context, in *api.UpdateGroupRequest) } } err = UpdateGroup(ctx, s.logger, s.db, groupID, userID, nil, in.GetName(), in.GetLangTag(), in.GetDescription(), in.GetAvatarUrl(), nil, in.GetOpen(), -1) err = UpdateGroup(ctx, s.logger, s.db, groupID, userID, uuid.Nil, in.GetName(), in.GetLangTag(), in.GetDescription(), in.GetAvatarUrl(), nil, in.GetOpen(), -1) if err != nil { if err == ErrGroupPermissionDenied { return nil, status.Error(codes.NotFound, "Group not found or you're not allowed to update.") Loading
server/core_group.go +4 −4 Original line number Diff line number Diff line Loading @@ -144,7 +144,7 @@ RETURNING id, creator_id, name, description, avatar_url, state, edge_count, lang return group, nil } func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID, creatorID []byte, name, lang, desc, avatar, metadata *wrappers.StringValue, open *wrappers.BoolValue, maxCount int) error { func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uuid.UUID, userID uuid.UUID, creatorID uuid.UUID, name, lang, desc, avatar, metadata *wrappers.StringValue, open *wrappers.BoolValue, maxCount int) error { if !uuid.Equal(uuid.Nil, userID) { allowedUser, err := groupCheckUserPermission(ctx, logger, db, groupID, userID, 1) if err != nil { Loading @@ -168,7 +168,7 @@ func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uu } if lang != nil { statements = append(statements, "lang = $"+strconv.Itoa(index)) statements = append(statements, "lang_tag = $"+strconv.Itoa(index)) params = append(params, lang.GetValue()) index++ } Loading Loading @@ -215,8 +215,8 @@ func UpdateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, groupID uu index++ } if creatorID != nil { statements = append(statements, "creator_id = $"+strconv.Itoa(index)+"::UUID") if creatorID != uuid.Nil { statements = append(statements, "creator_id = $"+strconv.Itoa(index)) params = append(params, creatorID) } Loading
server/runtime_go_nakama.go +4 −4 Original line number Diff line number Diff line Loading @@ -1414,13 +1414,13 @@ func (n *RuntimeGoNakamaModule) GroupUpdate(ctx context.Context, id, name, creat nameWrapper = &wrappers.StringValue{Value: name} } var creatorIDByte []byte creator := uuid.Nil if creatorID != "" { cuid, err := uuid.FromString(creatorID) var err error creator, err = uuid.FromString(creatorID) if err != nil { return errors.New("expects creator ID to be a valid identifier") } creatorIDByte = cuid.Bytes() } var langTagWrapper *wrappers.StringValue Loading Loading @@ -1454,7 +1454,7 @@ func (n *RuntimeGoNakamaModule) GroupUpdate(ctx context.Context, id, name, creat maxCountValue = maxCount } return UpdateGroup(ctx, n.logger, n.db, groupID, uuid.Nil, creatorIDByte, nameWrapper, langTagWrapper, descriptionWrapper, avatarUrlWrapper, metadataWrapper, openWrapper, maxCountValue) return UpdateGroup(ctx, n.logger, n.db, groupID, uuid.Nil, creator, nameWrapper, langTagWrapper, descriptionWrapper, avatarUrlWrapper, metadataWrapper, openWrapper, maxCountValue) } func (n *RuntimeGoNakamaModule) GroupDelete(ctx context.Context, id string) error { Loading
server/runtime_lua_nakama.go +3 −3 Original line number Diff line number Diff line Loading @@ -4450,14 +4450,14 @@ func (n *RuntimeLuaNakamaModule) groupUpdate(l *lua.LState) int { } creatorIDStr := l.OptString(3, "") var creatorID []byte creatorID := uuid.Nil if creatorIDStr != "" { cuid, err := uuid.FromString(creatorIDStr) var err error creatorID, err = uuid.FromString(creatorIDStr) if err != nil { l.ArgError(3, "expects creator ID to be a valid identifier") return 0 } creatorID = cuid.Bytes() } langStr := l.OptString(4, "") Loading