fix(guild): /guild/join returns guild_status per branch (APPLYING for approval path, JOINING otherwise)

GuildJoinTask.Parse() reads data[guild_status].ToInt() directly; hardcoding 2
for the APPROVAL path was wrong. GuildOpResult gains nullable GuildStatus; JoinAsync
sets 1 (APPLYING) for the pending-request path and 2 (JOINING) for instant joins.
Controller reads r.GuildStatus. Two new tests assert the wire value per path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-27 13:51:04 -04:00
parent d7f9ba8f2a
commit 771d884314
4 changed files with 59 additions and 7 deletions

View File

@@ -275,7 +275,7 @@ public sealed class GuildService : IGuildService
if (existing is { Status: GuildJoinRequestStatus.Pending })
{
// Already pending — idempotent, no-op.
return GuildOpResult.Ok;
return new(GuildOpResultCode.Ok, GuildStatus: 1); // APPLYING
}
if (existing is not null)
@@ -296,11 +296,11 @@ public sealed class GuildService : IGuildService
CreatedAt = now,
}, ct);
}
return GuildOpResult.Ok;
return new(GuildOpResultCode.Ok, GuildStatus: 1); // APPLYING
}
await CommitJoinAsync(viewerId, guildId, now, ct);
return GuildOpResult.Ok;
return new(GuildOpResultCode.Ok, GuildStatus: 2); // JOINING
}
private async Task CommitJoinAsync(long viewerId, int guildId, DateTime now, CancellationToken ct)

View File

@@ -22,7 +22,7 @@ public enum GuildOpResultCode
InvalidRoleTransition,
}
public sealed record GuildOpResult(GuildOpResultCode Code, int? GuildId = null, string? Detail = null)
public sealed record GuildOpResult(GuildOpResultCode Code, int? GuildId = null, string? Detail = null, int? GuildStatus = null)
{
public static readonly GuildOpResult Ok = new(GuildOpResultCode.Ok);
public bool IsOk => Code == GuildOpResultCode.Ok;