Skip to content

Commit

Permalink
Return 404 not found on favouriteSlots when user is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Beyley committed Oct 3, 2023
1 parent 9434804 commit 758b590
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Refresh.GameServer/Endpoints/Game/Levels/LevelEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,14 @@ public SerializedMinimalLevelList GetLevelsFromCategory(RequestContext context,
=> this.GetLevels(context, database, categories, matchService, user, token, "newest");

[GameEndpoint("favouriteSlots/{username}", ContentType.Xml)]
[NullStatusCode(NotFound)]
[MinimumRole(GameUserRole.Restricted)]
public SerializedMinimalFavouriteLevelList? FavouriteLevels(RequestContext context, GameDatabaseContext database, CategoryService categories, MatchService matchService, Token token, string username)
{
SerializedMinimalLevelList? levels = this.GetLevels(context, database, categories, matchService, database.GetUserByUsername(username), token, "favouriteSlots");
GameUser? user = database.GetUserByUsername(username);
if (user == null) return null;

SerializedMinimalLevelList? levels = this.GetLevels(context, database, categories, matchService, user, token, "favouriteSlots");
if (levels == null) return null;

return new SerializedMinimalFavouriteLevelList(levels);
Expand Down

0 comments on commit 758b590

Please sign in to comment.