diff --git a/console/console.pb.go b/console/console.pb.go index 94eebb45d..1ca2f6187 100644 --- a/console/console.pb.go +++ b/console/console.pb.go @@ -9520,7 +9520,7 @@ const file_console_proto_rawDesc = "" + "nextCursor\"u\n" + "\vGroupExport\x12'\n" + "\x05group\x18\x01 \x01(\v2\x11.nakama.api.GroupR\x05group\x12=\n" + - "\amembers\x18\x02 \x03(\v2#.nakama.api.GroupUserList.GroupUserR\amembers\"\x93\x01\n" + + "\amembers\x18\x02 \x03(\v2#.nakama.api.GroupUserList_GroupUserR\amembers\"\x93\x01\n" + "\tMatchList\x129\n" + "\amatches\x18\x01 \x03(\v2\x1f.nakama.console.MatchList.MatchR\amatches\x1aK\n" + "\x05Match\x12.\n" + @@ -10524,7 +10524,7 @@ var file_console_proto_goTypes = []any{ (*api.Notification)(nil), // 154: nakama.api.Notification (*api.User)(nil), // 155: nakama.api.User (*wrapperspb.Int32Value)(nil), // 156: google.protobuf.Int32Value - (*api.GroupUserList_GroupUser)(nil), // 157: nakama.api.GroupUserList.GroupUser + (*api.GroupUserList_GroupUser)(nil), // 157: nakama.api.GroupUserList_GroupUser (*wrapperspb.StringValue)(nil), // 158: google.protobuf.StringValue (*rtapi.UserPresence)(nil), // 159: nakama.realtime.UserPresence (*structpb.Struct)(nil), // 160: google.protobuf.Struct @@ -10564,7 +10564,7 @@ var file_console_proto_depIdxs = []int32{ 111, // 17: nakama.console.AuditLogList.entries:type_name -> nakama.console.AuditLogList.AuditLog 151, // 18: nakama.console.GroupList.groups:type_name -> nakama.api.Group 151, // 19: nakama.console.GroupExport.group:type_name -> nakama.api.Group - 157, // 20: nakama.console.GroupExport.members:type_name -> nakama.api.GroupUserList.GroupUser + 157, // 20: nakama.console.GroupExport.members:type_name -> nakama.api.GroupUserList_GroupUser 112, // 21: nakama.console.MatchList.matches:type_name -> nakama.console.MatchList.Match 113, // 22: nakama.console.AddUserRequest.acl:type_name -> nakama.console.AddUserRequest.AclEntry 114, // 23: nakama.console.AddAclTemplateRequest.acl:type_name -> nakama.console.AddAclTemplateRequest.AclEntry diff --git a/console/console.proto b/console/console.proto index 1f7ccf8e6..8461c731f 100644 --- a/console/console.proto +++ b/console/console.proto @@ -740,7 +740,7 @@ message GroupExport { // The group details. api.Group group = 1; // The group's list of members. - repeated api.GroupUserList.GroupUser members = 2; + repeated api.GroupUserList_GroupUser members = 2; } // A list of realtime matches, with their node names. diff --git a/console/console.swagger.json b/console/console.swagger.json index 8a51cb1e4..5647b0825 100644 --- a/console/console.swagger.json +++ b/console/console.swagger.json @@ -4343,7 +4343,7 @@ "state": { "type": "integer", "format": "int32", - "description": "The friend status.\n\none of \"Friend.State\"." + "description": "The friend status.\n\none of \"Friend_State\"." }, "update_time": { "type": "string", @@ -4444,28 +4444,13 @@ "type": "array", "items": { "type": "object", - "$ref": "#/definitions/GroupUser" + "$ref": "#/definitions/GroupUserList_GroupUser" }, "description": "The group's list of members." } }, "description": "An export of all information stored for a group." }, - "GroupUser": { - "type": "object", - "properties": { - "user": { - "$ref": "#/definitions/api.User", - "description": "User." - }, - "state": { - "type": "integer", - "format": "int32", - "description": "Their relationship to the group." - } - }, - "description": "A single user-role pair." - }, "GroupUserList": { "type": "object", "properties": { @@ -4473,7 +4458,7 @@ "type": "array", "items": { "type": "object", - "$ref": "#/definitions/GroupUser" + "$ref": "#/definitions/GroupUserList_GroupUser" }, "description": "User-role pairs for a group." }, @@ -4484,6 +4469,21 @@ }, "description": "A list of users belonging to a group, along with their role." }, + "GroupUserList_GroupUser": { + "type": "object", + "properties": { + "user": { + "$ref": "#/definitions/api.User", + "description": "User." + }, + "state": { + "type": "integer", + "format": "int32", + "description": "Their relationship to the group." + } + }, + "description": "A single user-role pair." + }, "HiroSystems": { "type": "object", "properties": { @@ -5616,21 +5616,6 @@ }, "description": "Request to update an existing user." }, - "UserGroup": { - "type": "object", - "properties": { - "group": { - "$ref": "#/definitions/Group", - "description": "Group." - }, - "state": { - "type": "integer", - "format": "int32", - "description": "The user's relationship to the group." - } - }, - "description": "A single group-role pair." - }, "UserGroupList": { "type": "object", "properties": { @@ -5638,7 +5623,7 @@ "type": "array", "items": { "type": "object", - "$ref": "#/definitions/UserGroup" + "$ref": "#/definitions/UserGroupList_UserGroup" }, "description": "Group-role pairs for a user." }, @@ -5649,6 +5634,21 @@ }, "description": "A list of groups belonging to a user, along with the user's role in each group." }, + "UserGroupList_UserGroup": { + "type": "object", + "properties": { + "group": { + "$ref": "#/definitions/Group", + "description": "Group." + }, + "state": { + "type": "integer", + "format": "int32", + "description": "The user's relationship to the group." + } + }, + "description": "A single group-role pair." + }, "UserList": { "type": "object", "properties": { diff --git a/go.mod b/go.mod index c86f6058b..c5337f2e8 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/gorilla/mux v1.8.1 github.com/gorilla/websocket v1.5.3 github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4 - github.com/heroiclabs/nakama-common v1.44.1 + github.com/heroiclabs/nakama-common v1.44.2-0.20260202090149-1af4154f9e6a github.com/heroiclabs/sql-migrate v0.0.0-20241125131053-95a7949783b0 github.com/jackc/pgerrcode v0.0.0-20250907135507-afb5586c32a6 github.com/jackc/pgx/v5 v5.8.0 diff --git a/go.sum b/go.sum index c6d4ead9b..4512a7402 100644 --- a/go.sum +++ b/go.sum @@ -108,6 +108,10 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4/go.mod h1:6Nz966r3vQYCqIzWsuEl github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/heroiclabs/nakama-common v1.44.1 h1:+2kc87K57lMltVNyxG4JzQdlq0XHe3NVby2ww5E09vg= github.com/heroiclabs/nakama-common v1.44.1/go.mod h1:/KLxEy4+JdasHJLPt+tAXJJ8eXywWr/J+Q+KY+/vg7E= +github.com/heroiclabs/nakama-common v1.44.2-0.20260202081213-ff8cd5b0ec06 h1:qyytZl6obZC7VVMuAYTI7xB+GqWq/2QuVv3GpfD+Rk4= +github.com/heroiclabs/nakama-common v1.44.2-0.20260202081213-ff8cd5b0ec06/go.mod h1:/KLxEy4+JdasHJLPt+tAXJJ8eXywWr/J+Q+KY+/vg7E= +github.com/heroiclabs/nakama-common v1.44.2-0.20260202090149-1af4154f9e6a h1:Brl9cKYAkiEwRRiX705V1jqTHumKNrlNqSE4bsTUHQM= +github.com/heroiclabs/nakama-common v1.44.2-0.20260202090149-1af4154f9e6a/go.mod h1:/KLxEy4+JdasHJLPt+tAXJJ8eXywWr/J+Q+KY+/vg7E= github.com/heroiclabs/sql-migrate v0.0.0-20241125131053-95a7949783b0 h1:hHJcYOP6L2/wZIEnYjjkJM+rOk/bK0uaYkDAejYpLhI= github.com/heroiclabs/sql-migrate v0.0.0-20241125131053-95a7949783b0/go.mod h1:uwcmopkVQIfb/JQqul5zmGI9ounclRC08j9S9lLcpRQ= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= diff --git a/server/console_group.go b/server/console_group.go index e290591bc..e610f3a00 100644 --- a/server/console_group.go +++ b/server/console_group.go @@ -345,7 +345,7 @@ RETURNING state` } var newState sql.NullInt64 - if err := tx.QueryRowContext(ctx, query, groupID, uid, myState, api.GroupUserList_GroupUser_MEMBER).Scan(&newState); err != nil { + if err := tx.QueryRowContext(ctx, query, groupID, uid, myState, api.GroupRoleStatus_MEMBER).Scan(&newState); err != nil { if err == sql.ErrNoRows { return ErrEmptyMemberDemote } diff --git a/server/core_group.go b/server/core_group.go index 19c382872..2ad328f7e 100644 --- a/server/core_group.go +++ b/server/core_group.go @@ -495,13 +495,13 @@ func LeaveGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, tracker Tra } // Only count proper members, not banned edges or join requests. - switch api.GroupUserList_GroupUser_State(state.Int64) { - case api.GroupUserList_GroupUser_SUPERADMIN: + switch api.GroupRoleStatus(state.Int64) { + case api.GroupRoleStatus_SUPERADMIN: otherSuperadminCount += count.Int64 fallthrough - case api.GroupUserList_GroupUser_ADMIN: + case api.GroupRoleStatus_ADMIN: fallthrough - case api.GroupUserList_GroupUser_MEMBER: + case api.GroupRoleStatus_MEMBER: otherMemberCount += count.Int64 } } @@ -1184,7 +1184,7 @@ OR RETURNING state` var newState sql.NullInt64 - if err := tx.QueryRowContext(ctx, query, groupID, uid, myState, api.GroupUserList_GroupUser_MEMBER).Scan(&newState); err != nil { + if err := tx.QueryRowContext(ctx, query, groupID, uid, myState, api.GroupRoleStatus_MEMBER).Scan(&newState); err != nil { if errors.Is(err, sql.ErrNoRows) { continue } @@ -1331,7 +1331,7 @@ RETURNING state` } var newState sql.NullInt64 - if err := tx.QueryRowContext(ctx, query, groupID, uid, myState, api.GroupUserList_GroupUser_MEMBER).Scan(&newState); err != nil { + if err := tx.QueryRowContext(ctx, query, groupID, uid, myState, api.GroupRoleStatus_MEMBER).Scan(&newState); err != nil { if errors.Is(err, sql.ErrNoRows) { continue }