From 4d2f4c1414416de9feaff83f9dbc7c75230385cd Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 10 Sep 2018 10:56:12 -0400 Subject: [PATCH] Repository API model now contains GitHub repo owner and name --- src/Tgstation.Server.Api/Models/Repository.cs | 9 +++++++-- .../Controllers/RepositoryController.cs | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Tgstation.Server.Api/Models/Repository.cs b/src/Tgstation.Server.Api/Models/Repository.cs index 83f610ba5a..ee50701502 100644 --- a/src/Tgstation.Server.Api/Models/Repository.cs +++ b/src/Tgstation.Server.Api/Models/Repository.cs @@ -23,9 +23,14 @@ namespace Tgstation.Server.Api.Models public RevisionInformation RevisionInformation { get; set; } /// - /// If the repository was cloned from GitHub.com. If this enables test merge functionality + /// If the repository was cloned from GitHub.com this will be set with the owner of the repository /// - public bool? IsGitHub { get; set; } + public string GitHubOwner { get; set; } + + /// + /// If the repository was cloned from GitHub.com this will be set with the name of the repository + /// + public string GitHubName { get; set; } /// /// The started by the if any diff --git a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs index 1d1d26b4e8..358437032b 100644 --- a/src/Tgstation.Server.Host/Controllers/RepositoryController.cs +++ b/src/Tgstation.Server.Host/Controllers/RepositoryController.cs @@ -94,7 +94,11 @@ namespace Tgstation.Server.Host.Controllers static async Task PopulateApi(Repository model, Components.Repository.IRepository repository, IDatabaseContext databaseContext, Models.Instance instance, CancellationToken cancellationToken) { - model.IsGitHub = repository.IsGitHubRepository; + if (repository.IsGitHubRepository) + { + model.GitHubOwner = repository.GitHubOwner; + model.GitHubName = repository.GitHubRepoName; + } model.Origin = repository.Origin; model.Reference = repository.Reference; @@ -187,7 +191,6 @@ namespace Tgstation.Server.Host.Controllers api.Origin = model.Origin; api.Reference = model.Reference; - api.IsGitHub = model.Origin.ToUpperInvariant().Contains(uiGitHub); api.ActiveJob = job.ToApi(); return StatusCode((int)HttpStatusCode.Created, api);