Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change making dropbox author and email to be part of payload, not per…

…sisted
  • Loading branch information...
commit da074f747254f0ad1e39cf46729706a913e8ae48 1 parent b907f8e
Suwat Ch suwatch authored
4 Kudu.Contracts/Dropbox/DropboxDeployInfo.cs
View
@@ -21,6 +21,10 @@ public class DropboxDeployInfo
public string Path { get; set; }
+ public string UserName { get; set; }
+
+ public string Email { get; set; }
+
public IEnumerable<DropboxDeltaInfo> Deltas { get; set; }
}
}
11 Kudu.FunctionalTests/DropboxTests.cs
View
@@ -35,16 +35,11 @@ public void TestDropboxBasic()
}
AccountInfo account = GetAccountInfo(oauth);
- DropboxDeployInfo deploy = GetDeployInfo(oauth);
+ DropboxDeployInfo deploy = GetDeployInfo(oauth, account);
string appName = KuduUtils.GetRandomWebsiteName("DropboxTest");
ApplicationManager.Run(appName, appManager =>
{
- appManager.SettingsManager.SetValues(
- new KeyValuePair<string, string>("dropbox_username", account.display_name),
- new KeyValuePair<string, string>("dropbox_email", account.email)
- ).Wait();
-
HttpClient client = HttpClientHelper.CreateClient(appManager.ServiceUrl, appManager.DeploymentManager.Credentials);
client.PostAsJsonAsync("deploy", deploy).Result.EnsureSuccessful();
@@ -98,7 +93,7 @@ private DeltaInfo GetDeltaInfo(OAuthInfo oauth, string cursor = null)
}
}
- private DropboxDeployInfo GetDeployInfo(OAuthInfo oauth, string cursor = null)
+ private DropboxDeployInfo GetDeployInfo(OAuthInfo oauth, AccountInfo account, string cursor = null)
{
List<DropboxDeltaInfo> deltas = new List<DropboxDeltaInfo>();
string timeStamp = GetUtcTimeStamp();
@@ -155,6 +150,8 @@ private DropboxDeployInfo GetDeployInfo(OAuthInfo oauth, string cursor = null)
OldCursor = oldCursor,
NewCursor = newCursor,
Path = "/",
+ UserName = account.display_name,
+ Email = account.email,
Deltas = deltas
};
}
16 Kudu.Services/FetchHelpers/DropboxHelper.cs
View
@@ -19,8 +19,6 @@ public class DropboxHelper
{
public const string Dropbox = "dropbox";
public const string CursorKey = "dropbox_cursor";
- public const string UserNameKey = "dropbox_username";
- public const string EmailKey = "dropbox_email";
private const string DropboxApiContentUri = "https://api-content.dropbox.com/";
private const string SandboxFilePath = "1/files/sandbox";
@@ -72,7 +70,7 @@ public ChangeSet Sync(DropboxDeployInfo info, string branch)
finally
{
// Commit anyway even partial change
- changeSet = _repository.Commit(prefix + " sync with dropbox at " + DateTime.UtcNow.ToString("g"), GetAuthor());
+ changeSet = _repository.Commit(prefix + " sync with dropbox at " + DateTime.UtcNow.ToString("g"), String.Format("{0} <{1}>", info.UserName, info.Email));
}
// Save new dropboc cursor
@@ -94,18 +92,6 @@ private bool IsEmptyRepo()
}
}
- private string GetAuthor()
- {
- string userName = _settings.GetValue(UserNameKey);
- string email = _settings.GetValue(EmailKey);
- if (!String.IsNullOrEmpty(userName) && !String.IsNullOrEmpty(email))
- {
- return String.Format("{0} <{1}>", userName, email);
- }
-
- return null;
- }
-
private void ApplyChanges(DropboxDeployInfo info)
{
Semaphore sem = new Semaphore(MaxConcurrentRequests, MaxConcurrentRequests);
7 Kudu.Services/ServiceHookHandlers/DropboxHandler.cs
View
@@ -30,11 +30,12 @@ public DeployAction TryParseDeploymentInfo(HttpRequestBase request, JObject payl
deploymentInfo = null;
if (!String.IsNullOrEmpty(payload.Value<string>("NewCursor")))
{
- deploymentInfo = new DropboxInfo(payload);
+ var dropboxInfo = new DropboxInfo(payload);
+ deploymentInfo = dropboxInfo;
// Temporary deployment
- string authorName = _settings.GetValue(DropboxHelper.UserNameKey) ?? _settings.GetGitUsername();
- string authorEmail = _settings.GetValue(DropboxHelper.EmailKey) ?? _settings.GetGitEmail();
+ string authorName = dropboxInfo.DeployInfo.UserName;
+ string authorEmail = dropboxInfo.DeployInfo.Email;
string message = "Syncing with dropbox at " + DateTime.UtcNow.ToString("g");
deploymentInfo.TargetChangeset = new ChangeSet("InProgress", authorName, authorEmail, message, DateTimeOffset.MinValue);
Please sign in to comment.
Something went wrong with that request. Please try again.