Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Nullinside.Api.TwitchBot/Controllers/BotController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public BotController(INullinsideContext dbContext, IConfiguration configuration)
return Unauthorized();
}

User? user = _dbContext.Users.FirstOrDefault(u => u.Id == int.Parse(userId.Value));
User? user = _dbContext.Users.FirstOrDefault(u => u.Id == int.Parse(userId.Value) && !u.IsBanned);
if (null == user || null == user.TwitchToken || null == user.TwitchRefreshToken ||
null == user.TwitchTokenExpiration || null == user.TwitchId) {
return Unauthorized();
Expand Down Expand Up @@ -90,7 +90,7 @@ public async Task<IActionResult> ModBotAccount([FromServices] ITwitchApiProxy ap
return Unauthorized();
}

User? user = _dbContext.Users.FirstOrDefault(u => u.Id == int.Parse(userId.Value));
User? user = _dbContext.Users.FirstOrDefault(u => u.Id == int.Parse(userId.Value) && !u.IsBanned);
if (null == user || null == user.TwitchToken || null == user.TwitchRefreshToken ||
null == user.TwitchTokenExpiration || null == user.TwitchId) {
return Unauthorized();
Expand All @@ -114,7 +114,7 @@ public async Task<IActionResult> GetConfig(CancellationToken token) {
return Unauthorized();
}

User? user = await _dbContext.Users.FirstOrDefaultAsync(u => u.Id == int.Parse(userId.Value), token);
User? user = await _dbContext.Users.FirstOrDefaultAsync(u => u.Id == int.Parse(userId.Value) && !u.IsBanned, token);
if (null == user) {
return Unauthorized();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static void Configure(this ITwitchApiProxy api, User user) {
/// <returns>The number of state entries written to the database.</returns>
private static async Task<int> UpdateOAuthInDatabase(this INullinsideContext db, int userId,
TwitchAccessToken oAuth, CancellationToken stoppingToken = new()) {
User? row = await db.Users.FirstOrDefaultAsync(u => u.Id == userId, stoppingToken);
User? row = await db.Users.FirstOrDefaultAsync(u => u.Id == userId && !u.IsBanned, stoppingToken);
if (null == row) {
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/nullinside-api