diff --git a/Source/TeamFoundation.WebApi/HyperlinkFactory.cs b/Source/TeamFoundation.WebApi/HyperlinkFactory.cs
index a321418..d17598e 100644
--- a/Source/TeamFoundation.WebApi/HyperlinkFactory.cs
+++ b/Source/TeamFoundation.WebApi/HyperlinkFactory.cs
@@ -67,10 +67,10 @@ public Uri GetWorkItemUrl(int id, bool fullScreen = true)
return builder.Uri;
}
- public Uri GetPullRequestUrl(int id, string repositoryName)
+ public Uri GetPullRequestUrl(int id, string projectName, string repositoryName)
{
UriBuilder builder = new UriBuilder(this.BaseUrl);
- builder.Path = CombinePath(builder.Path, ProjectName, "_git", repositoryName, "pullrequest", id.ToString());
+ builder.Path = CombinePath(builder.Path, projectName, "_git", repositoryName, "pullrequest", id.ToString());
return builder.Uri;
}
diff --git a/Source/TeamMate/Controls/GlobalCommandBar.xaml b/Source/TeamMate/Controls/GlobalCommandBar.xaml
index eff9301..7937abf 100644
--- a/Source/TeamMate/Controls/GlobalCommandBar.xaml
+++ b/Source/TeamMate/Controls/GlobalCommandBar.xaml
@@ -38,7 +38,7 @@
Visibility="{Binding ElementName=self,
Path=Type,
Converter={x:Static fw:Converters.Visibility},
- ConverterParameter={x:Static vm:CommandBarType.CodeReviews}}">
+ ConverterParameter={x:Static vm:CommandBarType.PullRequests}}">
diff --git a/Source/TeamMate/Model/ProjectContext.cs b/Source/TeamMate/Model/ProjectContext.cs
index e84e02a..872d1d3 100644
--- a/Source/TeamMate/Model/ProjectContext.cs
+++ b/Source/TeamMate/Model/ProjectContext.cs
@@ -8,6 +8,8 @@
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Services.Graph.Client;
namespace Microsoft.Tools.TeamMate.Model
{
@@ -36,6 +38,10 @@ public ProjectContext(ProjectReference reference)
public WorkItemTrackingBatchHttpClient WorkItemTrackingBatchClient { get; set; }
+ public GraphHttpClient GraphClient { get; set; }
+
+ public Task> UsersAsync { get; set; }
+
public string ProjectName { get; set; }
public ICollection WorkItemTypes { get; set; }
diff --git a/Source/TeamMate/Model/ProjectContextSerializer.cs b/Source/TeamMate/Model/ProjectContextSerializer.cs
index a5d5717..e041fa4 100644
--- a/Source/TeamMate/Model/ProjectContextSerializer.cs
+++ b/Source/TeamMate/Model/ProjectContextSerializer.cs
@@ -75,8 +75,11 @@ private PullRequestQueryInfo ReadPullRequestQueryTileInfo(XElement e)
query.Name = e.GetAttribute(Schema.Name);
query.ReviewStatus = e.GetAttribute(Schema.ReviewStatus);
- query.AssignedTo = e.GetAttribute(Schema.AssignedTo);
- query.CreatedBy = e.GetAttribute(Schema.CreatedBy);
+ query.AssignedTo = e.GetAttribute(Schema.AssignedTo);
+ query.CreatedBy = e.GetAttribute(Schema.CreatedBy);
+ query.Project = e.GetAttribute(Schema.PullRequestProject);
+ query.UIAssignedTo = e.GetAttribute(Schema.UIAssignedTo);
+ query.UICreatedBy = e.GetAttribute(Schema.UICreatedBy);
return query;
}
@@ -143,8 +146,11 @@ private XElement WritePullRequestQueryTileInfo(PullRequestQueryInfo query)
XElement e = new XElement(Schema.PullRequestQueryInfo);
e.SetAttribute(Schema.Name, query.Name);
e.SetAttribute(Schema.ReviewStatus, query.ReviewStatus);
- e.SetAttribute(Schema.CreatedBy, query.CreatedBy);
- e.SetAttribute(Schema.AssignedTo, query.AssignedTo);
+ e.SetAttribute(Schema.CreatedBy, query.CreatedBy);
+ e.SetAttribute(Schema.AssignedTo, query.AssignedTo);
+ e.SetAttribute(Schema.UICreatedBy, query.UICreatedBy);
+ e.SetAttribute(Schema.UIAssignedTo, query.UIAssignedTo);
+ e.SetAttribute(Schema.PullRequestProject, query.Project);
return e;
}
@@ -385,6 +391,8 @@ private static class Schema
public const string State = "State";
public const string Title = "Title";
public const string Revision = "Revision";
+ public const string UIAssignedTo = "UIAssignedTo";
+ public const string UICreatedBy = "UICreatedBy";
public static XName RecentItems = "RecentItems";
public static XName RecentlyViewedWorkItems = "RecentlyViewedWorkItems";
@@ -421,6 +429,7 @@ private static class Schema
public static readonly XName PullRequest = "PullRequest";
public const string PullRequestId = "PullRequestId";
public const string PullRequestProjectId = "PullRequestProjectId";
+ public const string PullRequestProject = "PullRequestProject";
// ProjectSettings Stuff
public static readonly XName ProjectSettings = "ProjectSettings";
diff --git a/Source/TeamMate/Model/PullRequestQueryInfo.cs b/Source/TeamMate/Model/PullRequestQueryInfo.cs
index 7995b32..dcc6efe 100644
--- a/Source/TeamMate/Model/PullRequestQueryInfo.cs
+++ b/Source/TeamMate/Model/PullRequestQueryInfo.cs
@@ -16,9 +16,15 @@ public class PullRequestQueryInfo
public string Name { get; set; }
public PullRequestQueryReviewStatus ReviewStatus { get; set; }
- public string CreatedBy { get; set; }
+ public Guid? CreatedBy { get; set; }
- public string AssignedTo { get; set; }
+ public Guid? AssignedTo { get; set; }
+
+ public string UICreatedBy { get; set; }
+
+ public string UIAssignedTo { get; set; }
+
+ public string Project { get; set; }
}
public enum PullRequestQueryReviewStatus
{
diff --git a/Source/TeamMate/Services/ResolverService.cs b/Source/TeamMate/Services/ResolverService.cs
new file mode 100644
index 0000000..7de0138
--- /dev/null
+++ b/Source/TeamMate/Services/ResolverService.cs
@@ -0,0 +1,118 @@
+using Microsoft.VisualStudio.Services.Graph.Client;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace Microsoft.Tools.TeamMate.Services
+{
+ public class ResolverService
+ {
+ private List GraphUserCache { get; set; }
+
+ private List GraphGroupCache { get; set; }
+
+ private List Tasks = new List();
+
+ private async Task> FetchUsersAsync(
+ GraphHttpClient graphClient)
+ {
+ if (GraphUserCache != null)
+ {
+ return GraphUserCache;
+ }
+
+ List users = new List();
+
+ string continuationToken = null;
+ do
+ {
+ var data = await graphClient.ListUsersAsync(null, continuationToken);
+ continuationToken = data.ContinuationToken != null ? data.ContinuationToken.First() : null;
+ foreach (var user in data.GraphUsers)
+ {
+ users.Add(user);
+ }
+ }
+ while (continuationToken != null);
+
+ GraphUserCache = users;
+
+ return users;
+ }
+
+ private async Task> FetchGroupsAsync(
+ GraphHttpClient graphClient)
+ {
+ if (GraphGroupCache != null)
+ {
+ return GraphGroupCache;
+ }
+
+ List groups = new List();
+
+ string continuationToken = null;
+ do
+ {
+ // ListGroupsAsync
+ var data = await graphClient.ListGroupsAsync(null, null, continuationToken);
+ continuationToken = data.ContinuationToken != null ? data.ContinuationToken.First() : null;
+ foreach (var group in data.GraphGroups)
+ {
+ groups.Add(group);
+ }
+ }
+ while (continuationToken != null);
+
+ GraphGroupCache = groups;
+
+ return groups;
+ }
+
+ public void FetchDataSync(
+ GraphHttpClient client)
+ {
+ Tasks.Add(FetchUsersAsync(client));
+ Tasks.Add(FetchGroupsAsync(client));
+ }
+
+ public async Task Resolve(
+ GraphHttpClient client,
+ string value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ await Task.Run(() => { foreach (var task in this.Tasks) { task.Wait(); } });
+
+ foreach (var user in GraphUserCache)
+ {
+ if (user.MailAddress != null &&
+ (user.MailAddress.Contains(value)))
+ {
+ var storageKey = client.GetStorageKeyAsync(user.Descriptor).Result;
+
+ return storageKey.Value;
+ }
+ }
+
+ foreach (var group in GraphGroupCache)
+ {
+ if (group.MailAddress != null &&
+ (group.MailAddress.Contains(value)))
+ {
+ var storageKey = client.GetStorageKeyAsync(group.Descriptor).Result;
+
+ return storageKey.Value;
+ }
+ }
+
+ throw new ArgumentException("Could not resolve '" + value + "'. Try the full email for the person and/or group.");
+
+ }
+ }
+}
diff --git a/Source/TeamMate/Services/VstsConnectionService.cs b/Source/TeamMate/Services/VstsConnectionService.cs
index 8f76725..cd90b7c 100644
--- a/Source/TeamMate/Services/VstsConnectionService.cs
+++ b/Source/TeamMate/Services/VstsConnectionService.cs
@@ -19,6 +19,7 @@
using ProjectHttpClient = Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient;
using WorkItemField = Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItemField;
using WorkItemType = Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItemType;
+using Microsoft.VisualStudio.Services.Graph.Client;
namespace Microsoft.Tools.TeamMate.Services
{
@@ -35,6 +36,10 @@ public class VstsConnectionService
[Import]
public WindowService WindowService { get; set; }
+
+ [Import]
+ public ResolverService ResolverService { get; set; }
+
private async Task ConnectAsync(Uri projectCollectionUri, CancellationToken cancellationToken = default(CancellationToken))
{
@@ -137,6 +142,7 @@ private async Task DoConnectAsync(ProjectInfo projectInfo, Cance
WorkItemTrackingBatchHttpClient batchWitClient = connection.GetClient();
ProjectHttpClient projectClient = connection.GetClient();
GitHttpClient gitClient = connection.GetClient();
+ GraphHttpClient graphClient = connection.GetClient();
var projectId = projectInfo.Reference.ProjectId;
@@ -174,6 +180,7 @@ private async Task DoConnectAsync(ProjectInfo projectInfo, Cance
projectContext.WorkItemTrackingClient = witClient;
projectContext.WorkItemTrackingBatchClient = batchWitClient;
projectContext.GitHttpClient = gitClient;
+ projectContext.GraphClient = graphClient;
projectContext.WorkItemTypes = workItemTypeInfos;
projectContext.ProjectInfo = projectInfo;
projectContext.Identity = identity;
@@ -183,6 +190,9 @@ private async Task DoConnectAsync(ProjectInfo projectInfo, Cance
projectContext.WorkItemFieldsByName = fields.ToDictionary(f => f.ReferenceName, StringComparer.OrdinalIgnoreCase);
projectContext.RequiredWorkItemFieldNames = GetWorkItemFieldsToPrefetch(projectContext.WorkItemFieldsByName);
+ this.ResolverService.FetchDataSync(
+ graphClient);
+
return projectContext;
}
catch (Exception e)
@@ -207,7 +217,6 @@ private async Task DoConnectAsync(ProjectInfo projectInfo, Cance
return null;
}
-
public ICollection GetWorkItemFieldsToPrefetch(IDictionary availableFields)
{
// Prefetch the fields that are interesting to our services or object model...
diff --git a/Source/TeamMate/Services/WindowService.cs b/Source/TeamMate/Services/WindowService.cs
index d18ae81..a17d201 100644
--- a/Source/TeamMate/Services/WindowService.cs
+++ b/Source/TeamMate/Services/WindowService.cs
@@ -1,4 +1,5 @@
-using Microsoft.Tools.TeamMate.Foundation.Shell;
+using Microsoft.TeamFoundation.WorkItemTracking.Client;
+using Microsoft.Tools.TeamMate.Foundation.Shell;
using Microsoft.Tools.TeamMate.Foundation.Threading;
using Microsoft.Tools.TeamMate.Foundation.Windows;
using Microsoft.Tools.TeamMate.Foundation.Windows.Controls;
@@ -381,7 +382,6 @@ private void HandleQuickSearchTriggered(object sender, QuickSearchTriggeredEvent
this.MainWindowViewModel.Search(e.SearchText, true, true);
}
-
public bool RequestShutdown()
{
bool shouldCancel = this.PromptSaveOnDirtyWindows();
diff --git a/Source/TeamMate/TeamMate.csproj b/Source/TeamMate/TeamMate.csproj
index 38e75ef..81891c6 100644
--- a/Source/TeamMate/TeamMate.csproj
+++ b/Source/TeamMate/TeamMate.csproj
@@ -198,6 +198,7 @@
+
diff --git a/Source/TeamMate/ViewModels/PageViewModelBase.cs b/Source/TeamMate/ViewModels/PageViewModelBase.cs
index feeb1c5..b7c2611 100644
--- a/Source/TeamMate/ViewModels/PageViewModelBase.cs
+++ b/Source/TeamMate/ViewModels/PageViewModelBase.cs
@@ -35,7 +35,7 @@ public enum CommandBarType
None,
Home,
WorkItems,
- CodeReviews,
+ PullRequests,
Projects
}
}
diff --git a/Source/TeamMate/ViewModels/ProjectPickerDialogViewModel.cs b/Source/TeamMate/ViewModels/ProjectPickerDialogViewModel.cs
index 131bd35..1da5d91 100644
--- a/Source/TeamMate/ViewModels/ProjectPickerDialogViewModel.cs
+++ b/Source/TeamMate/ViewModels/ProjectPickerDialogViewModel.cs
@@ -103,7 +103,6 @@ public ICollection SelectedProjects
get { return this.selectedProjects; }
set { this.SetProperty(ref this.selectedProjects, value); }
}
-
public void CancelConnect()
{
this.previousCancellationTokenSource.Cancel();
diff --git a/Source/TeamMate/ViewModels/PullRequestPageViewModel.cs b/Source/TeamMate/ViewModels/PullRequestPageViewModel.cs
index 0427fb7..aab91d3 100644
--- a/Source/TeamMate/ViewModels/PullRequestPageViewModel.cs
+++ b/Source/TeamMate/ViewModels/PullRequestPageViewModel.cs
@@ -27,7 +27,7 @@ public class PullRequestPageViewModel : PageViewModelBase, ICommandProvider, IFi
public PullRequestPageViewModel()
{
- this.CommandBarType = CommandBarType.CodeReviews;
+ this.CommandBarType = CommandBarType.PullRequests;
this.modelList = new List();
this.collectionView = new ListCollectionView(this.modelList);
@@ -63,7 +63,7 @@ private ListViewModel CreateListViewModel(ICollectionView collectionView)
model.Filters.Add(new ListViewFilter("Pending", (o) => ((PullRequestRowViewModel)o).IsPending));
model.Filters.Add(new ListViewFilter("Waiting", (o) => ((PullRequestRowViewModel)o).IsWaiting));
model.Filters.Add(new ListViewFilter("Signed Off", (o) => ((PullRequestRowViewModel)o).IsSignedOff));
- model.Filters.Add(new ListViewFilter("Not Signed Off By Me", (o) => !((PullRequestRowViewModel)o).IsSignedOffByMe));
+ model.Filters.Add(new ListViewFilter("Not Signed Off / Declined By Me", (o) => !((PullRequestRowViewModel)o).IsSignedOffOrDeclinedByMe));
model.Filters.Add(new ListViewFilter("Completed", (o) => ((PullRequestRowViewModel)o).IsCompleted));
model.Fields.Add(ListFieldInfo.Create("CreatedBy", "Created By"));
diff --git a/Source/TeamMate/ViewModels/PullRequestPickerViewModel.cs b/Source/TeamMate/ViewModels/PullRequestPickerViewModel.cs
index e498d72..a33f049 100644
--- a/Source/TeamMate/ViewModels/PullRequestPickerViewModel.cs
+++ b/Source/TeamMate/ViewModels/PullRequestPickerViewModel.cs
@@ -1,11 +1,15 @@
-using Microsoft.Tools.TeamMate.Foundation;
+using Microsoft.Tools.TeamMate.Foundation.Threading;
using Microsoft.Tools.TeamMate.Foundation.Validation;
using Microsoft.Tools.TeamMate.Foundation.Windows.MVVM;
using Microsoft.Tools.TeamMate.Model;
+using Microsoft.Tools.TeamMate.Services;
using System;
using System.Collections;
using System.Collections.ObjectModel;
+using System.ComponentModel.Composition;
using System.Linq;
+using System.Threading.Tasks;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
namespace Microsoft.Tools.TeamMate.ViewModels
{
@@ -15,24 +19,33 @@ public class PullRequestPickerViewModel : ValidatableViewModelBase
private PullRequestQueryInfo queryInfo;
private PullRequestQueryReviewStatus reviewStatus;
- private string _selectedAssignedTo;
- private ObservableCollection _assignedTo = new ObservableCollection()
+ private string _selectedProject;
+ private ObservableCollection _project = new ObservableCollection()
{
- "@me",
- "",
};
- private string _selectedCreatedBy;
- private ObservableCollection _createdBy = new ObservableCollection()
- {
- "@me",
- "",
- };
+ private string assignedTo;
+
+ private string createdBy;
+
+ [Import]
+ public ResolverService ResolverService { get; set; }
+
+ [Import]
+ public SessionService SessionService { get; set; }
+
+ [Import]
+ public SettingsService SettingsService { get; set; }
public PullRequestPickerViewModel()
{
- Validator.RuleForProperty(() => Name)
- .IsNotEmpty();
+ Validator
+ .RuleForProperty(() => Name)
+ .IsNotEmpty();
+
+ Validator
+ .RuleForProperty(() => SelectedProject)
+ .IsNotEmpty();
}
public PullRequestQueryInfo QueryInfo
@@ -58,75 +71,69 @@ public PullRequestQueryReviewStatus ReviewStatus
get { return this.reviewStatus; }
set { SetProperty(ref this.reviewStatus, value); }
}
- public IEnumerable AssignedTo
+ public string UIAssignedTo
{
- get { return this._assignedTo; }
+ get { return this.assignedTo; }
+ set { SetProperty(ref this.assignedTo, value); }
}
- public string SelectedAssignedTo
+
+ public string UICreatedBy
{
- get { return this._selectedAssignedTo; }
- set
- {
- this._selectedAssignedTo = value;
- OnPropertyChanged("SelectedAssignedTo");
- }
+ get { return this.createdBy; }
+ set { SetProperty(ref this.createdBy, value); }
}
- public string NewAssignedTo
+ public IEnumerable Project
{
- set
- {
- if (SelectedAssignedTo != null)
- {
- return;
- }
-
- if (!string.IsNullOrEmpty(value))
- {
- this._assignedTo.Add(value);
- SelectedAssignedTo = value;
- }
- }
+ get { return this._project; }
}
-
- public IEnumerable CreatedBy
+ public void AddProject(string projectName)
{
- get { return this._createdBy; }
+ this._project.Add(projectName);
}
- public string SelectedCreatedBy
+ public string SelectedProject
{
- get { return this._selectedCreatedBy; }
+ get { return this._selectedProject; }
set
{
- this._selectedCreatedBy = value;
- OnPropertyChanged("SelectedCreatedBy");
+ this._selectedProject = value;
+ OnPropertyChanged("SelectedProject");
}
}
-
- public string NewCreatedBy
+ public string NewProject
{
set
{
- if (SelectedCreatedBy != null)
+ if (SelectedProject != null)
{
return;
}
if (!string.IsNullOrEmpty(value))
{
- this._createdBy.Add(value);
- SelectedCreatedBy = value;
+ this._project.Add(value);
+ SelectedProject = value;
}
}
}
+
private void Invalidate()
{
if (this.queryInfo != null)
{
this.Name = this.queryInfo.Name;
this.ReviewStatus = this.queryInfo.ReviewStatus;
- this.SelectedAssignedTo = this.queryInfo.AssignedTo;
- this.SelectedCreatedBy = this.queryInfo.CreatedBy;
+ this.UIAssignedTo = this.queryInfo.UIAssignedTo;
+ this.UICreatedBy = this.queryInfo.UICreatedBy;
+ }
+
+ var projects = this.SettingsService.Settings.Projects;
+ if (projects.Count > 0)
+ {
+ foreach (var project in projects)
+ {
+ AddProject(project.ProjectName);
+ }
}
}
@@ -136,8 +143,9 @@ public void Flush()
{
this.queryInfo.Name = this.Name.Trim();
this.queryInfo.ReviewStatus = this.ReviewStatus;
- this.queryInfo.AssignedTo = this.SelectedAssignedTo;
- this.queryInfo.CreatedBy = this.SelectedCreatedBy;
+ this.queryInfo.Project = this.SelectedProject.Trim();
+ this.queryInfo.UIAssignedTo = this.UIAssignedTo;
+ this.queryInfo.UICreatedBy = this.UICreatedBy;
}
}
diff --git a/Source/TeamMate/ViewModels/PullRequestQueryViewModel.cs b/Source/TeamMate/ViewModels/PullRequestQueryViewModel.cs
index be2bea9..dd92144 100644
--- a/Source/TeamMate/ViewModels/PullRequestQueryViewModel.cs
+++ b/Source/TeamMate/ViewModels/PullRequestQueryViewModel.cs
@@ -10,6 +10,7 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.SourceControl.WebApi;
+using Microsoft.TeamFoundation.Build.WebApi;
namespace Microsoft.Tools.TeamMate.ViewModels
{
@@ -69,7 +70,10 @@ public override Task RefreshAsync(NotificationScope notificationScope = null)
[Import]
public SessionService SessionService { get; set; }
-
+
+ [Import]
+ public ResolverService ResolverService { get; set; }
+
public ProjectInfo ProjectInfo { get; private set; }
private async Task DoRefreshAsync(NotificationScope notificationScope)
@@ -85,7 +89,7 @@ private async Task DoRefreshAsync(NotificationScope notificationScope)
{
FireQueryExecuting();
- PullRequestQuery query = CreateBuiltInQuery();
+ PullRequestQuery query = await CreateBuiltInQuery();
if (query != null)
{
@@ -94,7 +98,7 @@ private async Task DoRefreshAsync(NotificationScope notificationScope)
List tasks = new List();
var queryAsyncTask = projectContext.GitHttpClient.GetPullRequestsByProjectAsync(
- projectContext.ProjectInfo.ProjectName,
+ query.ProjectName,
query.GitPullRequestSearchCriteria);
tasks.Add(queryAsyncTask);
@@ -115,6 +119,7 @@ private async Task DoRefreshAsync(NotificationScope notificationScope)
pullRequest.Url = projectContext.HyperlinkFactory.GetPullRequestUrl(
pullRequest.Reference.PullRequestId,
+ query.ProjectName,
pullRequest.Reference.Repository.Name);
}
@@ -151,25 +156,50 @@ private async Task DoRefreshAsync(NotificationScope notificationScope)
}
}
- private PullRequestQuery CreateBuiltInQuery()
+ private async Task CreateBuiltInQuery()
{
var pc = this.SessionService.Session.ProjectContext;
var query = new PullRequestQuery();
- query.ProjectName = pc.ProjectName;
+
+ if (this.queryInfo.Project != null)
+ {
+ query.ProjectName = this.queryInfo.Project;
+ }
+ else
+ {
+ query.ProjectName = pc.ProjectName;
+ }
+
query.GitPullRequestSearchCriteria = new GitPullRequestSearchCriteria
{
Status = PullRequestQueryInfo.ReviewStatusesMap[this.queryInfo.ReviewStatus],
};
- if (this.queryInfo.AssignedTo == "@me")
+ if (this.queryInfo.AssignedTo.HasValue)
+ {
+ query.GitPullRequestSearchCriteria.ReviewerId = this.queryInfo.AssignedTo.Value;
+ }
+ else if (this.queryInfo.UIAssignedTo != null)
{
- query.GitPullRequestSearchCriteria.ReviewerId = pc.Identity.Id;
+ query.GitPullRequestSearchCriteria.ReviewerId = await this.ResolverService.Resolve(
+ this.SessionService.Session.ProjectContext.GraphClient,
+ this.queryInfo.UIAssignedTo);
+
+ this.queryInfo.AssignedTo = query.GitPullRequestSearchCriteria.ReviewerId;
}
- if (this.queryInfo.CreatedBy == "@me")
+ if (this.queryInfo.CreatedBy.HasValue)
{
- query.GitPullRequestSearchCriteria.CreatorId = pc.Identity.Id;
+ query.GitPullRequestSearchCriteria.CreatorId = this.queryInfo.CreatedBy.Value;
+ }
+ else if (this.queryInfo.UICreatedBy != null)
+ {
+ query.GitPullRequestSearchCriteria.CreatorId = await this.ResolverService.Resolve(
+ this.SessionService.Session.ProjectContext.GraphClient,
+ this.queryInfo.UICreatedBy);
+
+ this.queryInfo.CreatedBy = query.GitPullRequestSearchCriteria.CreatorId;
}
return query;
@@ -225,7 +255,7 @@ private PullRequestRowViewModel CreateViewModel(GitPullRequest gitPullRequest, P
PullRequestRowViewModel viewModel = ViewModelFactory.Create();
viewModel.IdentityRef = projectContext.Identity.Id.ToString();
viewModel.Reference = gitPullRequest;
- viewModel.ProjectName = projectContext.ProjectName;
+ viewModel.ProjectName = gitPullRequest.Repository.Name;
return viewModel;
}
}
diff --git a/Source/TeamMate/ViewModels/PullRequestRowViewModel.cs b/Source/TeamMate/ViewModels/PullRequestRowViewModel.cs
index 95c46b3..9044528 100644
--- a/Source/TeamMate/ViewModels/PullRequestRowViewModel.cs
+++ b/Source/TeamMate/ViewModels/PullRequestRowViewModel.cs
@@ -70,12 +70,7 @@ private void Invalidate()
this.IsPending = this.IsActive && !this.IsSignedOff;
this.IsCompleted = (this.Reference.Status == PullRequestStatus.Completed);
this.IsAssignedToMe = this.IsActive && this.Reference.Reviewers.Count(x => x.Id == this.IdentityRef) == 1;
-
- if (this.IsSignedOff)
- {
- this.IsSignedOffByMe = this.Reference.Reviewers.Count(x => x.Id == this.IdentityRef && (x.Vote == 10 || x.Vote == 5)) == 1;
- }
-
+ this.IsSignedOffOrDeclinedByMe = this.Reference.Reviewers.Count(x => x.Id == this.IdentityRef && (x.Vote == 10 || x.Vote == 5 || x.HasDeclined.GetValueOrDefault(false))) != 0;
this.BottomLeftText = this.CreatedBy;
if (this.IterationCount > 1)
@@ -92,7 +87,7 @@ private void Invalidate()
public bool IsActive { get; set; }
public bool IsPending { get; set; }
public bool IsSignedOff { get; set; }
- public bool IsSignedOffByMe { get; set; }
+ public bool IsSignedOffOrDeclinedByMe { get; set; }
public bool IsCompleted { get; set; }
public bool IsWaiting { get; set; }
diff --git a/Source/TeamMate/ViewModels/TileCollectionViewModel.cs b/Source/TeamMate/ViewModels/TileCollectionViewModel.cs
index 1f18544..e7adbf9 100644
--- a/Source/TeamMate/ViewModels/TileCollectionViewModel.cs
+++ b/Source/TeamMate/ViewModels/TileCollectionViewModel.cs
@@ -184,7 +184,7 @@ private static void UpdateCounter(Counter counter, ICollection GetItemsTowardsCount()
{
- // TODO: Get CodeReviews too? How do these surface in the UI?
+ // TODO: Get PullRequests too? How do these surface in the UI?
var allWorkItems = Tiles.OfType().Where(wiq => wiq.IncludeInItemCountSummary)
.Select(q => q.WorkItemQuery.WorkItems).Where(items => items != null).SelectMany(w => w).Distinct().ToArray();
diff --git a/Source/TeamMate/Windows/PullRequestQueryEditorDialog.xaml b/Source/TeamMate/Windows/PullRequestQueryEditorDialog.xaml
index 6cca54d..7efd4c3 100644
--- a/Source/TeamMate/Windows/PullRequestQueryEditorDialog.xaml
+++ b/Source/TeamMate/Windows/PullRequestQueryEditorDialog.xaml
@@ -6,7 +6,7 @@
xmlns:tmc="clr-namespace:Microsoft.Tools.TeamMate.Controls"
xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="Microsoft.Tools.TeamMate.Windows.PullRequestQueryEditorDialog"
FocusManager.FocusedElement="{Binding ElementName=nameTextBox}"
- SizeToContent="WidthAndHeight" Height="294"
+ SizeToContent="WidthAndHeight"
>