Include version in services Changes api call so the server knows how to redirect.

This commit is contained in:
Taloth Saldono 2015-02-07 15:56:36 +01:00
parent 955029ec43
commit 40987cc335
3 changed files with 6 additions and 4 deletions

View File

@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.UpdateTests
{
const string branch = "master";
UseRealHttp();
var recent = Subject.GetRecentUpdates(branch);
var recent = Subject.GetRecentUpdates(branch, new Version(2, 0));
recent.Should().NotBeEmpty();
recent.Should().OnlyContain(c => c.Hash.IsNotNullOrWhiteSpace());

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.Update
@ -23,7 +24,7 @@ namespace NzbDrone.Core.Update
public List<UpdatePackage> GetRecentUpdatePackages()
{
var branch = _configFileProvider.Branch;
return _updatePackageProvider.GetRecentUpdates(branch);
return _updatePackageProvider.GetRecentUpdates(branch, BuildInfo.Version);
}
}
}

View File

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Update
public interface IUpdatePackageProvider
{
UpdatePackage GetLatestUpdate(string branch, Version currentVersion);
List<UpdatePackage> GetRecentUpdates(string branch);
List<UpdatePackage> GetRecentUpdates(string branch, Version currentVersion);
}
public class UpdatePackageProvider : IUpdatePackageProvider
@ -37,9 +37,10 @@ namespace NzbDrone.Core.Update
return update.UpdatePackage;
}
public List<UpdatePackage> GetRecentUpdates(string branch)
public List<UpdatePackage> GetRecentUpdates(string branch, Version currentVersion)
{
var request = _requestBuilder.Build("/update/{branch}/changes");
request.UriBuilder.SetQueryParam("version", currentVersion);
request.UriBuilder.SetQueryParam("os", OsInfo.Os.ToString().ToLowerInvariant());
request.AddSegment("branch", branch);