mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-28 07:27:18 +01:00
Nullify RevisionInformation
This commit is contained in:
@@ -117,8 +117,8 @@ namespace Tgstation.Server.Host.Components.Chat.Commands
|
||||
async db => results = await db
|
||||
.RevisionInformations
|
||||
.AsQueryable()
|
||||
.Where(x => x.Instance.Id == instance.Id && x.CommitSha == head)
|
||||
.SelectMany(x => x.ActiveTestMerges)
|
||||
.Where(x => x.Instance!.Id == instance.Id && x.CommitSha == head)
|
||||
.SelectMany(x => x.ActiveTestMerges!)
|
||||
.Select(x => x.TestMerge)
|
||||
.Select(x => new Models.TestMerge
|
||||
{
|
||||
@@ -144,7 +144,7 @@ namespace Tgstation.Server.Host.Components.Chat.Commands
|
||||
compileJobToUse = null;
|
||||
}
|
||||
|
||||
results = compileJobToUse?.RevisionInformation.ActiveTestMerges.Select(x => x.TestMerge).ToList() ?? Enumerable.Empty<Models.TestMerge>();
|
||||
results = compileJobToUse?.RevisionInformation.ActiveTestMerges?.Select(x => x.TestMerge).ToList() ?? Enumerable.Empty<Models.TestMerge>();
|
||||
}
|
||||
|
||||
return new MessageContent
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host.Models
|
||||
{
|
||||
/// <inheritdoc cref="Api.Models.Internal.RevisionInformation" />
|
||||
@@ -23,22 +22,22 @@ namespace Tgstation.Server.Host.Models
|
||||
/// The <see cref="Models.Instance"/> the <see cref="RevisionInformation"/> belongs to.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Instance Instance { get; set; }
|
||||
public Instance? Instance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// See <see cref="Api.Models.RevisionInformation.PrimaryTestMerge"/>.
|
||||
/// </summary>
|
||||
public TestMerge PrimaryTestMerge { get; set; }
|
||||
public TestMerge? PrimaryTestMerge { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// See <see cref="Api.Models.RevisionInformation.ActiveTestMerges"/>.
|
||||
/// </summary>
|
||||
public ICollection<RevInfoTestMerge> ActiveTestMerges { get; set; }
|
||||
public ICollection<RevInfoTestMerge>? ActiveTestMerges { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// See <see cref="CompileJob"/>s made from this <see cref="RevisionInformation"/>.
|
||||
/// </summary>
|
||||
public ICollection<CompileJob> CompileJobs { get; set; }
|
||||
public ICollection<CompileJob>? CompileJobs { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Api.Models.RevisionInformation ToApi() => new Api.Models.RevisionInformation
|
||||
@@ -47,8 +46,8 @@ namespace Tgstation.Server.Host.Models
|
||||
Timestamp = Timestamp,
|
||||
OriginCommitSha = OriginCommitSha,
|
||||
PrimaryTestMerge = PrimaryTestMerge?.ToApi(),
|
||||
ActiveTestMerges = ActiveTestMerges.Select(x => x.TestMerge.ToApi()).ToList(),
|
||||
CompileJobs = CompileJobs.Select(x => new Api.Models.EntityId
|
||||
ActiveTestMerges = (ActiveTestMerges ?? throw new InvalidOperationException("ActiveTestMerges must be set!")).Select(x => x.TestMerge.ToApi()).ToList(),
|
||||
CompileJobs = (CompileJobs ?? throw new InvalidOperationException("CompileJobs must be set!")).Select(x => new Api.Models.EntityId
|
||||
{
|
||||
Id = x.Id,
|
||||
}).ToList(),
|
||||
|
||||
Reference in New Issue
Block a user