Skip to content

Commit

Permalink
Patch to 3.9.4 (#205)
Browse files Browse the repository at this point in the history
* Refactor - move SimpleEntity into Gameboard.Api.Features.Common.

* Don't bootstrap JobsService in integration test env

* Address an issue where Gameboard was incorrectly evaluating whether a challenge has a deployed gamespace after destroy. Resolves #182.

* Server-side hardening for illegal mime type upload. Removed bare repositories.
Updated recommended extensions.

* Add improved file upload validation. Add editor config to suppress private member warnings.

* Update unit tests

* Remove server-side html escaping of user input (handled client side).

* Resolved an issue that prevented assignees from being display in the support ticket list.

* Remove unnecessary dependency injection from the app hub.

* Fix build error in ticket service
  • Loading branch information
sei-bstein authored Jun 15, 2023
1 parent 4792200 commit b62952a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/Gameboard.Api/Features/Hubs/AppHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class AppHub : Hub<IAppHubEvent>, IAppHubAction

private readonly IGameService _gameService;
private readonly IMapper _mapper;
private readonly IMediator _mediator;

public AppHub
(
Expand All @@ -41,7 +40,6 @@ IPlayerStore playerStore
PlayerStore = playerStore;
_gameService = gameService;
_mapper = mapper;
_mediator = mediator;
}

public override Task OnConnectedAsync()
Expand Down Expand Up @@ -97,7 +95,7 @@ await Clients.OthersInGroup(player.TeamId).PlayerEvent(
public async Task<SyncStartState> JoinGame(string gameId)
{
if (string.IsNullOrWhiteSpace(gameId))
throw new ArgumentNullException();
throw new ArgumentNullException(nameof(gameId));

var game = await _gameService
.BuildQuery()
Expand Down Expand Up @@ -125,7 +123,7 @@ public async Task<SyncStartState> JoinGame(string gameId)
public async Task LeaveChannel(string channelId)
{
if (string.IsNullOrWhiteSpace(channelId))
throw new ArgumentNullException();
throw new ArgumentNullException(nameof(channelId));

await Groups.RemoveFromGroupAsync(Context.ConnectionId, channelId);
}
Expand Down
20 changes: 8 additions & 12 deletions src/Gameboard.Api/Features/Ticket/TicketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public async Task<Ticket> Create(NewTicket model, string actorId, bool sudo)

// upload files
var uploads = await _fileUploadService.Upload(Path.Combine(Options.SupportUploadsFolder, entity.Id), model.Uploads);
if (uploads.Count() > 0)
if (uploads.Any())
{
var fileNames = uploads.Select(x => x.FileName).ToArray();
entity.Attachments = Mapper.Map<string>(fileNames);
Expand Down Expand Up @@ -200,8 +200,7 @@ public async Task<IEnumerable<TicketSummary>> List(TicketSearchFilter model, str
if (model.Take > 0)
q = q.Take(model.Take);

var tickets = Mapper.Map<IEnumerable<Ticket>>(await q.ToArrayAsync());
return Transform(tickets);
return Transform(await Mapper.ProjectTo<TicketSummary>(q).ToArrayAsync());
}

public async Task<TicketActivity> AddComment(NewTicketComment model, string actorId)
Expand Down Expand Up @@ -375,16 +374,13 @@ private void AddActivity(Data.Ticket entity, string actorId, bool statusChanged,
}
}

private IEnumerable<TicketSummary> Transform(IEnumerable<Ticket> tickets)
private IEnumerable<TicketSummary> Transform(IEnumerable<TicketSummary> tickets)
{
return tickets.Select(t => Transform(t));
}

private TicketSummary Transform(Ticket ticket)
{
var ticketSummary = Mapper.Map<TicketSummary>(ticket);
ticketSummary.FullKey = FullKey(ticket.Key);
return ticketSummary;
return tickets.Select(t =>
{
t.FullKey = FullKey(t.Key);
return t;
}).ToArray();
}

private Ticket TransformInPlace(Ticket ticket)
Expand Down

0 comments on commit b62952a

Please sign in to comment.